mirror of
https://github.com/aphrody-labs/oxc.git
synced 2026-10-17 12:56:09 +00:00
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:
1 parent
8d4c633137
commit
0a386ff5b5
1 file changed
+1
-1
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user