ruby-changes:47696
From: nagachika <ko1@a...>
Date: Sun, 10 Sep 2017 13:54:04 +0900 (JST)
Subject: [ruby-changes:47696] nagachika:r59812 (ruby_2_4): merge revision(s) 59708: [Backport #13844]
nagachika 2017-09-10 13:53:58 +0900 (Sun, 10 Sep 2017) New Revision: 59812 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59812 Log: merge revision(s) 59708: [Backport #13844] compile.c: ensure after toplevel return * compile.c (iseq_compile_each0): toplevel returns should fire ensures. [ruby-core:82492] [Bug #13844] Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/compile.c branches/ruby_2_4/test/ruby/test_syntax.rb branches/ruby_2_4/version.h Index: ruby_2_4/compile.c =================================================================== --- ruby_2_4/compile.c (revision 59811) +++ ruby_2_4/compile.c (revision 59812) @@ -5497,7 +5497,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/compile.c#L5497 const rb_iseq_t *parent_iseq = is->body->parent_iseq; enum iseq_type parent_type; - if (type == ISEQ_TYPE_TOP || type == ISEQ_TYPE_MAIN) { + if (type == ISEQ_TYPE_TOP) { LABEL *splabel = NEW_LABEL(line); ADD_LABEL(ret, splabel); ADD_ADJUST(ret, line, 0); @@ -5505,7 +5505,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/compile.c#L5505 ADD_INSN(ret, line, leave); ADD_ADJUST_RESTORE(ret, splabel); } - else if ((type == ISEQ_TYPE_RESCUE || type == ISEQ_TYPE_ENSURE) && + else if ((type == ISEQ_TYPE_RESCUE || type == ISEQ_TYPE_ENSURE || type == ISEQ_TYPE_MAIN) && parent_iseq && ((parent_type = parent_iseq->body->type) == ISEQ_TYPE_TOP || parent_type == ISEQ_TYPE_MAIN)) { Index: ruby_2_4/version.h =================================================================== --- ruby_2_4/version.h (revision 59811) +++ ruby_2_4/version.h (revision 59812) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1 #define RUBY_VERSION "2.4.2" #define RUBY_RELEASE_DATE "2017-09-10" -#define RUBY_PATCHLEVEL 188 +#define RUBY_PATCHLEVEL 189 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 9 Index: ruby_2_4/test/ruby/test_syntax.rb =================================================================== --- ruby_2_4/test/ruby/test_syntax.rb (revision 59811) +++ ruby_2_4/test/ruby/test_syntax.rb (revision 59812) @@ -976,7 +976,7 @@ eom https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_syntax.rb#L976 begin; return; raise begin return; rescue SystemExit; exit false; end - begin return; ensure exit false; end + begin return; ensure puts "ensured"; end #=> ensured begin ensure return; end begin raise; ensure; return; end begin raise; rescue; return; end Index: ruby_2_4 =================================================================== --- ruby_2_4 (revision 59811) +++ ruby_2_4 (revision 59812) Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r59708 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/