Class: Riml::Compiler::BinaryOperatorNodeVisitor

Inherits:
Visitor
  • Object
show all
Defined in:
lib/compiler.rb

Overview

operator, operands

Instance Method Summary collapse

Methods inherited from Visitor

#initialize, #visit

Constructor Details

This class inherits a constructor from Riml::Compiler::Visitor

Instance Method Details

#compile(node) ⇒ Object



426
427
428
429
430
431
432
433
434
435
436
437
438
# File 'lib/compiler.rb', line 426

def compile(node)
  op1, op2 = node.operand1, node.operand2
  [op1, op2].each {|n| n.parent = node}
  op1.accept(visitor_for_node(op1))
  if node.ignorecase_capable_operator?(node.operator)
    operator_suffix = "# "
  else
    operator_suffix = " "
  end
  node.compiled_output << " #{node.operator}#{operator_suffix}"
  op2.accept(visitor_for_node(op2))
  node.compiled_output
end