From a99cc2fd70d31b3a0b5a6881d4b5cb431f911354 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 17 Jun 2018 21:50:40 +0100 Subject: Clean up import lookup code --- src/checker.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/checker.cpp') diff --git a/src/checker.cpp b/src/checker.cpp index f6700eb0c..dff78f182 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -33,7 +33,6 @@ void scope_reset(Scope *scope) { scope->first_child = nullptr; scope->last_child = nullptr; map_clear (&scope->elements); - ptr_set_clear(&scope->implicit); ptr_set_clear(&scope->imported); } @@ -222,7 +221,6 @@ Scope *create_scope(Scope *parent, gbAllocator allocator, isize init_elements_ca Scope *s = gb_alloc_item(allocator, Scope); s->parent = parent; map_init(&s->elements, heap_allocator(), init_elements_capacity); - ptr_set_init(&s->implicit, heap_allocator(), 0); ptr_set_init(&s->imported, heap_allocator(), 0); s->delayed_imports.allocator = heap_allocator(); @@ -301,7 +299,6 @@ void destroy_scope(Scope *scope) { map_destroy(&scope->elements); array_free(&scope->delayed_imports); array_free(&scope->delayed_directives); - ptr_set_destroy(&scope->implicit); ptr_set_destroy(&scope->imported); // NOTE(bill): No need to free scope as it "should" be allocated in an arena (except for the global scope) @@ -707,10 +704,6 @@ Entity *implicit_entity_of_node(Ast *clause) { } return nullptr; } -bool is_entity_implicitly_imported(Entity *import_name, Entity *e) { - GB_ASSERT(import_name->kind == Entity_ImportName); - return ptr_set_exists(&import_name->ImportName.scope->implicit, e); -} // Will return nullptr if not found Entity *entity_of_node(CheckerInfo *i, Ast *expr) { @@ -2600,11 +2593,9 @@ void check_add_import_decl(CheckerContext *ctx, Ast *decl) { Entity *e = scope->elements.entries[elem_index].value; if (e->scope == parent_scope) continue; - bool implicit_is_found = ptr_set_exists(&scope->implicit, e); - if (is_entity_exported(e) && !implicit_is_found) { + if (is_entity_exported(e)) { Entity *prev = scope_lookup(parent_scope, e->token.string); - bool ok = add_entity(ctx->checker, parent_scope, e->identifier, e); - if (ok) ptr_set_add(&parent_scope->implicit, e); + add_entity(ctx->checker, parent_scope, e->identifier, e); } } } -- cgit v1.2.3