mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix unexpected behavior with break
```
def yie
yield
end
def bre
yie {
1+1
break
}
end
p bre #=> display 2, but should be nil
```
This commit is contained in:
@@ -2852,6 +2852,9 @@ loop_break(codegen_scope *s, node *tree)
|
||||
loop->pc3 = tmp;
|
||||
}
|
||||
else {
|
||||
if (!tree) {
|
||||
genop(s, MKOP_A(OP_LOADNIL, cursp()));
|
||||
}
|
||||
genop(s, MKOP_AB(OP_RETURN, cursp(), OP_R_BREAK));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user