diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | eval.c | 67 | ||||
-rw-r--r-- | gc.c | 1 | ||||
-rw-r--r-- | node.h | 2 | ||||
-rw-r--r-- | parse.y | 4 |
5 files changed, 44 insertions, 35 deletions
@@ -1,3 +1,8 @@ +Tue Oct 7 02:57:53 2003 Yukihiro Matsumoto <matz@ruby-lang.org> + + * parse.y (stmt): rhs of multiple assignment should not be + expanded using "to_a". [ruby-dev:21527] + Tue Oct 7 01:42:34 2003 GOTOU Yuuzou <gotoyuzo@notwork.org> * ext/openssl/ossl_asn1.c (ossl_asn1_get_asn1type): use appropriate @@ -2774,6 +2774,10 @@ rb_eval(self, n) result = splat_value(rb_eval(self, node->nd_head)); break; + case NODE_TO_ARY: + result = rb_ary_to_ary(rb_eval(self, node->nd_head)); + break; + case NODE_SVALUE: result = avalue_splat(rb_eval(self, node->nd_head)); if (result == Qundef) result = Qnil; @@ -6483,45 +6487,42 @@ rb_f_at_exit() void rb_exec_end_proc() { - struct end_proc_data *link, *save; + struct end_proc_data *link, *tmp; int status; - save = link = end_procs; - while (link) { - PUSH_TAG(PROT_NONE); - if ((status = EXEC_TAG()) == 0) { - (*link->func)(link->data); - } - POP_TAG(); - if (status) { - error_handle(status); - } - link = link->next; - } - link = end_procs; - while (link != save) { - PUSH_TAG(PROT_NONE); - if ((status = EXEC_TAG()) == 0) { - (*link->func)(link->data); - } - POP_TAG(); - if (status) { - error_handle(status); - } - link = link->next; - } while (ephemeral_end_procs) { link = ephemeral_end_procs; - ephemeral_end_procs = link->next; - PUSH_TAG(PROT_NONE); - if ((status = EXEC_TAG()) == 0) { - (*link->func)(link->data); + ephemeral_end_procs = 0; + while (link) { + PUSH_TAG(PROT_NONE); + if ((status = EXEC_TAG()) == 0) { + (*link->func)(link->data); + } + POP_TAG(); + if (status) { + error_handle(status); + } + tmp = link; + link = link->next; + free(tmp); } - POP_TAG(); - if (status) { - error_handle(status); + } + while (end_procs) { + link = end_procs; + end_procs = 0; + while (link) { + PUSH_TAG(PROT_NONE); + if ((status = EXEC_TAG()) == 0) { + (*link->func)(link->data); + } + POP_TAG(); + if (status) { + error_handle(status); + } + tmp = link; + link = link->next; + free(tmp); } - free(link); } } @@ -755,6 +755,7 @@ rb_gc_mark_children(ptr) case NODE_COLON2: case NODE_ARGS: case NODE_SPLAT: + case NODE_TO_ARY: case NODE_SVALUE: ptr = (VALUE)obj->as.node.u1.node; goto again; @@ -88,6 +88,7 @@ enum node_type { NODE_ARGSCAT, NODE_ARGSPUSH, NODE_SPLAT, + NODE_TO_ARY, NODE_SVALUE, NODE_BLOCK_ARG, NODE_BLOCK_PASS, @@ -308,6 +309,7 @@ typedef struct RNode { #define NEW_ARGSCAT(a,b) NEW_NODE(NODE_ARGSCAT,a,b,0) #define NEW_ARGSPUSH(a,b) NEW_NODE(NODE_ARGSPUSH,a,b,0) #define NEW_SPLAT(a) NEW_NODE(NODE_SPLAT,a,0,0) +#define NEW_TO_ARY(a) NEW_NODE(NODE_TO_ARY,a,0,0) #define NEW_SVALUE(a) NEW_NODE(NODE_SVALUE,a,0,0) #define NEW_BLOCK_ARG(v) NEW_NODE(NODE_BLOCK_ARG,v,0,local_cnt(v)) #define NEW_BLOCK_PASS(b) NEW_NODE(NODE_BLOCK_PASS,0,b,0) @@ -486,7 +486,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem | mlhs '=' command_call { value_expr($3); - $1->nd_value = ($1->nd_head) ? NEW_SPLAT($3) : NEW_ARRAY($3); + $1->nd_value = NEW_TO_ARY($3); $$ = $1; } | var_lhs tOP_ASGN command_call @@ -578,7 +578,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem } | mlhs '=' arg_value { - $1->nd_value = ($1->nd_head) ? NEW_SPLAT($3) : NEW_ARRAY($3); + $1->nd_value = NEW_TO_ARY($3); $$ = $1; } | mlhs '=' mrhs |