diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-27 01:02:30 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-27 01:02:30 +0000 |
commit | 329484693ae6d9dab6e01675faf7b535c2783a83 (patch) | |
tree | e831796a4899b7d86c4ac76e07118f3c9f4d4035 /compile.c | |
parent | 724de18989353b277b175e56ef69b78ec339510a (diff) | |
download | ruby-329484693ae6d9dab6e01675faf7b535c2783a83.tar.gz |
* 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
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 55 |
1 files changed, 25 insertions, 30 deletions
@@ -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 = |