Skip to content

Commit d8a37f7

Browse files
committed
Don't make a symbol for nil
Don't make a symbol for `nil` and enable semantic tokens for `SymbolBasicValue`
1 parent 33a6d8c commit d8a37f7

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/server/analysis.odin

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,27 +1304,25 @@ internal_resolve_type_identifier :: proc(
13041304
ident := new_type(Ident, node.pos, node.end, ast_context.allocator)
13051305
ident.name = node.name
13061306

1307-
symbol: Symbol
1308-
13091307
switch ident.name {
1308+
case "nil":
1309+
return {}, false
13101310
case "true", "false":
1311-
symbol = Symbol {
1311+
return {
13121312
type = .Keyword,
13131313
signature = node.name,
13141314
pkg = ast_context.current_package,
13151315
value = SymbolUntypedValue{type = .Bool},
1316-
}
1316+
}, true
13171317
case:
1318-
symbol = Symbol {
1318+
return {
13191319
type = .Keyword,
13201320
signature = node.name,
13211321
name = ident.name,
13221322
pkg = ast_context.current_package,
13231323
value = SymbolBasicValue{ident = ident},
1324-
}
1324+
}, true
13251325
}
1326-
1327-
return symbol, true
13281326
}
13291327

13301328
if local, ok := get_local(ast_context, node.pos.offset, node.name);

src/server/semantic_tokens.odin

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,10 +609,11 @@ visit_ident :: proc(
609609
SymbolFixedArrayValue,
610610
SymbolSliceValue,
611611
SymbolMapValue,
612-
SymbolMultiPointer:
612+
SymbolMultiPointer,
613+
SymbolBasicValue:
613614
write_semantic_node(builder, ident, .Type, modifiers)
614-
case SymbolBasicValue, SymbolUntypedValue:
615-
// handled by static syntax analysis
615+
case SymbolUntypedValue:
616+
// handled by static syntax highlighting
616617
case SymbolGenericValue:
617618
// unused
618619
case:

0 commit comments

Comments
 (0)