Skip to content

Commit b45d786

Browse files
committed
fix: val simplify
1 parent 0343d2f commit b45d786

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src/printer.mjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,16 +2103,17 @@ function printNode(path, options, print) {
21032103
} else {
21042104
const isExpression = ["call", "offsetlookup"].includes(node.what.kind);
21052105

2106+
// Skip parens for staticlookup in member chain to preserve original syntax
21062107
const isInMemberChain =
21072108
path.parent &&
21082109
(isLookupNode(path.parent) || path.parent.kind === "call");
2109-
const whatEndOffset = locEnd(node.what);
2110-
const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex(
2111-
options.originalText,
2112-
whatEndOffset
2113-
);
21142110
const hasOriginalParens =
2115-
options.originalText.charAt(nextCharIndex) === "(";
2111+
options.originalText.charAt(
2112+
getNextNonSpaceNonCommentCharacterIndex(
2113+
options.originalText,
2114+
locEnd(node.what)
2115+
)
2116+
) === "(";
21162117
const shouldSkipParens =
21172118
isInMemberChain &&
21182119
node.arguments.length === 0 &&

0 commit comments

Comments
 (0)