Class: Loxxy::Ast::LoxForStmt

Inherits:
LoxCompoundExpr show all
Defined in:
lib/loxxy/ast/lox_for_stmt.rb

Instance Attribute Summary collapse

Attributes inherited from LoxCompoundExpr

#subnodes

Attributes inherited from LoxNode

#position

Instance Method Summary collapse

Methods inherited from LoxCompoundExpr

#accept

Methods inherited from LoxNode

#accept, #done!

Methods included from ASTVisitee

#define_accept, #snake_case

Constructor Details

#initialize(aPosition, initialization, testExpr, updateExpr) ⇒ 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_stmtLoxNode



15
16
17
# File 'lib/loxxy/ast/lox_for_stmt.rb', line 15

def body_stmt
  @body_stmt
end

#test_exprLoxNode (readonly)



9
10
11
# File 'lib/loxxy/ast/lox_for_stmt.rb', line 9

def test_expr
  @test_expr
end

#update_exprLoxNode (readonly)



12
13
14
# File 'lib/loxxy/ast/lox_for_stmt.rb', line 12

def update_expr
  @update_expr
end

Instance Method Details

#conditionLoxNode

Accessor to the condition expression



30
31
32
# File 'lib/loxxy/ast/lox_for_stmt.rb', line 30

def condition
  subnodes[0]
end