perf(packages/codegen): reduce branches in printArguments (#27607)

Small perf optimization.

The loop always checks if `length === 0` anyway before first iteration, so there's no real gain in checking it manually.
This commit is contained in:
overlookmotel committed 2026-10-12 21:13:11 +00:00
1 parent 262dd21150
commit adc90edea0
1 file changed
+1 -7
+1 -7
View File
@@ -407,15 +407,9 @@ function printArguments(
args: ESTree.Argument[],
state: State,
): void {
const { length } = args;
if (length === 0) {
writeNoLast(state, "(");
writeWithMapEnd(state, ")", CAT_CLOSE_BRACKET, node.start, node.end, node);
return;
}
write(state, "(", CAT_OTHER);
const { length } = args;
for (let i = 0; i < length; i++) {
if (i > 0) write(state, ", ", CAT_OTHER);