mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
unless without else should return nil if the condition is true.
This commit is contained in:
+5
-1
@@ -1099,8 +1099,12 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
genop(s, MKOP_AsBx(OP_JMPNOT, cursp(), 0));
|
||||
|
||||
codegen(s, tree->cdr->car, val);
|
||||
if (val && !(tree->cdr->car)) {
|
||||
genop(s, MKOP_A(OP_LOADNIL, cursp()));
|
||||
push();
|
||||
}
|
||||
if (e) {
|
||||
if (val && tree->cdr->car) pop();
|
||||
if (val) pop();
|
||||
pos2 = new_label(s);
|
||||
genop(s, MKOP_sBx(OP_JMP, 0));
|
||||
dispatch(s, pos1);
|
||||
|
||||
Reference in New Issue
Block a user