aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--dissect.c4
-rw-r--r--dissect.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/dissect.c b/dissect.c
index 40baf64f..c48214b9 100644
--- a/dissect.c
+++ b/dissect.c
@@ -152,7 +152,6 @@ static inline struct symbol *expr_symbol(struct expression *expr)
if (!sym) {
sym = alloc_symbol(expr->pos, SYM_BAD);
bind_symbol(sym, expr->symbol_name, NS_SYMBOL);
- sym->ctype.modifiers = MOD_EXTERN | MOD_TOPLEVEL;
sym->kind = expr->op ?: 'v'; /* see EXPR_CALL */
}
}
@@ -238,7 +237,8 @@ static void examine_sym_node(struct symbol *node, struct symbol *parent)
return;
dctx = dissect_ctx;
- dissect_ctx = NULL;
+ if (toplevel(base->scope))
+ dissect_ctx = NULL;
if (base->ident || deanon(base, name, parent))
reporter->r_symdef(base);
diff --git a/dissect.h b/dissect.h
index 326d3dc3..a77a9328 100644
--- a/dissect.h
+++ b/dissect.h
@@ -4,6 +4,7 @@
#include <stdio.h>
#include "parse.h"
#include "expression.h"
+#include "scope.h"
#define U_SHIFT 8
@@ -29,7 +30,7 @@ extern struct symbol *dissect_ctx;
static inline bool sym_is_local(struct symbol *sym)
{
- return sym->kind == 'v' && !(sym->ctype.modifiers & MOD_TOPLEVEL);
+ return !toplevel(sym->scope);
}
extern void dissect(struct reporter *, struct string_list *);