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
-1
View File
@@ -343,7 +343,6 @@ AST_KIND(_ExprBegin, "", bool) \
i32 builtin_id; \
}) \
AST_KIND(FieldValue, "field value", struct { Token eq; Ast *field, *value; }) \
AST_KIND(TernaryExpr, "ternary expression", struct { Ast *cond, *x, *y; }) \
AST_KIND(TernaryIfExpr, "ternary if expression", struct { Ast *x, *cond, *y; }) \
AST_KIND(TernaryWhenExpr, "ternary when expression", struct { Ast *x, *cond, *y; }) \
AST_KIND(TypeAssertion, "type assertion", struct { Ast *expr; Token dot; Ast *type; Type *type_hint; }) \