From 49dd10deebc88ab0e3e9d213a6f3ef0f8e66a6d2 Mon Sep 17 00:00:00 2001 From: FlorianKrull <floriankrull1507@yahoo.de> Date: Fri, 14 Jun 2019 08:59:26 +0200 Subject: [PATCH] Removed global level for printing --- include/mcc/symbol_table_print.h | 2 +- src/symbol_table_print.c | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/include/mcc/symbol_table_print.h b/include/mcc/symbol_table_print.h index 3c8a6a2..80bfd07 100644 --- a/include/mcc/symbol_table_print.h +++ b/include/mcc/symbol_table_print.h @@ -6,7 +6,7 @@ void mcc_symbol_table_print_error(struct mcc_symbol_table_error_collector *ec, FILE *out); -void mcc_symbol_table_print(struct mcc_symbol_table *sym, FILE *out,int level); +void mcc_symbol_table_print(struct mcc_symbol_table *sym, FILE *out); void mcc_symbol_table_print_type_check_trace(struct mcc_symbol_table_error_collector *ec, FILE *out); diff --git a/src/symbol_table_print.c b/src/symbol_table_print.c index f264e74..0230ed7 100644 --- a/src/symbol_table_print.c +++ b/src/symbol_table_print.c @@ -5,7 +5,6 @@ #include "mcc/symbol_table.h" #include "mcc/symbol_table_print.h" -int global_level; static char *type_to_string(enum mcc_ast_data_type type){ switch (type) @@ -30,7 +29,7 @@ static char *symbol_type_to_string(enum mcc_symbol_type type){ } } -void mcc_symbol_table_print(struct mcc_symbol_table *symbol_table, FILE *out, int level){ +void mcc_symbol_table_print(struct mcc_symbol_table *symbol_table, FILE *out){ printf("----------------------------------\n"); printf("Table: %s // Child of: %s\n", symbol_table ? symbol_table->sym_table_name : "no name", symbol_table->parent ? symbol_table->parent->sym_table_name : "no parent"); @@ -40,10 +39,7 @@ void mcc_symbol_table_print(struct mcc_symbol_table *symbol_table, FILE *out, in if(sym->symbol_type != MCC_SYMBOL_TYPE_FUNCTION){ fprintf(out,"\t"); - } - for(int j = 1;j < global_level;j++){ - fprintf(out,"\t"); - } + } fprintf(out,"%*s | ", 15, symbol_type_to_string(sym->symbol_type)); fprintf(out,"%*s | ", 6, type_to_string(sym->data_type)); -- GitLab