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
+6 -10
View File
@@ -255,7 +255,8 @@ const evaluateMember = (
): JavaScriptSemanticValue => {
if (!t.isNode(node.object))
return { status: "unknown", reason: "Unsupported member base." };
const key = memberKey(node);
const key =
semanticStaticPropertyKey(node.property, node.computed) ?? undefined;
if (key === undefined)
return { status: "unknown", reason: "Dynamic member key." };
return projectValue(evaluateExpression(node.object, nestedContext(context)), [
@@ -415,7 +416,8 @@ const provenanceForExpression = (
"unknown",
"Unsupported member base.",
);
const member = memberKey(node);
const member =
semanticStaticPropertyKey(node.property, node.computed) ?? undefined;
if (typeof member !== "string")
return semanticUnresolvedProvenance(
"unknown",
@@ -459,7 +461,8 @@ const requireOrigin = (
if (t.isMemberExpression(node) || t.isOptionalMemberExpression(node)) {
if (!t.isNode(node.object)) return undefined;
const nested = requireOrigin(node.object, state);
const member = memberKey(node);
const member =
semanticStaticPropertyKey(node.property, node.computed) ?? undefined;
return nested === undefined || typeof member !== "string"
? undefined
: { ...nested, importedPath: [...nested.importedPath, member] };
@@ -491,13 +494,6 @@ const mergeValues = (
: { status: "ambiguous", reason: "Branches have incompatible values." };
};
const memberKey = (
node: t.MemberExpression | t.OptionalMemberExpression,
): string | number | undefined => {
const name = semanticStaticPropertyKey(node.property, node.computed);
return name ?? undefined;
};
const nestedContext = (
context: EvaluationContext,
bindingId?: string,