[前][次][番号順一覧][スレッド一覧]

ruby-changes:50761

From: usa <ko1@a...>
Date: Wed, 28 Mar 2018 14:46:18 +0900 (JST)
Subject: [ruby-changes:50761] usa:r62944 (ruby_2_3): merge revision(s) 61603: [Backport #14279]

usa	2018-03-28 14:46:13 +0900 (Wed, 28 Mar 2018)

  New Revision: 62944

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62944

  Log:
    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.

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/compile.c
    branches/ruby_2_3/test/ruby/test_super.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/compile.c
===================================================================
--- ruby_2_3/compile.c	(revision 62943)
+++ ruby_2_3/compile.c	(revision 62944)
@@ -5074,7 +5074,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/compile.c#L5074
 	    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;
 	    }
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 62943)
+++ ruby_2_3/version.h	(revision 62944)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #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
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 62943)
+++ ruby_2_3/ChangeLog	(revision 62944)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Mon Mar 28 14:45:02 2018  Koichi Sasada  <ko1@a...>
+
+	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@y...>
 
 	net/ftp: fix FrozenError in BufferedSocket
Index: ruby_2_3/test/ruby/test_super.rb
===================================================================
--- ruby_2_3/test/ruby/test_super.rb	(revision 62943)
+++ ruby_2_3/test/ruby/test_super.rb	(revision 62944)
@@ -544,4 +544,20 @@ class TestSuper < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_super.rb#L544
       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
Index: ruby_2_3
===================================================================
--- ruby_2_3	(revision 62943)
+++ ruby_2_3	(revision 62944)

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r61603

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]