From 4dca91cdde7006a9005c77e56dd5b7e306bbb7fc Mon Sep 17 00:00:00 2001 From: DanielGavin Date: Thu, 10 Dec 2020 00:04:31 +0100 Subject: added package completion, builtin and runtime package always checked in lookup. --- src/index/indexer.odin | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/index') diff --git a/src/index/indexer.odin b/src/index/indexer.odin index 073d32d..e04febd 100644 --- a/src/index/indexer.odin +++ b/src/index/indexer.odin @@ -39,6 +39,7 @@ import "core:sort" Indexer :: struct { + built_in_packages: [dynamic] string, static_index: MemoryIndex, }; @@ -57,11 +58,14 @@ lookup :: proc(name: string, pkg: string, loc := #caller_location) -> (Symbol, b return symbol, true; } - if symbol, ok := memory_index_lookup(&indexer.static_index, name, "builtin"); ok { - log.infof("lookup name: %v pkg: %v, symbol %v location %v", name, pkg, symbol, loc); - return symbol, true; - } + for built in indexer.built_in_packages { + if symbol, ok := memory_index_lookup(&indexer.static_index, name, built); ok { + log.infof("lookup name: %v pkg: %v, symbol %v location %v", name, pkg, symbol, loc); + return symbol, true; + } + + } log.infof("lookup failed name: %v pkg: %v location %v", name, pkg, loc); return {}, false; -- cgit v1.2.3