aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pc.y4
-rw-r--r--scope.c7
2 files changed, 8 insertions, 3 deletions
diff --git a/pc.y b/pc.y
index d63d8fc..54e4ede 100644
--- a/pc.y
+++ b/pc.y
@@ -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);
}
diff --git a/scope.c b/scope.c
index 6706765..eca78cd 100644
--- a/scope.c
+++ b/scope.c
@@ -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));
}
}
}