mirror of
https://github.com/morluto/rea
synced 2026-10-27 06:33:32 -04:00
fix(javascript): bound semantic expansion and resolve lexical receivers
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { JavaScriptSemanticResourceLimit } from "./javascriptSemanticValueTypes.js";
|
||||
|
||||
/** Exact retention state for one callable's direct returns. */
|
||||
export type JavaScriptSemanticReturnCoverage = {
|
||||
readonly retainedCount: number;
|
||||
@@ -9,21 +11,34 @@ export type JavaScriptSemanticReturnCoverage = {
|
||||
/** Coverage state for one semantic recovery pass. */
|
||||
export type JavaScriptSemanticCoverage =
|
||||
| {
|
||||
readonly status: "complete" | "partial";
|
||||
readonly status: "complete";
|
||||
readonly omittedCount: 0;
|
||||
readonly resourceLimits?: readonly JavaScriptSemanticResourceLimit[];
|
||||
}
|
||||
| {
|
||||
readonly status: "partial";
|
||||
readonly omittedCount: 0 | null;
|
||||
readonly resourceLimits?: readonly JavaScriptSemanticResourceLimit[];
|
||||
}
|
||||
| {
|
||||
readonly status: "failed";
|
||||
readonly omittedCount: null;
|
||||
readonly resourceLimits?: readonly JavaScriptSemanticResourceLimit[];
|
||||
};
|
||||
|
||||
/** Classify whole-file semantic coverage from parser recovery. */
|
||||
/** Classify whole-file semantic coverage from parsing and value bounds. */
|
||||
export const semanticCoverage = (
|
||||
parserPartial: boolean,
|
||||
): JavaScriptSemanticCoverage => ({
|
||||
status: parserPartial ? "partial" : "complete",
|
||||
omittedCount: 0,
|
||||
});
|
||||
resourceLimits: readonly JavaScriptSemanticResourceLimit[] = [],
|
||||
): JavaScriptSemanticCoverage =>
|
||||
resourceLimits.length > 0
|
||||
? { status: "partial", omittedCount: null, resourceLimits }
|
||||
: { status: parserPartial ? "partial" : "complete", omittedCount: 0 };
|
||||
|
||||
/** Read typed resource-limit classifications from any coverage state. */
|
||||
export const semanticCoverageResourceLimits = (
|
||||
coverage: JavaScriptSemanticCoverage,
|
||||
): readonly JavaScriptSemanticResourceLimit[] => coverage.resourceLimits ?? [];
|
||||
|
||||
/** Classify one callable's direct-return coverage. */
|
||||
export const semanticReturnCoverage = (
|
||||
|
||||
Reference in New Issue
Block a user