* 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
This commit is contained in:
parent
762a7ec12e
commit
0043929b5f
@ -1,3 +1,8 @@
|
|||||||
|
Tue Jun 26 03:15:27 2007 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* 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 <ko1@atdot.net>
|
Tue Jun 26 02:50:24 2007 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* compile.c (setup_arg): support kind of "m(*ary, x)" method call.
|
* compile.c (setup_arg): support kind of "m(*ary, x)" method call.
|
||||||
|
48
compile.c
48
compile.c
@ -2410,10 +2410,9 @@ add_ensure_iseq(LINK_ANCHOR *ret, rb_iseq_t *iseq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
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);
|
VALUE argc = INT2FIX(0);
|
||||||
NODE *argn = node->nd_args;
|
|
||||||
int nsplat = 0;
|
int nsplat = 0;
|
||||||
DECL_ANCHOR(arg_block);
|
DECL_ANCHOR(arg_block);
|
||||||
DECL_ANCHOR(args_splat);
|
DECL_ANCHOR(args_splat);
|
||||||
@ -2471,7 +2470,7 @@ setup_arg(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *node, VALUE *flag)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
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 */
|
/* args */
|
||||||
if (nd_type(node) != NODE_VCALL) {
|
if (nd_type(node) != NODE_VCALL) {
|
||||||
argc = setup_arg(iseq, args, node, &flag);
|
argc = setup_args(iseq, args, node->nd_args, &flag);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
argc = INT2FIX(0);
|
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;
|
iseq->compile_data->current_block = Qfalse;
|
||||||
|
|
||||||
if (nd_type(node) == NODE_SUPER) {
|
if (nd_type(node) == NODE_SUPER) {
|
||||||
argc = setup_arg(iseq, args, node, &flag);
|
argc = setup_args(iseq, args, node->nd_args, &flag);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* NODE_ZSUPER */
|
/* 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 (node->nd_head) {
|
||||||
if (nd_type(node->nd_head) == NODE_ARRAY) {
|
argc = setup_args(iseq, args, node->nd_head, &flag);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
argc = 0;
|
argc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ADD_SEQ(ret, args);
|
ADD_SEQ(ret, args);
|
||||||
ADD_INSN2(ret, nd_line(node), invokeblock, INT2FIX(argc),
|
ADD_INSN2(ret, nd_line(node), invokeblock, argc, INT2FIX(flag));
|
||||||
INT2FIX(flag));
|
|
||||||
|
|
||||||
if (poped) {
|
if (poped) {
|
||||||
ADD_INSN(ret, nd_line(node), pop);
|
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 flag = 0;
|
||||||
VALUE argc;
|
VALUE argc;
|
||||||
|
|
||||||
argc = setup_arg(iseq, args, node, &flag);
|
argc = setup_args(iseq, args, node->nd_args, &flag);
|
||||||
|
|
||||||
if (node->nd_recv == (NODE *) 1) {
|
if (node->nd_recv == (NODE *) 1) {
|
||||||
ADD_INSN(recv, nd_line(node), putself);
|
ADD_INSN(recv, nd_line(node), putself);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user