aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-03-05 21:12:16 +0000
committergingerBill <bill@gingerbill.org>2020-03-05 21:12:16 +0000
commitdb7a3ffd2a66d976c985ebfc2c5a96b21c9684e3 (patch)
treef5fd15ae28e664dd37f69018e5a6ce1f35e0beab /src/check_type.cpp
parent7d93dd60240a58834c950f341ec9761050784b3b (diff)
parentc213d72ec6a64e973017bf326e0f241a3eef8adb (diff)
Merge branch 'master' into llvm-integration
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp20
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;