mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
@@ -1721,7 +1721,7 @@ RETRY_TRY_BLOCK:
|
||||
if (irep->clen > 0 &&
|
||||
(ch = catch_handler_find(irep, ci->pc, MRB_CATCH_FILTER_ENSURE))) {
|
||||
/* avoiding a jump from a catch handler into the same handler */
|
||||
if (a < mrb_irep_catch_handler_unpack(ch->begin) || a >= mrb_irep_catch_handler_unpack(ch->end)) {
|
||||
if (a < mrb_irep_catch_handler_unpack(ch->begin) || a > mrb_irep_catch_handler_unpack(ch->end)) {
|
||||
THROW_TAGGED_BREAK(mrb, RBREAK_TAG_JUMP, mrb->c->ci, mrb_fixnum_value(a));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +71,63 @@ assert('break', '11.5.2.4.3') do
|
||||
end
|
||||
end
|
||||
assert_equal [1,2,3,4], a
|
||||
|
||||
a = []
|
||||
begin
|
||||
while true
|
||||
a.push 1
|
||||
break
|
||||
a.push "NG"
|
||||
end
|
||||
ensure
|
||||
a.push 2
|
||||
end
|
||||
assert_equal [1, 2], a
|
||||
|
||||
a = []
|
||||
begin
|
||||
while true
|
||||
a.push 1
|
||||
break
|
||||
end
|
||||
a.push 2
|
||||
ensure
|
||||
a.push 3
|
||||
end
|
||||
assert_equal [1, 2, 3], a
|
||||
|
||||
a = []
|
||||
begin
|
||||
while true
|
||||
begin
|
||||
a.push 1
|
||||
break
|
||||
ensure
|
||||
a.push 2
|
||||
end
|
||||
a.push "NG"
|
||||
end
|
||||
ensure
|
||||
a.push 3
|
||||
end
|
||||
assert_equal [1, 2, 3], a
|
||||
|
||||
a = []
|
||||
begin
|
||||
while true
|
||||
begin
|
||||
a.push 1
|
||||
break
|
||||
ensure
|
||||
a.push 2
|
||||
end
|
||||
a.push "NG"
|
||||
end
|
||||
a.push 3
|
||||
ensure
|
||||
a.push 4
|
||||
end
|
||||
assert_equal [1, 2, 3, 4], a
|
||||
end
|
||||
|
||||
assert('redo', '11.5.2.4.5') do
|
||||
|
||||
Reference in New Issue
Block a user