Fix some crashes when pretty-printing an empty name

Predicate names can't be empty, but it can happen with the renaming feature added in the next commit.
This commit is contained in:
Asger F
2024-11-25 16:36:03 +01:00
parent 4a835b8711
commit 568f0827b2

View File

@@ -70,14 +70,14 @@ function parseName(text: string): QualifiedName {
let args: QualifiedName[] | undefined;
if (skipToken(">")) {
args = [];
while (peek() !== "<") {
while (tokens.length > 0 && peek() !== "<") {
args.push(parseQName());
skipToken(",");
}
args.reverse();
skipToken("<");
}
const name = next();
const name = tokens.length === 0 ? "" : next();
const prefix = skipToken("::") ? parseQName() : undefined;
return {
prefix,