aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pc.y6
-rw-r--r--sem_check.c2
2 files changed, 5 insertions, 3 deletions
diff --git a/pc.y b/pc.y
index 07f753f..da58fb5 100644
--- a/pc.y
+++ b/pc.y
@@ -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);
}