For loop iterate through arrays and slices

This commit is contained in:
Krzosa Karol
2022-06-19 22:31:59 +02:00
parent 367562f0a8
commit aa5741203f
6 changed files with 67 additions and 14 deletions

View File

@@ -234,7 +234,7 @@ parse_stmt_scope(Ast_Scope *scope_defined_outside = 0){
}
else if(token_match_keyword(keyword_switch)){
Ast_Switch *result = MAKE_AST(Ast_Switch, AST_SWITCH, token, AST_STMT);
Ast_Switch *result = new_ast(Ast_Switch, AST_SWITCH, token, AST_STMT);
result->value = parse_expr();
result->cases = {scratch};
@@ -245,7 +245,7 @@ parse_stmt_scope(Ast_Scope *scope_defined_outside = 0){
continue;
}
Ast_Switch_Case *switch_case = MAKE_AST(Ast_Switch_Case, AST_SWITCH_CASE, token_get(), AST_STMT);
Ast_Switch_Case *switch_case = new_ast(Ast_Switch_Case, AST_SWITCH_CASE, token_get(), AST_STMT);
if(token_match_pound(pctx->intern("fallthrough"_s)))
switch_case->fallthrough = true;