perf(packages/codegen): ensure shorthand var is always a boolean (#27589)

Tiny perf optimization.

Ensure that V8 can prove that `shorthand` is always a boolean, and can avoid a type check when branching on it later on.
This commit is contained in:
overlookmotel committed 2026-10-12 14:03:10 +00:00
1 parent 8d4c633137
commit 0a386ff5b5
1 file changed
+1 -1
+1 -1
View File
@@ -528,7 +528,7 @@ function printObjectProperty(node: ESTree.ObjectPropertyKind, state: State): voi
if (key.type === "Identifier") {
const keyName = key.name;
if (keyName === "__proto__") {
shorthand = node.shorthand;
shorthand = node.shorthand === true;
} else {
const inner = withoutParens(value);
if (inner.type === "Identifier" && inner.name === keyName) {