Allow nil in a ternary statement

This commit is contained in:
gingerBill
2017-11-09 21:10:08 +00:00
parent 36b0b50ba4
commit dbb070524f
2 changed files with 47 additions and 31 deletions
+5 -5
View File
@@ -997,20 +997,20 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
goto skip_expr;
}
convert_to_typed(c, &x, y.type, 0);
convert_to_typed(c, &x, y.type);
if (x.mode == Addressing_Invalid) {
goto skip_expr;
}
convert_to_typed(c, &y, x.type, 0);
convert_to_typed(c, &y, x.type);
if (y.mode == Addressing_Invalid) {
goto skip_expr;
}
convert_to_typed(c, &x, default_type(y.type), 0);
convert_to_typed(c, &x, default_type(y.type));
if (x.mode == Addressing_Invalid) {
goto skip_expr;
}
convert_to_typed(c, &y, default_type(x.type), 0);
convert_to_typed(c, &y, default_type(x.type));
if (y.mode == Addressing_Invalid) {
goto skip_expr;
}
@@ -1321,7 +1321,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
continue;
}
convert_to_typed(c, &y, x.type, 0);
convert_to_typed(c, &y, x.type);
if (y.mode == Addressing_Invalid) {
continue;
}