Unify AstTernaryExpr with AstTernaryIfExpr

Allow for both syntaxes `x if cond else y` and `cond ? x : y`
Removes the confusing semantics behind `?:` which could be `if` or `when` depending on the context.
This commit is contained in:
gingerBill
2021-05-05 15:22:54 +01:00
parent abdf54800e
commit 278de3a92f
6 changed files with 17 additions and 172 deletions
-10
View File
@@ -2889,16 +2889,6 @@ bool check_type_internal(CheckerContext *ctx, Ast *e, Type **type, Type *named_t
}
case_end;
case_ast_node(te, TernaryExpr, e);
Operand o = {};
check_expr_or_type(ctx, &o, e);
if (o.mode == Addressing_Type) {
*type = o.type;
set_base_type(named_type, *type);
return true;
}
case_end;
case_ast_node(te, TernaryIfExpr, e);
Operand o = {};
check_expr_or_type(ctx, &o, e);