Class: WhileNode
- Inherits:
-
Struct
- Object
- Struct
- WhileNode
- Defined in:
- lib/toylang/ast/nodes.rb,
lib/toylang/interpreter/evaluation.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#condition ⇒ Object
Returns the value of attribute condition.
Instance Method Summary collapse
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
45 46 47 |
# File 'lib/toylang/ast/nodes.rb', line 45 def body @body end |
#condition ⇒ Object
Returns the value of attribute condition
45 46 47 |
# File 'lib/toylang/ast/nodes.rb', line 45 def condition @condition end |
Instance Method Details
#eval(context) ⇒ Object
128 129 130 |
# File 'lib/toylang/interpreter/evaluation.rb', line 128 def eval(context) body.eval(context) while condition.eval(context).ruby_value end |