refactor(javascript): normalize erased expression syntax once

This commit is contained in:
morluto committed 2026-10-10 01:45:01 +08:00
1 parent cfb12e47dc
commit b628bba1fa
17 files changed
+313 -205

No files matched your search

@@ -17,6 +17,7 @@ import type {
} from "./javascriptExportShapeComparisonSchemas.js";
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
import { semanticCallableIdForNode } from "./javascriptSemanticProjection.js";
import { unwrapJavaScriptExpression } from "./javascriptAstValues.js";
import {
resolveSemanticBindingState,
type JavaScriptSemanticAnalysisState,
@@ -177,6 +178,9 @@ const callableIdsForNode = (
admitted: ReadonlySet<string>,
seen: ReadonlySet<string>,
): string[] => {
const unwrapped = unwrapJavaScriptExpression(node).node;
if (unwrapped !== node)
return callableIdsForNode(unwrapped, state, admitted, seen);
const direct = semanticCallableIdForNode(node);
if (direct !== null && admitted.has(direct)) return [direct];
if (t.isIdentifier(node)) {
@@ -185,13 +189,6 @@ const callableIdsForNode = (
? []
: callableIdsForBinding(binding, state, admitted, seen);
}
if (
t.isTSAsExpression(node) ||
t.isTSTypeAssertion(node) ||
t.isTSNonNullExpression(node) ||
t.isTSSatisfiesExpression(node)
)
return callableIdsForNode(node.expression, state, admitted, seen);
return [];
};