summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-07-29 09:16:29 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2013-07-29 09:16:29 -0700
commit4229b41c6840d695e2fe2746866b719c26ca3a19 (patch)
tree3e953228d00f221c2def3fc40dec1308d34e06d8
parentcd199210d60482c9ac27d5c1c4ea5dcc109125a9 (diff)
parent2eb2cdf0deefeb090e9737f86e5c300660bda299 (diff)
downloadmruby-4229b41c6840d695e2fe2746866b719c26ca3a19.tar.gz
mruby-4229b41c6840d695e2fe2746866b719c26ca3a19.zip
Merge pull request #1421 from carsonmcdonald/fixfor1419
Remove pop that was done when not a return val
-rw-r--r--src/codegen.c1
-rw-r--r--test/t/syntax.rb9
2 files changed, 9 insertions, 1 deletions
diff --git a/src/codegen.c b/src/codegen.c
index 5681ce03a..34ccd616f 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -1551,7 +1551,6 @@ codegen(codegen_scope *s, node *tree, int val)
// variable rhs
codegen(s, t, VAL);
gen_vmassignment(s, tree->car, rhs, val);
- if (!val) pop();
}
}
break;
diff --git a/test/t/syntax.rb b/test/t/syntax.rb
index 332cfcca8..b975d0103 100644
--- a/test/t/syntax.rb
+++ b/test/t/syntax.rb
@@ -65,3 +65,12 @@ assert('Abbreviated variable assignment as returns') do
end
assert_equal Syntax4AbbrVarAsgnAsReturns::A.new.b, 1
end
+
+assert('Splat and mass assignment') do
+ *a = *[1,2,3]
+ b, *c = *[7,8,9]
+
+ assert_equal [1,2,3], a
+ assert_equal 7, b
+ assert_equal [8,9], c
+end