mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix a bug that if and no return value case can't return true clause value
Here is a script that reproduce this problem:
x = if true
1
else
case 2
when 3
end
4
end
p x # => nil # 1 is expected
This commit is contained in:
+7
-2
@@ -1462,8 +1462,13 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
genop(s, MKOP_AB(OP_MOVE, cursp(), pos));
|
||||
push();
|
||||
}
|
||||
else if (pos3) {
|
||||
dispatch_linked(s, pos3);
|
||||
else {
|
||||
if (pos3) {
|
||||
dispatch_linked(s, pos3);
|
||||
}
|
||||
if (head) {
|
||||
pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user