Skip to content

Commit 9a0d83e

Browse files
committed
add a couple of getivar tests for symbols
1 parent 40c3088 commit 9a0d83e

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

bootstraptest/test_yjit.rb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,3 +578,40 @@ def run
578578
run
579579
run
580580
}
581+
582+
# getinstancevariable on Symbol
583+
assert_equal '[nil, nil]', %q{
584+
# @foo to exercise the getinstancevariable instruction
585+
public def get_foo
586+
@foo
587+
end
588+
589+
dyn_sym = ("a" + "b").to_sym
590+
sym = :static
591+
592+
# compile get_foo
593+
dyn_sym.get_foo
594+
dyn_sym.get_foo
595+
596+
[dyn_sym.get_foo, sym.get_foo]
597+
}
598+
599+
# attr_reader on Symbol
600+
assert_equal '[nil, nil]', %q{
601+
class Symbol
602+
attr_reader :foo
603+
end
604+
605+
public def get_foo
606+
foo
607+
end
608+
609+
dyn_sym = ("a" + "b").to_sym
610+
sym = :static
611+
612+
# compile get_foo
613+
dyn_sym.get_foo
614+
dyn_sym.get_foo
615+
616+
[dyn_sym.get_foo, sym.get_foo]
617+
}

0 commit comments

Comments
 (0)