From 0043929b5f564ef6c9377d8321a4e4a4b7ec6e14 Mon Sep 17 00:00:00 2001 From: ko1 Date: Mon, 25 Jun 2007 18:23:35 +0000 Subject: [PATCH] * compile.c: rename setup_arg() to setup_args(). fix to use setup_args() at processing NODE_YIELD. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ compile.c | 48 ++++++++---------------------------------------- 2 files changed, 13 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index a658de635c..9cdafd20b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jun 26 03:15:27 2007 Koichi Sasada + + * compile.c: rename setup_arg() to setup_args(). + fix to use setup_args() at processing NODE_YIELD. + Tue Jun 26 02:50:24 2007 Koichi Sasada * compile.c (setup_arg): support kind of "m(*ary, x)" method call. diff --git a/compile.c b/compile.c index 92c7611f2e..a56962468b 100644 --- a/compile.c +++ b/compile.c @@ -2410,10 +2410,9 @@ add_ensure_iseq(LINK_ANCHOR *ret, rb_iseq_t *iseq) } static VALUE -setup_arg(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *node, VALUE *flag) +setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, VALUE *flag) { VALUE argc = INT2FIX(0); - NODE *argn = node->nd_args; int nsplat = 0; DECL_ANCHOR(arg_block); DECL_ANCHOR(args_splat); @@ -2471,7 +2470,7 @@ setup_arg(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *node, VALUE *flag) break; } default: { - rb_bug("setup_arg: unknown node: %s\n", ruby_node_name(nd_type(node))); + rb_bug("setup_arg: unknown node: %s\n", ruby_node_name(nd_type(argn))); } } } @@ -3503,7 +3502,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) /* args */ if (nd_type(node) != NODE_VCALL) { - argc = setup_arg(iseq, args, node, &flag); + argc = setup_args(iseq, args, node->nd_args, &flag); } else { argc = INT2FIX(0); @@ -3540,7 +3539,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) iseq->compile_data->current_block = Qfalse; if (nd_type(node) == NODE_SUPER) { - argc = setup_arg(iseq, args, node, &flag); + argc = setup_args(iseq, args, node->nd_args, &flag); } else { /* NODE_ZSUPER */ @@ -3706,45 +3705,14 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } if (node->nd_head) { - if (nd_type(node->nd_head) == NODE_ARRAY) { - argc = node->nd_head->nd_alen; - compile_array(iseq, args, node->nd_head, Qfalse); - POP_ELEMENT(args); - debugs("argc: %d\n", argc); - } - else { - if (nd_type(node->nd_head) == NODE_ARGSCAT) { - if (node->nd_state == Qtrue) { - flag |= VM_CALL_ARGS_SPLAT_BIT; - } - - argc = node->nd_head->nd_head->nd_alen + 1; - compile_array(iseq, args, node->nd_head->nd_head, Qfalse); - POP_ELEMENT(args); - - COMPILE(args, "args(cat: splat)", - node->nd_head->nd_body); - } - else if (nd_type(node->nd_head) == NODE_SPLAT) { - if (node->nd_state == Qtrue) { - flag |= VM_CALL_ARGS_SPLAT_BIT; - } - - argc = 1; - COMPILE(args, "splat", node->nd_head->nd_head); - } - else { - COMPILE(args, "nd_head(1)", node->nd_head); - argc = 1; - } - } + argc = setup_args(iseq, args, node->nd_head, &flag); } else { argc = 0; } + ADD_SEQ(ret, args); - ADD_INSN2(ret, nd_line(node), invokeblock, INT2FIX(argc), - INT2FIX(flag)); + ADD_INSN2(ret, nd_line(node), invokeblock, argc, INT2FIX(flag)); if (poped) { ADD_INSN(ret, nd_line(node), pop); @@ -4346,7 +4314,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) VALUE flag = 0; VALUE argc; - argc = setup_arg(iseq, args, node, &flag); + argc = setup_args(iseq, args, node->nd_args, &flag); if (node->nd_recv == (NODE *) 1) { ADD_INSN(recv, nd_line(node), putself);