Method: Loxxy::BackEnd::Engine#after_if_stmt

Defined in:
lib/loxxy/back_end/engine.rb

#after_if_stmt(anIfStmt, aVisitor) ⇒ Object



132
133
134
135
136
137
138
139
140
# File 'lib/loxxy/back_end/engine.rb', line 132

def after_if_stmt(anIfStmt, aVisitor)
  # Retrieve the result of the condition evaluation
  condition = stack.pop
  if condition.truthy?
    anIfStmt.then_stmt.accept(aVisitor)
  elsif anIfStmt.else_stmt
    anIfStmt.else_stmt.accept(aVisitor)
  end
end