ruby-changes:49322
From: nagachika <ko1@a...>
Date: Sun, 24 Dec 2017 11:45:11 +0900 (JST)
Subject: [ruby-changes:49322] nagachika:r61439 (ruby_2_4): merge revision(s) 60099, 60100: [Backport #13964]
nagachika 2017-12-24 11:45:07 +0900 (Sun, 24 Dec 2017) New Revision: 61439 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61439 Log: merge revision(s) 60099,60100: [Backport #13964] compile.c: fix stack consitency error * compile.c (iseq_compile_each0): fix stack consitency error on attr-assign with safe navigation operator when the receiver is nil, should pop it too. [ruby-core:83078] [Bug #13964] test_call.rb: refine test_safe_call * test/ruby/test_call.rb (test_safe_call): rhs should not be evaluated when the receiver is nil. simplified the assertion for [Bug #13964]. Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/compile.c branches/ruby_2_4/test/ruby/test_call.rb branches/ruby_2_4/version.h Index: ruby_2_4/compile.c =================================================================== --- ruby_2_4/compile.c (revision 61438) +++ ruby_2_4/compile.c (revision 61439) @@ -5037,8 +5037,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/compile.c#L5037 ADD_INSN1(ret, line, topn, INT2FIX(1)); } ADD_SEND_WITH_FLAG(ret, line, aid, INT2FIX(1), INT2FIX(asgnflag)); + if (lskip && popped) { + ADD_LABEL(ret, lskip); + } ADD_INSN(ret, line, pop); - if (lskip) { + if (lskip && !popped) { ADD_LABEL(ret, lskip); } } Index: ruby_2_4/test/ruby/test_call.rb =================================================================== --- ruby_2_4/test/ruby/test_call.rb (revision 61438) +++ ruby_2_4/test/ruby/test_call.rb (revision 61439) @@ -50,8 +50,9 @@ class TestCall < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_call.rb#L50 o = nil assert_nil(o&.x) - assert_nothing_raised(NoMethodError) {o&.x = 6} - assert_nothing_raised(NoMethodError) {o&.x *= 7} + assert_nothing_raised(NoMethodError) {o&.x = raise} + assert_nothing_raised(NoMethodError) {o&.x *= raise} + assert_nothing_raised(NoMethodError) {o&.x *= raise; nil} end def test_safe_call_evaluate_arguments_only_method_call_is_made Index: ruby_2_4/version.h =================================================================== --- ruby_2_4/version.h (revision 61438) +++ ruby_2_4/version.h (revision 61439) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1 #define RUBY_VERSION "2.4.4" #define RUBY_RELEASE_DATE "2017-12-24" -#define RUBY_PATCHLEVEL 221 +#define RUBY_PATCHLEVEL 222 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 12 Index: ruby_2_4 =================================================================== --- ruby_2_4 (revision 61438) +++ ruby_2_4 (revision 61439) Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r60099-60100 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/