diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-09-30 18:40:56 -0400 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-09-30 18:40:56 -0400 |
commit | 46fa458c879ab784f6e320fdf793dd4294efcd56 (patch) | |
tree | a4018e3c235017725ca17ffed1b8f8d611f3036a | |
parent | 8e354d0b3d76eac27fe2c533db275e21f983b8dd (diff) |
Fix check_exists checks safe scopes not just current
-rw-r--r-- | pc.y | 6 | ||||
-rw-r--r-- | sem_check.c | 2 |
2 files changed, 5 insertions, 3 deletions
@@ -359,13 +359,15 @@ TD var :ID { - $$ = mkid(scope_safe_search(cur_scope,$1)); + node *tmp; + tmp = check_exists(cur_scope, $1); + $$ = mkid(tmp); free($1); } |ID '[' expr ']' { node* tmp; - tmp = scope_safe_search(cur_scope, $1); + tmp = check_exists(cur_scope, $1); $$ = mktree(ARRAY_ACCESS, mkid(tmp), $3); $$->attr.nval = $$->l->attr.nval; diff --git a/sem_check.c b/sem_check.c index 77803e1..fd85c98 100644 --- a/sem_check.c +++ b/sem_check.c @@ -27,7 +27,7 @@ char *n; node *tmp; char buf[100]; - if(!(tmp = scope_search(s,n))) { + if(!(tmp = scope_safe_search(s,n))) { snprintf(buf, 100, "Cannot find \"%s\"\n", n); yyerror(buf); } |