summaryrefslogtreecommitdiff
path: root/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'symbol.c')
-rw-r--r--symbol.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/symbol.c b/symbol.c
index 2edb572..ed6006d 100644
--- a/symbol.c
+++ b/symbol.c
@@ -38,6 +38,10 @@ getsym(Rune *name, int fresh)
done = 1;
}while(!done && !fresh);
+ /* make sure to allocate in the most local scope if the symbol is not found */
+ if(currentdfn)
+ tab = currentdfn->symtab;
+
tab->nsyms++;
tab->syms = realloc(tab->syms, sizeof(Symbol *) * tab->nsyms);
tab->syms[tab->nsyms-1] = emalloc(sizeof(Symbol));