diff options
Diffstat (limited to 'src/parser.c')
| -rw-r--r-- | src/parser.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/parser.c b/src/parser.c index 479767d..435191d 100644 --- a/src/parser.c +++ b/src/parser.c @@ -258,6 +258,9 @@ Node *parse_var_declaration(Lexer *lexer) if (token.type == TOKEN_ASSIGN) { if (is_global) die_location(token.loc, "Cannot initialize global variable `%s` outside function", node->var_decl.var.name); + if (node->var_decl.var.type->type == TYPE_ARRAY) + die_location(token.loc, "Cannot initialize array variable `%s` here.", node->var_decl.var.name); + node->var_decl.value = parse_expression(lexer); if (!type_equals(node->var_decl.var.type, node->var_decl.value->expr_type)) { |