summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-25 18:23:35 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-25 18:23:35 +0000
commit0043929b5f564ef6c9377d8321a4e4a4b7ec6e14 (patch)
treef8f13dae81b071661da66a70a71552f2bb799efb /compile.c
parent762a7ec12e1cd6cd59129eeb1ed42035157ded2a (diff)
* 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
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c48
1 files changed, 8 insertions, 40 deletions
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);