summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-12-03 12:53:21 +0900
committerGitHub <[email protected]>2016-12-03 12:53:21 +0900
commit23c4ad08654c7a277edd1b56716012f361f044fa (patch)
tree9d77f1607ee2d7bac001ce36d7c17ec945aa8122
parent79a621dd739faf4cc0958e11d6a887331cf79e48 (diff)
parentfe362c1f2649c9c502d9a5998ef8c4c94893f3ea (diff)
downloadmruby-23c4ad08654c7a277edd1b56716012f361f044fa.tar.gz
mruby-23c4ad08654c7a277edd1b56716012f361f044fa.zip
Merge pull request #3319 from bouk/apost-splatt
Fix segfault when using result of rest assignment
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c4
-rw-r--r--test/t/codegen.rb9
2 files changed, 12 insertions, 1 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index 553baa116..2c75c8aed 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -1061,7 +1061,9 @@ gen_vmassignment(codegen_scope *s, node *tree, int rhs, int val)
n++;
}
}
- push();
+ if (!val) {
+ push();
+ }
}
}
diff --git a/test/t/codegen.rb b/test/t/codegen.rb
index 1ac689a82..bb0f5c306 100644
--- a/test/t/codegen.rb
+++ b/test/t/codegen.rb
@@ -54,3 +54,12 @@ A
B
assert_equal "\n", a
end
+
+assert('splat in case splat') do
+ a = *case
+ when 0
+ * = 1
+ end
+
+ assert_equal [1], a
+end