Class: Citrus::IndexEq

Inherits:
Node
  • Object
show all
Defined in:
lib/citrus/nodes.rb

Instance Method Summary collapse

Instance Method Details

#codegen(g) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/citrus/nodes.rb', line 48

def codegen(g)
  val = expression.codegen(g).last
  unless op.value.empty?
    ival = g.load_index(index.var.value, index.expression.codegen(g).last)
    val = g.equate(op.value, ival, expression.codegen(g).last)
  end
  g.assign_index(index.var.value, index.expression.codegen(g).last, val)
end