mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a1afdedf94
commit
1069d3f18b
3 changed files with 4 additions and 4 deletions
|
@ -5497,7 +5497,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int poppe
|
|||
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_ANCHOR *const ret, NODE *node, int poppe
|
|||
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)) {
|
||||
|
|
|
@ -976,7 +976,7 @@ eom
|
|||
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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue