perf(packages/codegen): skip redundant printSpaceBeforeIdentifier call (#27619)

Small perf optimization.

After a `(` is written, it's redundant to call `printSpaceBeforeIdentifier` because it's always a no-op. Skip it on that branch.
This commit is contained in:
overlookmotel committed 2026-10-12 21:45:55 +00:00
1 parent 3c289f3961
commit 70ecfddf2a
1 file changed
+5 -3
+5 -3
View File
@@ -81,9 +81,11 @@ export function printFunction(node: ESTree.Function, state: State): void {
wrap = (state.last | 1) === CAT_START_OF_STMT;
}
if (wrap) write(state, "(", CAT_OTHER);
printSpaceBeforeIdentifier(state);
if (wrap) {
writeNoLast(state, "(");
} else {
printSpaceBeforeIdentifier(state);
}
// The node's mapping goes on whatever keyword begins the function, which is written as a single string.
//