Class: Java::OrgJrubyAst::LocalAsgnNode

Inherits:
Object
  • Object
show all
Defined in:
lib/duby/old/compiler_old.rb,
lib/duby/old/typer_old.rb

Instance Method Summary collapse

Instance Method Details

#compile(builder) ⇒ Object



644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
# File 'lib/duby/old/compiler_old.rb', line 644

def compile(builder)
  local_index = builder.local(name, value_node.type(builder))
  
  # assignment consumes a value, so we dup it
  # TODO: inefficient if we don't actually need the result
  value_node.compile(builder)
  builder.dup
  
  case type(builder)
  when Jboolean
    builder.bistore(local_index)
  when Jint
    builder.istore(local_index)
  when Jlong
    builder.lstore(local_index)
  when Jfloat
    builder.fstore(local_index)
  when Jdouble
    builder.dstore(local_index)
  else
    builder.astore(local_index)
  end
end

#type(builder) ⇒ Object



126
127
128
# File 'lib/duby/old/typer_old.rb', line 126

def type(builder)
  @type ||= builder.local_type(name)
end