diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2024-05-06 20:52:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-06 20:52:53 +0200 |
| commit | 5c646656e988ddcdaee09f1bea666dc00ea2ea4d (patch) | |
| tree | 8b21d0a8704999b033e6e8429398fda0144060cb | |
| parent | e1cad51b26559f769b27f1608f59e4cb8f4a6503 (diff) | |
| parent | d8a37f7cf6875cc0e6eba74368541840e0bfd227 (diff) | |
Merge pull request #378 from thetarnav/no-symbol-for-nil
Don't make a symbol for `nil`
| -rw-r--r-- | src/server/analysis.odin | 14 | ||||
| -rw-r--r-- | src/server/semantic_tokens.odin | 7 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 2f1035d..a75b574 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -1308,27 +1308,25 @@ internal_resolve_type_identifier :: proc( ident := new_type(Ident, node.pos, node.end, ast_context.allocator) ident.name = node.name - symbol: Symbol - switch ident.name { + case "nil": + return {}, false case "true", "false": - symbol = Symbol { + return { type = .Keyword, signature = node.name, pkg = ast_context.current_package, value = SymbolUntypedValue{type = .Bool}, - } + }, true case: - symbol = Symbol { + return { type = .Keyword, signature = node.name, name = ident.name, pkg = ast_context.current_package, value = SymbolBasicValue{ident = ident}, - } + }, true } - - return symbol, true } if local, ok := get_local(ast_context, node.pos.offset, node.name); diff --git a/src/server/semantic_tokens.odin b/src/server/semantic_tokens.odin index ce7476f..5d55138 100644 --- a/src/server/semantic_tokens.odin +++ b/src/server/semantic_tokens.odin @@ -596,10 +596,11 @@ visit_ident :: proc( SymbolFixedArrayValue, SymbolSliceValue, SymbolMapValue, - SymbolMultiPointer: + SymbolMultiPointer, + SymbolBasicValue: write_semantic_node(builder, ident, .Type, modifiers) - case SymbolBasicValue, SymbolUntypedValue: - // handled by static syntax analysis + case SymbolUntypedValue: + // handled by static syntax highlighting case SymbolGenericValue: // unused case: |