From 329484693ae6d9dab6e01675faf7b535c2783a83 Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 27 Nov 2007 01:02:30 +0000 Subject: * insns.def, compile.c: fix to allow dsym for alias/undef. [ruby-dev:32355] * bootstraptest/test_method.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 55 +++++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 30 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index ce462fef0d..9a096ccf61 100644 --- a/compile.c +++ b/compile.c @@ -4063,42 +4063,37 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) break; } case NODE_ALIAS:{ - VALUE s1, s2; - enum node_type t; + VALUE s1, s2; + enum node_type t; - if (((t = nd_type(node->u1.node)) != NODE_LIT && t != NODE_DSYM) || - ((t = nd_type(node->u2.node)) != NODE_LIT && t != NODE_DSYM)) { - rb_compile_bug(ERROR_ARGS "alias args must be NODE_LIT or NODE_DSYM"); - } - s1 = node->u1.node->nd_lit; - s2 = node->u2.node->nd_lit; + COMPILE(ret, "alias arg1", node->u1.node); + COMPILE(ret, "alias arg2", node->u2.node); - ADD_INSN3(ret, nd_line(node), alias, Qfalse, ID2SYM(rb_to_id(s1)), - ID2SYM(rb_to_id(s2))); - if (!poped) { - ADD_INSN(ret, nd_line(node), putnil); - } - break; + ADD_INSN1(ret, nd_line(node), alias, Qfalse); + + if (!poped) { + ADD_INSN(ret, nd_line(node), putnil); + } + break; } case NODE_VALIAS:{ - ADD_INSN3(ret, nd_line(node), alias, Qtrue, ID2SYM(node->u1.id), - ID2SYM(node->u2.id)); - if (!poped) { - ADD_INSN(ret, nd_line(node), putnil); - } - break; + ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->u1.id)); + ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->u2.id)); + ADD_INSN1(ret, nd_line(node), alias, Qtrue); + + if (!poped) { + ADD_INSN(ret, nd_line(node), putnil); + } + break; } case NODE_UNDEF:{ - enum node_type t = nd_type(node->u2.node); - if (t != NODE_LIT && t != NODE_DSYM) { - rb_compile_bug(ERROR_ARGS "undef args must be NODE_LIT"); - } - ADD_INSN1(ret, nd_line(node), undef, - ID2SYM(rb_to_id(node->u2.node->nd_lit))); - if (!poped) { - ADD_INSN(ret, nd_line(node), putnil); - } - break; + COMPILE(ret, "undef arg", node->u2.node); + ADD_INSN(ret, nd_line(node), undef); + + if (!poped) { + ADD_INSN(ret, nd_line(node), putnil); + } + break; } case NODE_CLASS:{ VALUE iseqval = -- cgit v1.2.3