diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-10 04:53:58 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-10 04:53:58 +0000 |
commit | 1069d3f18bb3017ba770cc5ac68e4513439e357c (patch) | |
tree | 12a905c7e67190d5531a702619ad82961f2ccfe9 /compile.c | |
parent | a1afdedf94350c89007df2f65d79be6fc7b835e3 (diff) |
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
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 4 |
1 files changed, 2 insertions, 2 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)) { |