refactor(analysis): remove fixed result quotas

This commit is contained in:
morluto
2026-09-29 13:57:24 +08:00
parent 0e2738ffb6
commit 20152a9872
105 changed files with 605 additions and 1084 deletions
+1 -13
View File
@@ -4,17 +4,12 @@ import type {
JavaScriptSemanticPrimitive,
JavaScriptSemanticValue,
} from "./javascriptSemanticIr.js";
import type { JavaScriptSemanticAnalysisState } from "./javascriptSemanticState.js";
import {
reachSemanticValueLimit,
semanticPrimitiveKey,
} from "./javascriptSemanticProvenance.js";
import { semanticPrimitiveKey } from "./javascriptSemanticProvenance.js";
import { compareCodePoints } from "./javascriptStaticAnalysisHelpers.js";
/** Normalize one bounded collection of possible primitive values. */
export const semanticPrimitiveSet = (
values: readonly JavaScriptSemanticPrimitive[],
state: JavaScriptSemanticAnalysisState,
): JavaScriptSemanticValue => {
const unique = [
...new Map(
@@ -23,13 +18,6 @@ export const semanticPrimitiveSet = (
].sort((left, right) =>
compareCodePoints(semanticPrimitiveKey(left), semanticPrimitiveKey(right)),
);
if (unique.length > state.limits.maxUnionValues) {
reachSemanticValueLimit(state, "maxUnionValues");
return {
status: "limit-reached",
reason: "maxUnionValues reached.",
};
}
const only = unique[0];
return unique.length === 1 && only !== undefined
? { status: "literal", value: only }