Fixing bugs, constraining syntax

This commit is contained in:
Krzosa Karol
2022-09-27 11:30:16 +02:00
parent b743ceb2f4
commit 60f794580c
10 changed files with 56 additions and 23 deletions

View File

@@ -379,6 +379,9 @@ parse_stmt_scope(Ast_Scope *scope_defined_outside = 0){
}
else{
Ast *result = parse_decl(false);
if(result && result->kind != AST_VAR && result->kind != AST_CONST){
compiler_error(token, "Invalid statement construct");
}
if(!result){
result = parse_expr();
result = parse_init_stmt((Ast_Expr *)result);
@@ -831,7 +834,6 @@ parse_decl(B32 is_global){
result->kind = AST_LAMBDA;
}
}
}
}
else if(token_match(TK_Identifier, TK_Colon)){