Skip to content

Commit 5de5022

Browse files
committed
Don't crash when an id is the empty string.
In case the user types `\""`
1 parent b4cf1a1 commit 5de5022

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

analysis/src/SemanticTokens.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,14 @@ let locToString (loc : Location.t) =
8282
Printf.sprintf "%s->%s" (posToString posStart) (posToString posEnd)
8383

8484
let isLowercaseId id =
85+
id <> ""
86+
&&
8587
let c = id.[0] in
8688
c == '_' || (c >= 'a' && c <= 'z')
8789

8890
let isUppercaseId id =
91+
id <> ""
92+
&&
8993
let c = id.[0] in
9094
c >= 'A' && c <= 'Z'
9195

0 commit comments

Comments
 (0)