From d82f3e7d5cf98f484cd1b3ed397e45d2fd7cf806 Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 3 Jul 2007 18:50:28 +0000 Subject: * compile.c (compile_massign): fix massign compilation (example: a, *v, (*x) = ...). [ruby-dev:31107] * bootstraptest/test_massign.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 3bcce2871c..a30a98efdb 100644 --- a/compile.c +++ b/compile.c @@ -2049,12 +2049,22 @@ compile_massign(rb_iseq_t *iseq, LINK_ANCHOR *ret, DECL_ANCHOR(lhs); COMPILE_POPED(lhs, "post", n->nd_head); - REMOVE_ELEM(FIRST_ELEMENT(lhs)); + + if (nd_type(n->nd_head) != NODE_MASGN) { + REMOVE_ELEM(FIRST_ELEMENT(lhs)); + } + ADD_SEQ(ret, lhs); n = n->nd_next; } - make_masgn_lhs(iseq, ret, splatn->nd_1st); + if (splatn->nd_1st == (NODE*)(VALUE)-1) { + /* v1, *, v2 = expr */ + ADD_INSN(ret, nd_line(splatn), pop); + } + else { + make_masgn_lhs(iseq, ret, splatn->nd_1st); + } } else { make_masgn_lhs(iseq, ret, splatn); -- cgit v1.2.3