diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 05:46:13 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 05:46:13 +0000 |
commit | 0b46bbf76dfbd018a1d6272ca4017cd4f69ec646 (patch) | |
tree | a2dc7823d3fc61a64890a3fcc5eb0eda31003371 | |
parent | 08987d3105c72cf2583c5df27bfc40d1724137ec (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_3@62944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | compile.c | 3 | ||||
-rw-r--r-- | test/ruby/test_super.rb | 16 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 29 insertions, 1 deletions
@@ -1,3 +1,12 @@ +Mon Mar 28 14:45:02 2018 Koichi Sasada <ko1@atdot.net> + + 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. + Sun Mar 28 14:40:25 2018 Eric Wong <normalperson@yhbt.net> net/ftp: fix FrozenError in BufferedSocket @@ -5074,7 +5074,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) if (liseq->body->param.flags.has_rest) { /* rest argument */ int idx = liseq->body->local_size - liseq->body->param.rest_start; + ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(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 2764cf534b..16a161df43 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 @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.3.7" #define RUBY_RELEASE_DATE "2018-03-28" -#define RUBY_PATCHLEVEL 440 +#define RUBY_PATCHLEVEL 441 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 3 |