aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-28 22:35:24 -0400
committerGitHub <noreply@github.com>2025-07-28 22:35:24 -0400
commit6c769f52ffd2cd40def26f758498ca4a8b2bce2b (patch)
tree3c468db8ba5bd9ba4c5aae3d1cbdd1fec1393f84 /src/server
parent87da843330c8f7e7cab55951fd1536d9f21e17cd (diff)
parent886ae45e2736bf0406948c7302ae9a259ac43835 (diff)
Merge pull request #798 from BradLewis/fix/handle-compile-time-call-expr
Handle semantic token for const global variables returned from functions
Diffstat (limited to 'src/server')
-rw-r--r--src/server/semantic_tokens.odin4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/server/semantic_tokens.odin b/src/server/semantic_tokens.odin
index ac1beed..1a5fcb6 100644
--- a/src/server/semantic_tokens.odin
+++ b/src/server/semantic_tokens.odin
@@ -390,9 +390,11 @@ visit_node :: proc(node: ^ast.Node, builder: ^SemanticTokenBuilder) {
}
}
+// TODO: it seems the global symbols don't distinguish between a type decl and
+// a const variable declaration, so we do a quick check here to distinguish the cases.
is_variable_declaration :: proc(expr: ^ast.Expr) -> bool {
#partial switch v in expr.derived {
- case ^ast.Comp_Lit, ^ast.Basic_Lit, ^ast.Type_Cast:
+ case ^ast.Comp_Lit, ^ast.Basic_Lit, ^ast.Type_Cast, ^ast.Call_Expr:
return true
case:
return false