mirror of
https://github.com/aphrody-labs/oxc.git
synced 2026-10-22 23:45:42 +00:00
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:
1 parent
3c289f3961
commit
70ecfddf2a
1 file changed
+5
-3
@@ -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.
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user