diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-11-30 20:07:23 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-11-30 20:07:23 +0000 |
| commit | ab2ca7cf5975b78c254b87fa5590be147853b79a (patch) | |
| tree | b301bcfe2dcdc5d03856970a598b789f5945fc4e /src/checker/expr.c | |
| parent | b76c8abe7379f1d1a88fddf9387fe6338ad920e3 (diff) | |
Fix illegal type declaration error
Diffstat (limited to 'src/checker/expr.c')
| -rw-r--r-- | src/checker/expr.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/checker/expr.c b/src/checker/expr.c index a673150ae..f8f39c1b0 100644 --- a/src/checker/expr.c +++ b/src/checker/expr.c @@ -1329,14 +1329,19 @@ end: if (is_type_named(type)) { if (type->Named.base == NULL) { + error_node(e, "Invalid type definition"); type->Named.base = t_invalid; } } + if (is_type_typed(type)) { + add_type_and_value(&c->info, e, Addressing_Type, type, null_value); + } else { + error_node(e, "Invalid type definition"); + type = t_invalid; + } set_base_type(named_type, type); - GB_ASSERT(is_type_typed(type)); - add_type_and_value(&c->info, e, Addressing_Type, type, null_value); return type; @@ -3755,7 +3760,8 @@ ExprKind check_call_expr(Checker *c, Operand *operand, AstNode *call) { } Type *proc_type = base_type(operand->type); - if (proc_type == NULL || proc_type->kind != Type_Proc) { + if (proc_type == NULL || proc_type->kind != Type_Proc || + !(operand->mode == Addressing_Value || operand->mode == Addressing_Variable)) { AstNode *e = operand->expr; gbString str = expr_to_string(e); error_node(e, "Cannot call a non-procedure: `%s`", str); |