aboutsummaryrefslogtreecommitdiff
path: root/src/index
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2020-12-10 00:04:31 +0100
committerDanielGavin <danielgavin5@hotmail.com>2020-12-10 00:04:31 +0100
commit4dca91cdde7006a9005c77e56dd5b7e306bbb7fc (patch)
treefc74924d34966682290c995f373afdb559cc7aea /src/index
parent63b9cf5480031345b391616df987281a76d8d61e (diff)
added package completion, builtin and runtime package always checked in lookup.
Diffstat (limited to 'src/index')
-rw-r--r--src/index/indexer.odin12
1 files changed, 8 insertions, 4 deletions
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;