mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix a bug that no expression case doesn't return valid value
Here is a script that reproduces this problem:
x = case
when true; 1
end
p x # => main # 1 is expected
This commit is contained in:
+1
-1
@@ -1458,7 +1458,7 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
int pos = cursp();
|
||||
genop(s, MKOP_A(OP_LOADNIL, cursp()));
|
||||
if (pos3) dispatch_linked(s, pos3);
|
||||
pop();
|
||||
if (head) pop();
|
||||
genop(s, MKOP_AB(OP_MOVE, cursp(), pos));
|
||||
push();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user