diff options
| author | Tyler Erickson <me@tylererickson.com> | 2020-03-05 16:52:34 -0800 |
|---|---|---|
| committer | Tyler Erickson <me@tylererickson.com> | 2020-03-05 16:52:34 -0800 |
| commit | 9d163fede885bc892f9423ce1084e6bac3c03165 (patch) | |
| tree | cb3e8c03ca7562522a359790aae3b702b5eccbba /src/check_type.cpp | |
| parent | bb026c99a93bc27ac89a8b1bf727b5b09799fe1c (diff) | |
| parent | c213d72ec6a64e973017bf326e0f241a3eef8adb (diff) | |
Merge branch 'master' of https://github.com/odin-lang/Odin into linux_stat_fix
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 6194951c9..010b31f03 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -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; |