Skip to content

Commit c78ce5c

Browse files
committed
only check once for the value of a boolean
1 parent d7c70b5 commit c78ce5c

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/slang-utils/metadata.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,10 @@ export function getNodeMetadata(
9999
offset += textLength.utf16;
100100
}
101101

102-
const leadingOffset = enclosePeripheralComments
103-
? 0
104-
: getLeadingOffset(children);
105-
const trailingOffset = enclosePeripheralComments
106-
? 0
107-
: getLeadingOffset(children.reverse());
102+
const [leadingOffset, trailingOffset] = enclosePeripheralComments
103+
? [0, 0]
104+
: [getLeadingOffset(children), getLeadingOffset(children.reverse())];
105+
108106
const loc = {
109107
start: initialOffset + leadingOffset,
110108
end: offset - trailingOffset,

0 commit comments

Comments
 (0)