Class: Loxxy::Ast::LoxIfStmt
- Inherits:
-
LoxCompoundExpr
- Object
- LoxNode
- LoxCompoundExpr
- Loxxy::Ast::LoxIfStmt
- Defined in:
- lib/loxxy/ast/lox_if_stmt.rb
Instance Attribute Summary collapse
-
#else_stmt ⇒ LoxNode, NilClass
readonly
Code of else branch.
-
#then_stmt ⇒ LoxNode
readonly
Code of then branch.
Attributes inherited from LoxCompoundExpr
Attributes inherited from LoxNode
Instance Method Summary collapse
-
#condition ⇒ LoxNode
Accessor to the condition expression.
-
#initialize(aPosition, condExpr, thenStmt, elseStmt) ⇒ LoxIfStmt
constructor
A new instance of LoxIfStmt.
Methods inherited from LoxCompoundExpr
Methods inherited from LoxNode
Methods included from ASTVisitee
Constructor Details
#initialize(aPosition, condExpr, thenStmt, elseStmt) ⇒ LoxIfStmt
Returns a new instance of LoxIfStmt.
18 19 20 21 22 |
# File 'lib/loxxy/ast/lox_if_stmt.rb', line 18 def initialize(aPosition, condExpr, thenStmt, elseStmt) super(aPosition, [condExpr]) @then_stmt = thenStmt @else_stmt = elseStmt end |
Instance Attribute Details
#else_stmt ⇒ LoxNode, NilClass (readonly)
Returns code of else branch.
12 13 14 |
# File 'lib/loxxy/ast/lox_if_stmt.rb', line 12 def else_stmt @else_stmt end |
#then_stmt ⇒ LoxNode (readonly)
Returns code of then branch.
9 10 11 |
# File 'lib/loxxy/ast/lox_if_stmt.rb', line 9 def then_stmt @then_stmt end |
Instance Method Details
#condition ⇒ LoxNode
Accessor to the condition expression
26 27 28 |
# File 'lib/loxxy/ast/lox_if_stmt.rb', line 26 def condition subnodes[0] end |