Class: Sol::CallNode
- Inherits:
-
Struct
- Object
- Struct
- Sol::CallNode
- Defined in:
- lib/sol/nodes.rb,
lib/sol/interpreter.rb
Overview
Node of a method call or local variable access, can take any of these forms:
method # this form can also be a local variable
method(argument1, argument2)
receiver.method
receiver.method(argument1, argument2)
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#method ⇒ Object
Returns the value of attribute method.
-
#receiver ⇒ Object
Returns the value of attribute receiver.
Instance Method Summary collapse
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments
61 62 63 |
# File 'lib/sol/nodes.rb', line 61 def arguments @arguments end |
#method ⇒ Object
Returns the value of attribute method
61 62 63 |
# File 'lib/sol/nodes.rb', line 61 def method @method end |
#receiver ⇒ Object
Returns the value of attribute receiver
61 62 63 |
# File 'lib/sol/nodes.rb', line 61 def receiver @receiver end |
Instance Method Details
#eval(context) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/sol/interpreter.rb', line 97 def eval(context) if receiver.nil? && arguments.empty? && RuntimeModel::Runtime.locals[method] return context::Runtime.locals[method] else if receiver value = receiver.eval(context) else value = RuntimeModel::Runtime.current_self # I think this works end eval_arguments = arguments.map do |arg| arg.eval(context) end value.call(method, eval_arguments) end end |