diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-08-04 11:51:56 -0400 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-08-04 11:51:56 -0400 |
commit | 081f3735abf4add6dbbd6ba4ca56da10bd54139e (patch) | |
tree | a85fdf47600b40f28ac706c610f58dcbc53cd722 | |
parent | 9c6c1af62993bdb2474ddde4384215f95fede85f (diff) |
Fix adding variable to scope during assignment
-rw-r--r-- | pc.y | 4 | ||||
-rw-r--r-- | scope.c | 7 |
2 files changed, 8 insertions, 3 deletions
@@ -260,12 +260,12 @@ TD: TO | DT; var :ID { - $$ = mkid(scope_insert(cur_scope,$1)); + $$ = mkid(scope_safe_search_all(cur_scope,$1)); } |ID '[' expr ']' { node* tmp; - tmp = scope_insert(cur_scope, $1); + tmp = scope_safe_search_all(cur_scope, $1); $$ = mktree(ARRAY_ACCESS, mkid(tmp), $3); } @@ -138,9 +138,14 @@ scope *s; { int i; node * tmp; + + fprintf(stderr, "\n\nSCOPE\n" + "==========================================================\n"); + for (i = 0; i < HASH_SIZE; i++) { for( tmp=s->table[i]; tmp; tmp = tmp->next) { - fprintf(stderr, "\t%s\n", tmp->name); + fprintf(stderr, "\t%s:%s\n", tmp->name, + pretty_type(tmp->var_type)); } } } |