aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.c
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-05-28 21:56:40 +0100
committerGinger Bill <bill@gingerbill.org>2017-05-28 21:56:40 +0100
commit60d7c833c015706e6276acca558c3a04502d401e (patch)
treef912d139529a11ea62be79908f575030477fb395 /src/check_expr.c
parent98dbbf11f3e19fefc08a34ba0f9a5a96e083ea78 (diff)
Fix unary expression type check
Diffstat (limited to 'src/check_expr.c')
-rw-r--r--src/check_expr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/check_expr.c b/src/check_expr.c
index ec13d26b0..b5e683038 100644
--- a/src/check_expr.c
+++ b/src/check_expr.c
@@ -1225,6 +1225,7 @@ bool abi_compat_return_by_value(gbAllocator a, ProcCallingConvention cc, Type *a
return false;
}
+
if (str_eq(build_context.ODIN_OS, str_lit("windows"))) {
i64 size = 8*type_size_of(a, abi_return_type);
switch (size) {
@@ -1859,6 +1860,12 @@ Type *check_type_extra(Checker *c, AstNode *e, Type *named_type) {
bool check_unary_op(Checker *c, Operand *o, Token op) {
+ if (o->type == NULL) {
+ gbString str = expr_to_string(o->expr);
+ error_node(o->expr, "Expression has no value `%s`", str);
+ gb_string_free(str);
+ return false;
+ }
// TODO(bill): Handle errors correctly
Type *type = base_type(base_vector_type(o->type));
gbString str = NULL;