Class: Loxxy::Ast::LoxForStmt
- Inherits:
-
LoxCompoundExpr
- Object
- LoxNode
- LoxCompoundExpr
- Loxxy::Ast::LoxForStmt
- Defined in:
- lib/loxxy/ast/lox_for_stmt.rb
Instance Attribute Summary collapse
-
#body_stmt ⇒ LoxNode
Body statement.
-
#test_expr ⇒ LoxNode
readonly
Test expression.
-
#update_expr ⇒ LoxNode
readonly
Update expression.
Attributes inherited from LoxCompoundExpr
Attributes inherited from LoxNode
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
Part of the 'visitee' role in Visitor design pattern.
-
#condition ⇒ LoxNode
Accessor to the condition expression.
-
#initialize(aPosition, initialization, testExpr, updateExpr) ⇒ LoxForStmt
constructor
A new instance of LoxForStmt.
Methods inherited from LoxNode
Constructor Details
#initialize(aPosition, initialization, testExpr, updateExpr) ⇒ LoxForStmt
Returns a new instance of LoxForStmt.
21 22 23 24 25 26 |
# File 'lib/loxxy/ast/lox_for_stmt.rb', line 21 def initialize(aPosition, initialization, testExpr, updateExpr) child = initialization ? [initialization] : [] super(aPosition, child) @test_expr = testExpr @update_expr = updateExpr end |
Instance Attribute Details
#body_stmt ⇒ LoxNode
Returns body statement.
15 16 17 |
# File 'lib/loxxy/ast/lox_for_stmt.rb', line 15 def body_stmt @body_stmt end |
#test_expr ⇒ LoxNode (readonly)
Returns test expression.
9 10 11 |
# File 'lib/loxxy/ast/lox_for_stmt.rb', line 9 def test_expr @test_expr end |
#update_expr ⇒ LoxNode (readonly)
Returns update expression.
12 13 14 |
# File 'lib/loxxy/ast/lox_for_stmt.rb', line 12 def update_expr @update_expr end |
Instance Method Details
#accept(visitor) ⇒ Object
Part of the 'visitee' role in Visitor design pattern.
30 31 32 |
# File 'lib/loxxy/ast/lox_for_stmt.rb', line 30 def accept(visitor) visitor.visit_for_stmt(self) end |
#condition ⇒ LoxNode
Accessor to the condition expression
36 37 38 |
# File 'lib/loxxy/ast/lox_for_stmt.rb', line 36 def condition subnodes[0] end |