From e2ae8005bb5b51ce2dc5667aeffd79a3a047c00b Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Fri, 31 Mar 2023 22:45:51 +0200 Subject: [PATCH] Printing di's proprly --- core_printer.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/core_printer.cpp b/core_printer.cpp index b22c665..91f6694 100644 --- a/core_printer.cpp +++ b/core_printer.cpp @@ -88,6 +88,7 @@ core_type_to_string(Ast_Type *type) { void core__stringify(Ast *ast) { if (!ast) return; + gen("@%u", ast->di); switch (ast->kind) { case AST_SCOPE: { Ast_Scope *n = (Ast_Scope *)ast; @@ -110,12 +111,12 @@ void core__stringify(Ast *ast) { case AST_IDENT: { Ast_Atom *n = (Ast_Atom *)ast; - gen("%Q@%u", n->intern_val, n->di); + gen("%Q", n->intern_val); } break; case AST_VALUE: { Ast_Atom *n = (Ast_Atom *)ast; //@todo: proper value - gen("%Q@%u", n->pos->string, n->di); + gen("%Q", n->pos->string); } break; case AST_INDEX: { @@ -123,13 +124,13 @@ void core__stringify(Ast *ast) { core__stringify(n->expr); gen("["); core__stringify(n->index); - gen("]@%u", n->di); + gen("]"); } break; case AST_UNARY: { Ast_Unary *n = (Ast_Unary *)ast; + gen("%Q", n->pos->string); core__stringify(n->expr); - gen("%Q@%u", n->pos->string, n->di); } break; case AST_BINARY: { @@ -137,7 +138,6 @@ void core__stringify(Ast *ast) { core__stringify(n->left); gen("%Q", n->pos->string); core__stringify(n->right); - gen("@%u", n->di); } break; case AST_CALL_ITEM: { @@ -151,7 +151,7 @@ void core__stringify(Ast *ast) { gen(" = "); } core__stringify(n->item); - gen("@%u", n->di); + } break; case AST_CALL: { @@ -163,7 +163,6 @@ void core__stringify(Ast *ast) { if (!n->exprs.is_last(&it)) gen(","); } gen(")"); - gen("@%u", n->di); } break; case AST_COMPOUND: { Ast_Call *n = (Ast_Call *)ast; @@ -178,7 +177,6 @@ void core__stringify(Ast *ast) { } global_indent -= 1; genln("}"); - gen("@%u", n->di); } break; case AST_TYPE_OF: @@ -205,7 +203,6 @@ void core__stringify(Ast *ast) { gen("("); core__stringify(n->expr); gen(")"); - gen("@%u", n->di); } break; case AST_SWITCH: { @@ -216,7 +213,6 @@ void core__stringify(Ast *ast) { core__stringify(it); } core__stringify(n->default_scope); - gen("@%u", n->di); } break; case AST_SWITCH_CASE: { @@ -226,7 +222,6 @@ void core__stringify(Ast *ast) { core__stringify(it); } core__stringify(n->scope); - gen("@%u", n->di); } break; case AST_VAR_UNPACK: { @@ -241,12 +236,10 @@ void core__stringify(Ast *ast) { case AST_PASS: { genln("pass"); - gen("@%u", ast->di); } break; case AST_BREAK: { genln("break"); - gen("@%u", ast->di); } break; case AST_NAMESPACE: {