mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-13 09:22:22 -07:00
x if cond else y and x when cond else y expressions
This commit is contained in:
@@ -3454,6 +3454,26 @@ bool check_type_internal(CheckerContext *ctx, Ast *e, Type **type, Type *named_t
|
||||
return true;
|
||||
}
|
||||
case_end;
|
||||
|
||||
case_ast_node(te, TernaryIfExpr, 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, TernaryWhenExpr, 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;
|
||||
}
|
||||
|
||||
*type = t_invalid;
|
||||
|
||||
Reference in New Issue
Block a user