diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-02-14 17:34:02 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-02-14 17:34:02 +0000 |
| commit | 3ecf3505fd62c6aa10190a0be97e8572476e8c8b (patch) | |
| tree | 1b6952bfffbec99d7efa7dcb31d7ad81523d74ac /src/check_expr.c | |
| parent | daa1cd55a1ba79a7f5e59a1615d7cb750547a006 (diff) | |
Ignore previous silly commit :P I shouldn't have move it
Diffstat (limited to 'src/check_expr.c')
| -rw-r--r-- | src/check_expr.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/check_expr.c b/src/check_expr.c index 25f7dd942..4461a4def 100644 --- a/src/check_expr.c +++ b/src/check_expr.c @@ -2082,15 +2082,6 @@ bool check_is_castable_to(Checker *c, Operand *operand, Type *y) { return true; } - { - gbString expr_str = expr_to_string(operand->expr); - gbString to_type = type_to_string(y); - gbString from_type = type_to_string(x); - error_node(operand->expr, "Cannot cast `%s` as `%s` from `%s`", expr_str, to_type, from_type); - gb_string_free(from_type); - gb_string_free(to_type); - gb_string_free(expr_str); - } return false; } @@ -2115,7 +2106,13 @@ void check_cast(Checker *c, Operand *x, Type *type) { } if (!can_convert) { - // NOTE(bill): Error handled in `cast_is_castable_to` + gbString expr_str = expr_to_string(x->expr); + gbString to_type = type_to_string(type); + gbString from_type = type_to_string(x->type); + error_node(x->expr, "Cannot cast `%s` as `%s` from `%s`", expr_str, to_type, from_type); + gb_string_free(from_type); + gb_string_free(to_type); + gb_string_free(expr_str); x->mode = Addressing_Invalid; return; } |