Core: Add goto

This commit is contained in:
Krzosa Karol
2023-04-22 13:14:08 +02:00
parent eff6b10cf4
commit 654d6f17e4
10 changed files with 42 additions and 9 deletions

View File

@@ -177,6 +177,13 @@ ast_return(Token *pos, Ast_Expr *expr) {
return result;
}
CORE_Static Ast_Goto *
ast_goto(Token *pos, Intern_String label) {
Ast_Goto *result = ast_new(Ast_Goto, AST_GOTO, pos, AST_STMT);
result->label = label;
return result;
}
CORE_Static Ast_Label *
ast_label(Token *pos, Intern_String name, Ast_Scope *scope, bool enable_goto) {
Ast_Label *result = ast_new(Ast_Label, AST_LABEL, pos, AST_STMT | AST_DECL);
@@ -572,10 +579,11 @@ void next(Ast_Iter *iter) {
case AST_BREAK:
case AST_PASS:
case AST_CONTINUE:
case AST_GOTO:
case AST_COMPILER_BREAKPOINT_STMT: {
Ast *node = (Ast *)ast;
} break;
case AST_LABEL:
case AST_NAMESPACE:
case AST_STRUCT:
case AST_UNION: