fix(javascript): bound semantic expansion and resolve lexical receivers

This commit is contained in:
morluto committed 2026-10-09 00:49:30 +08:00
1 parent eaf5734083
commit 16f4609d68
26 files changed
+868 -78

No files matched your search

@@ -11,6 +11,7 @@ import {
} from "./javascriptSemanticState.js";
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
import {
readExactJavaScriptLiteral,
semanticStaticPropertyKey,
semanticStaticPropertyName,
} from "./javascriptAstValues.js";
@@ -262,10 +263,12 @@ export const dataEffectLiteralString = (
| t.ArgumentPlaceholder
| undefined,
): string | null => {
if (t.isStringLiteral(node)) return node.value;
if (t.isTemplateLiteral(node) && node.expressions.length === 0)
return node.quasis[0]?.value.cooked ?? node.quasis[0]?.value.raw ?? null;
return null;
if (node === undefined) return null;
const literal = readExactJavaScriptLiteral(node);
if (literal.found && typeof literal.value === "string") return literal.value;
return t.isTemplateLiteral(node) && node.expressions.length === 0
? (node.quasis[0]?.value.raw ?? null)
: null;
};
/** Read a member callee from call or construction syntax. */