Class: SetLocalNode
- Inherits:
-
Struct
- Object
- Struct
- SetLocalNode
- Defined in:
- lib/toylang/ast/nodes.rb,
lib/toylang/interpreter/evaluation.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
39 40 41 |
# File 'lib/toylang/ast/nodes.rb', line 39 def name @name end |
#value ⇒ Object
Returns the value of attribute value
39 40 41 |
# File 'lib/toylang/ast/nodes.rb', line 39 def value @value end |
Instance Method Details
#eval(context) ⇒ Object
71 72 73 |
# File 'lib/toylang/interpreter/evaluation.rb', line 71 def eval(context) context.locals[name] = value.eval(context) end |