Class: Nodes
- Inherits:
-
Struct
- Object
- Struct
- Nodes
- Defined in:
- lib/toylang/ast/nodes.rb,
lib/toylang/interpreter/evaluation.rb
Instance Attribute Summary collapse
-
#nodes ⇒ Object
Returns the value of attribute nodes.
Instance Method Summary collapse
Instance Attribute Details
#nodes ⇒ Object
Returns the value of attribute nodes
3 4 5 |
# File 'lib/toylang/ast/nodes.rb', line 3 def nodes @nodes end |
Instance Method Details
#<<(node) ⇒ Object
4 5 6 7 |
# File 'lib/toylang/ast/nodes.rb', line 4 def <<(node) nodes << node self end |
#eval(context) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/toylang/interpreter/evaluation.rb', line 11 def eval(context) return_value = nil nodes.each do |node| return_value = node.eval(context) end return_value || Runtime['nil'] end |