Skip to content

Commit

Permalink
Support more types for ldc_class
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Brown committed Jun 23, 2010
1 parent f3b32f5 commit 6ff0cae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 1 addition & 3 deletions lib/bitescript/bytecode.rb
Expand Up @@ -65,9 +65,7 @@ def ldc_long(value); method_visitor.visit_ldc_insn(java.lang.Long.new(value)); 2
def ldc_float(value); method_visitor.visit_ldc_insn(java.lang.Float.new(value)); 1; end
def ldc_double(value); method_visitor.visit_ldc_insn(java.lang.Double.new(value)); 2; end
def ldc_class(value)
value = value.java_class unless Java::JavaClass === value
method_visitor.visit_ldc_insn(ASM::Type.get_type(value))
1
method_visitor.visit_ldc_insn(ASM::Type.get_type(ci(value)))
end
line = __LINE__; eval "
def #{const_down}(value)
Expand Down
2 changes: 2 additions & 0 deletions test/test_bytecode.rb
Expand Up @@ -82,6 +82,8 @@ def test_ldc
assert_equal([:visit_ldc_insn, java.lang.Double.new(1)], @dummy.single {ldc(1.0)})

assert_equal([:visit_ldc_insn, BiteScript::ASM::Type.get_type(System.java_class)], @dummy.single {ldc(System)})
type = BiteScript::ASM::Type.get_type('Lcom.example.Test;')
assert_equal([:visit_ldc_insn, type], @dummy.single {ldc(type)})
end

def test_int_insns
Expand Down

0 comments on commit 6ff0cae

Please sign in to comment.