Skip to content

Commit

Permalink
Merge pull request #378 from thetarnav/no-symbol-for-nil
Browse files Browse the repository at this point in the history
Don't make a symbol for `nil`
  • Loading branch information
DanielGavin authored May 6, 2024
2 parents e1cad51 + d8a37f7 commit 5c64665
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
14 changes: 6 additions & 8 deletions src/server/analysis.odin
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions src/server/semantic_tokens.odin
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5c64665

Please sign in to comment.