mirror of
https://github.com/morluto/rea
synced 2026-10-27 14:42:18 -04:00
refactor(javascript): reuse semantic member-chain facts
Resolve member structure through the existing AST owner while preserving binding, shadowing and global process identity checks in their consumers.
This commit is contained in:
@@ -1460,17 +1460,9 @@ export const semanticGlobalProcessPathOrigin = (
|
||||
node: t.Node,
|
||||
state: JavaScriptSemanticAnalysisState,
|
||||
): JavaScriptModuleOrigin | undefined => {
|
||||
const members: string[] = [];
|
||||
let current = unwrapJavaScriptExpression(node).node;
|
||||
while (
|
||||
t.isMemberExpression(current) ||
|
||||
t.isOptionalMemberExpression(current)
|
||||
) {
|
||||
const key = semanticStaticPropertyKey(current.property, current.computed);
|
||||
if (key === null) return undefined;
|
||||
members.unshift(key);
|
||||
current = unwrapJavaScriptExpression(current.object).node;
|
||||
}
|
||||
const chain = semanticMemberChain(node);
|
||||
if (chain === undefined) return undefined;
|
||||
const { root: current, members } = chain;
|
||||
if (
|
||||
!t.isIdentifier(current) ||
|
||||
!["globalThis", "global", "window", "self"].includes(current.name) ||
|
||||
|
||||
Reference in New Issue
Block a user