summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-14 02:31:28 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-14 02:31:28 +0000
commit5e4edb43a2a3183931b3d891b1c4bd6031b73560 (patch)
tree72a01359c66730ddc010ad3a49cde1ba766d3199 /compile.c
parent86294fad68d33767a153acddf6d3c2044e7ec36f (diff)
* insns.def: add a "putcbase" instruction.
* compile.c, insns.def: fix to use putcbase instruction for class search. Qundef should not be used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/compile.c b/compile.c
index e29d6aedd3..10476081fe 100644
--- a/compile.c
+++ b/compile.c
@@ -2280,22 +2280,24 @@ compile_colon2(rb_iseq_t *iseq, NODE * node,
return COMPILE_OK;
}
-static int
+static VALUE
compile_cpath(LINK_ANCHOR *ret, rb_iseq_t *iseq, NODE *cpath)
{
if (nd_type(cpath) == NODE_COLON3) {
/* toplevel class ::Foo */
ADD_INSN1(ret, nd_line(cpath), putobject, rb_cObject);
+ return Qfalse;
}
else if (cpath->nd_head) {
/* Bar::Foo */
COMPILE(ret, "nd_else->nd_head", cpath->nd_head);
+ return Qfalse;
}
else {
/* class at cbase Foo */
- ADD_INSN1(ret, nd_line(cpath), putobject, Qundef);
+ ADD_INSN(ret, nd_line(cpath), putcbase);
+ return Qtrue;
}
- return COMPILE_OK;
}
static int
@@ -3438,14 +3440,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
if (node->nd_vid) {
- ADD_INSN1(ret, nd_line(node), putobject, Qundef);
- ADD_INSN1(ret, nd_line(node), setconstant,
- ID2SYM(node->nd_vid));
+ ADD_INSN (ret, nd_line(node), putcbase);
+ ADD_INSN1(ret, nd_line(node), setconstant, ID2SYM(node->nd_vid));
}
else {
compile_cpath(ret, iseq, node->nd_else);
- ADD_INSN1(ret, nd_line(node), setconstant,
- ID2SYM(node->nd_else->nd_mid));
+ ADD_INSN1(ret, nd_line(node), setconstant, ID2SYM(node->nd_else->nd_mid));
}
break;
}