Skip to content

Commit bf03386

Browse files
committed
removing unnecessary else-if
1 parent 550d147 commit bf03386

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/slang-utils/metadata.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ const isCommentOrWhiteSpace = createKindCheckFunction([
2121
function getLeadingOffset(children: Node[]): number {
2222
let offset = 0;
2323
for (const child of children) {
24-
if (child.isNonterminalNode()) {
25-
// The node's content starts when we find the first non-terminal token.
26-
return offset;
27-
} else if (!isCommentOrWhiteSpace(child)) {
28-
// The content of the node started if we find a non-comment,
29-
// non-whitespace token.
24+
if (child.isNonterminalNode() || !isCommentOrWhiteSpace(child)) {
25+
// The node's content starts when we find the first non-terminal token,
26+
// or if we find a non-comment, non-whitespace token.
3027
return offset;
3128
}
3229
offset += child.textLength.utf16;
@@ -110,7 +107,8 @@ function collectComments(
110107
if (node) {
111108
if (Array.isArray(node)) {
112109
return node.reduce(collectComments, comments);
113-
} else if (node.comments.length > 0) {
110+
}
111+
if (node.comments.length > 0) {
114112
comments.push(...node.comments.splice(0));
115113
}
116114
}

0 commit comments

Comments
 (0)