diff options
-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); } |