diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2021-09-10 22:43:16 +0200 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2021-09-10 22:43:16 +0200 |
| commit | f58fdcb80e2b5436d54ec634b6e44abcd497db3f (patch) | |
| tree | ad995886e4e1530d5fb62c89a555f902fc35e07e /src | |
| parent | 42858ae86d8c72028c922eccdffa492e117da231 (diff) | |
check only the builtin on the source package
Diffstat (limited to 'src')
| -rw-r--r-- | src/analysis/analysis.odin | 10 | ||||
| -rw-r--r-- | src/index/indexer.odin | 7 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/analysis/analysis.odin b/src/analysis/analysis.odin index a367f1a..0806a4c 100644 --- a/src/analysis/analysis.odin +++ b/src/analysis/analysis.odin @@ -1180,11 +1180,19 @@ resolve_type_identifier :: proc(ast_context: ^AstContext, node: ast.Ident) -> (i } //last option is to check the index - if symbol, ok := index.lookup(node.name, ast_context.current_package); ok { return resolve_symbol_return(ast_context, symbol); } + //If we are resolving a symbol that is in the document package, then we'll check the builtin packages. + if ast_context.current_package == ast_context.document_package { + for built in index.indexer.built_in_packages { + if symbol, ok := index.lookup(node.name, built); ok { + return resolve_symbol_return(ast_context, symbol); + } + } + } + for u in ast_context.usings { //TODO(Daniel, make into a map, not really required for performance but looks nicer) diff --git a/src/index/indexer.odin b/src/index/indexer.odin index ce031f1..611b922 100644 --- a/src/index/indexer.odin +++ b/src/index/indexer.odin @@ -58,13 +58,6 @@ lookup :: proc(name: string, pkg: string, loc := #caller_location) -> (Symbol, b 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; } |