class Yadriggy::VariableCall

Method call without parentheses or arguments.

Public Class Methods

new(sexp) click to toggle source
Calls superclass method Yadriggy::IdentifierOrCall::new
# File lib/yadriggy/ast.rb, line 219
def initialize(sexp)
  super(sexp[1])
end
tag() click to toggle source
# File lib/yadriggy/ast.rb, line 217
def self.tag() :vcall end

Public Instance Methods

accept(evaluator) click to toggle source

A method for Visitor pattern. @param [Eval] evaluator the visitor of Visitor pattern. @return [void]

# File lib/yadriggy/ast.rb, line 226
def accept(evaluator)
  evaluator.variable_call(self)
end
const_value() click to toggle source

Returns Undef because const_value is supposed to return the resulting value of executing this variable call.

# File lib/yadriggy/ast_value.rb, line 98
def const_value() Undef end
do_invocation() click to toggle source

Gets the resulting value of the invocation of this method.

# File lib/yadriggy/ast_value.rb, line 119
def do_invocation()
  obj = get_receiver_object
  if obj.nil?
    Undef
  else
    begin
      obj.send(@name)
    rescue NameError
      Undef
    end
  end
end
invoked_method() click to toggle source

Gets a Method object called by this AST node. If this AST node belongs to UnboundMethod, Undef will be returned.

# File lib/yadriggy/ast_value.rb, line 104
def invoked_method()
  obj = get_receiver_object
  if obj.nil?
    Undef
  else
    begin
      obj.method(@name)
    rescue NameError
      Undef
    end
  end
end
value() click to toggle source

Gets an ASTree object representing the method body invoked by this AST node. Undef may be returned if the method is not found.

# File lib/yadriggy/ast_value.rb, line 86
def value()
  mth = invoked_method
  if mth == Undef
    Undef
  else
    root.reify(mth) || Undef
  end
end