summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-20 18:07:27 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-20 18:07:27 +0000
commit1e1898221068a8811fa68eda24f765a3171c70e9 (patch)
treedb445d4f8351bb6a9d833522b49e13f5f8d56313
parentb1612cedd915303734d8b2a4fd5a0f9ac91507ad (diff)
merge revision(s) 61603: [Backport #14279]
check array for zsuper. [Bug #14279] * compile.c (iseq_compile_each0): for zsuper (NODE_ZSUPER), we need to check given argument is Array or not. * test/ruby/test_super.rb: add a test for this bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--compile.c2
-rw-r--r--test/ruby/test_super.rb16
-rw-r--r--version.h2
3 files changed, 19 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index a9327f5217..9e9e177231 100644
--- a/compile.c
+++ b/compile.c
@@ -5360,7 +5360,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int poppe
if (liseq->body->param.flags.has_rest) {
/* rest argument */
int idx = liseq->body->local_table_size - liseq->body->param.rest_start;
+
ADD_GETLOCAL(args, line, idx, lvar_level);
+ ADD_INSN1(args, line, splatarray, Qfalse);
argc = liseq->body->param.rest_start + 1;
flag |= VM_CALL_ARGS_SPLAT;
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index 9691116fb4..cf7580ab00 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -544,4 +544,20 @@ class TestSuper < Test::Unit::TestCase
c.new
}
end
+
+ class TestFor_super_with_modified_rest_parameter_base
+ def foo *args
+ args
+ end
+ end
+
+ class TestFor_super_with_modified_rest_parameter < TestFor_super_with_modified_rest_parameter_base
+ def foo *args
+ args = 13
+ super
+ end
+ end
+ def test_super_with_modified_rest_parameter
+ assert_equal [13], TestFor_super_with_modified_rest_parameter.new.foo
+ end
end
diff --git a/version.h b/version.h
index 9888d024e8..780581c0c7 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.4.4"
#define RUBY_RELEASE_DATE "2018-03-21"
-#define RUBY_PATCHLEVEL 276
+#define RUBY_PATCHLEVEL 277
#define RUBY_RELEASE_YEAR 2018
#define RUBY_RELEASE_MONTH 3