Unverified Commit b1fa180e authored by ksss's avatar ksss

Fix unexpected behavior with break

```
def yie
  yield
end

def bre
  yie {
    1+1
    break
  }
end

p bre #=> display 2, but should be nil
```
parent 7a382e8b
...@@ -2852,6 +2852,9 @@ loop_break(codegen_scope *s, node *tree) ...@@ -2852,6 +2852,9 @@ loop_break(codegen_scope *s, node *tree)
loop->pc3 = tmp; loop->pc3 = tmp;
} }
else { else {
if (!tree) {
genop(s, MKOP_A(OP_LOADNIL, cursp()));
}
genop(s, MKOP_AB(OP_RETURN, cursp(), OP_R_BREAK)); genop(s, MKOP_AB(OP_RETURN, cursp(), OP_R_BREAK));
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment