mirror of
https://github.com/aphrody-labs/oxc.git
synced 2026-10-17 12:56:09 +00:00
perf(packages/codegen): remove unnecessary printSpaceBeforeIdentifier calls (#27606)
Perf optimization.
Remove unnecessary `printSpaceBeforeIdentifier` calls in `printAssignmentTargetProperty`. The last thing printed is always either `{` or `, `, so `printSpaceBeforeIdentifier` is always a no-op here anyway.
This commit is contained in:
1 parent
c993555ede
commit
262dd21150
1 file changed
-2
@@ -92,12 +92,10 @@ function printAssignmentTargetProperty(node: ESTree.AssignmentTargetProperty, st
|
||||
const { value } = node;
|
||||
if (value.type === "AssignmentPattern") {
|
||||
typeAssertIs<ESTree.IdentifierReference>(value.left);
|
||||
printSpaceBeforeIdentifier(state);
|
||||
writeWithMapNamed(state, value.left.name, value.left.start, value.left.end, value.left);
|
||||
write(state, " = ", CAT_OTHER);
|
||||
printExpression(value.right, state, PREC_COMMA, CTX_NONE);
|
||||
} else {
|
||||
printSpaceBeforeIdentifier(state);
|
||||
writeWithMapNamed(state, value.name, value.start, value.end, value);
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user