mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* compile.c (iseq_compile_each): fix setting is_local flag.
* yarvtest/test_class.rb: add a test for class local isntance variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
42ce75cdff
commit
c27ef66dd7
3 changed files with 28 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Tue Feb 6 15:44:11 2007 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* compile.c (iseq_compile_each): fix setting is_local flag.
|
||||||
|
|
||||||
|
* yarvtest/test_class.rb: add a test for class local isntance variable.
|
||||||
|
|
||||||
Tue Feb 6 14:15:34 2007 Koichi Sasada <ko1@atdot.net>
|
Tue Feb 6 14:15:34 2007 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* compile.c, insns.def: remove (get|set)instancevariable2 and add a
|
* compile.c, insns.def: remove (get|set)instancevariable2 and add a
|
||||||
|
|
|
@ -3325,7 +3325,7 @@ iseq_compile_each(yarv_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
|
||||||
}
|
}
|
||||||
case NODE_IASGN:
|
case NODE_IASGN:
|
||||||
case NODE_IASGN2:{
|
case NODE_IASGN2:{
|
||||||
int is_local = (nd_type(node) == NODE_IVAR2) ? 1 : 0;
|
int is_local = (nd_type(node) == NODE_IASGN2) ? 1 : 0;
|
||||||
COMPILE(ret, "lvalue", node->nd_value);
|
COMPILE(ret, "lvalue", node->nd_value);
|
||||||
if (!poped) {
|
if (!poped) {
|
||||||
ADD_INSN(ret, nd_line(node), dup);
|
ADD_INSN(ret, nd_line(node), dup);
|
||||||
|
|
|
@ -751,6 +751,27 @@ class TestClass < YarvTestBase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ivar2
|
def test_ivar2
|
||||||
|
ae %q{
|
||||||
|
class C
|
||||||
|
def initialize
|
||||||
|
@_v = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
def foo
|
||||||
|
@_v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
class D < C
|
||||||
|
def initialize
|
||||||
|
@_v = 2
|
||||||
|
super
|
||||||
|
end
|
||||||
|
def foo
|
||||||
|
[@_v, super]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
D.new.foo
|
||||||
|
}
|
||||||
ae %q{
|
ae %q{
|
||||||
class C
|
class C
|
||||||
def initialize
|
def initialize
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue