refactor(domain): consolidate property-key extraction behind semanticStaticPropertyKey (#823)

Inline the private memberKey/propertyKey wrappers in semantic
MemberMutations/Projection/Values to direct canonical calls.
Migrate the electron Browser/Values member keys off legacy
propertyName (provably identical: explicit computed guard retained).
Delegate bundle calleeName/endpointArgument/stringArgument to the
static helpers, adding loadURL endpoint parity with static analysis.

Bundle regressions pin nested-dynamic-receiver and loadURL parity.
Remaining computed-identifier forks in electron Native/Ipc tracked
in #822.
This commit is contained in:
morluto
2026-10-07 11:13:59 +08:00
committed by GitHub
parent 75f50d86f6
commit 764ff05231
8 changed files with 54 additions and 84 deletions
+14 -12
View File
@@ -6,7 +6,10 @@ import {
} from "./javascriptSemanticState.js";
import { evaluateSemanticBinding } from "./javascriptSemanticValues.js";
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
import { semanticStaticPropertyName } from "./javascriptAstValues.js";
import {
semanticStaticPropertyKey,
semanticStaticPropertyName,
} from "./javascriptAstValues.js";
type PropertyPath = readonly (string | number | null)[];
@@ -36,7 +39,11 @@ export const collectSemanticMemberMutations = (
return;
}
if (t.isMemberExpression(node) || t.isOptionalMemberExpression(node)) {
markValue(node.object, [propertyKey(node), ...path], bindings);
markValue(
node.object,
[semanticStaticPropertyKey(node.property, node.computed), ...path],
bindings,
);
return;
}
for (const value of referencedValues(node, path))
@@ -44,7 +51,11 @@ export const collectSemanticMemberMutations = (
};
const markTarget = (node: t.Node): void => {
if (t.isMemberExpression(node) || t.isOptionalMemberExpression(node))
markValue(node.object, [propertyKey(node)], new Set());
markValue(
node.object,
[semanticStaticPropertyKey(node.property, node.computed)],
new Set(),
);
else if (t.isRestElement(node)) markTarget(node.argument);
else if (t.isAssignmentPattern(node)) markTarget(node.left);
else if (t.isArrayPattern(node)) {
@@ -129,12 +140,3 @@ const referencedValues = (
];
return [];
};
const propertyKey = (
node: t.MemberExpression | t.OptionalMemberExpression,
): string | null => {
const name = semanticStaticPropertyName(node.property, node.computed);
return name !== "" || t.isStringLiteral(node.property, { value: "" })
? name
: null;
};