@nudojs/core 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-RZOQL6PT.js → chunk-P3G2TODS.js} +381 -70
- package/dist/exec.d.ts +1 -1
- package/dist/exec.js +1 -1
- package/dist/{index-OfNo5qlN.d.ts → index-FITqyJ8v.d.ts} +1 -1
- package/dist/index.d.ts +180 -227
- package/dist/index.js +158 -1106
- package/package.json +1 -1
package/dist/exec.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { $ as $add, e as $arr, f as $async, g as $asyncReturn, h as $await, i as $call, j as $callNamed, k as $catchVal, l as $class, m as $concat, n as $div, o as $elems, p as $eq, q as $fnVal, r as $for, s as $forIter, t as $forOf, u as $fork, v as $ge, w as $gen, x as $get, y as $gt, z as $idx, B as $idxSet, D as $invoke, E as $invokeSuper, F as $join, G as $le, I as $len, J as $lit, K as $lt, L as $mod, M as $mul, N as $ne, O as $neg, Q as $new, U as $not, V as $obj, W as $optionalGet, X as $optionalInvoke, Y as $orDefault, Z as $regex, _ as $set, a0 as $setKey, a1 as $spread, a2 as $staticInvoke, a3 as $sub, a4 as $super, a5 as $switch, a6 as $thisGet, a7 as $thisSet, a8 as $throw, a9 as $typeof, aa as $while, ab as $whileSeq, ac as $yield, ad as BCallRecord, ae as BClassSpec, af as BMemberDiag, ag as DEFAULT_MAX_LOOP_ITERS,
|
|
1
|
+
export { $ as $add, e as $arr, f as $async, g as $asyncReturn, h as $await, i as $call, j as $callNamed, k as $catchVal, l as $class, m as $concat, n as $div, o as $elems, p as $eq, q as $fnVal, r as $for, s as $forIter, t as $forOf, u as $fork, v as $ge, w as $gen, x as $get, y as $gt, z as $idx, B as $idxSet, D as $invoke, E as $invokeSuper, F as $join, G as $le, I as $len, J as $lit, K as $lt, L as $mod, M as $mul, N as $ne, O as $neg, Q as $new, U as $not, V as $obj, W as $optionalGet, X as $optionalInvoke, Y as $orDefault, Z as $regex, _ as $set, a0 as $setKey, a1 as $spread, a2 as $staticInvoke, a3 as $sub, a4 as $super, a5 as $switch, a6 as $thisGet, a7 as $thisSet, a8 as $throw, a9 as $typeof, aa as $while, ab as $whileSeq, ac as $yield, ad as BCallRecord, ae as BClassSpec, af as BMemberDiag, ag as DEFAULT_MAX_LOOP_ITERS, aj as NudoThrow, ak as RunTranspiledOptions, al as TranspileOptions, am as TranspiledCallResult, av as asAbsVal, aA as callTranspiledExport, aB as callTranspiledExportFull, aC as clearBClasses, aG as currentExecPhi, aL as getAbsOrigin, aM as getBCallCollector, aN as getBClass, aS as isDefinitelyFalse, aT as isDefinitelyTrue, aV as isNudoThrow, b0 as litTruth, b5 as namespaceNameOf, b9 as noteMemberDispatchMiss, ba as notePrimMemberMissing, bb as noteUnknownMemberMissing, bq as recordMemberDiag, br as registerBClass, bs as runTranspiled, bu as setBCallCollector, bv as setMemberDiagCollector, bF as tagAbsOrigin, bI as transpile, bJ as transpileExpression, bK as transpileFile, bL as transpileSource, bT as withExecPhi } from './index-FITqyJ8v.js';
|
|
2
2
|
import '@babel/types';
|
package/dist/exec.js
CHANGED
|
@@ -758,4 +758,4 @@ declare function callTranspiledExportFull(exports: Record<string, unknown>, name
|
|
|
758
758
|
/** 调用 runTranspiled 导出(仅结果) */
|
|
759
759
|
declare function callTranspiledExport(exports: Record<string, unknown>, name: string, args: Abs[]): Abs;
|
|
760
760
|
|
|
761
|
-
export { $add as $, type
|
|
761
|
+
export { $add as $, type Abs as A, $idxSet as B, type Confidence as C, $invoke as D, $invokeSuper as E, $join as F, $le as G, type HofSite as H, $len as I, $lit as J, $lt as K, $mod as L, $mul as M, $ne as N, $neg as O, type Phi as P, $new as Q, type RelSource as R, type Shape as S, type Term as T, $not as U, $obj as V, $optionalGet as W, $optionalInvoke as X, $orDefault as Y, $regex as Z, $set as _, type AstEnv as a, lit as a$, $setKey as a0, $spread as a1, $staticInvoke as a2, $sub as a3, $super as a4, $switch as a5, $thisGet as a6, $thisSet as a7, $throw as a8, $typeof as a9, callTranspiledExport as aA, callTranspiledExportFull as aB, clearBClasses as aC, collectAbsExports as aD, confJoin as aE, createHofCollectCtx as aF, currentExecPhi as aG, emptyPhi as aH, eq as aI, ge as aJ, geNum as aK, getAbsOrigin as aL, getBCallCollector as aM, getBClass as aN, gt as aO, gtNum as aP, implies as aQ, instantiateReturn as aR, isDefinitelyFalse as aS, isDefinitelyTrue as aT, isExactLit as aU, isNudoThrow as aV, isNumPrim as aW, isRelFn as aX, isStrPrim as aY, le as aZ, leNum as a_, $while as aa, $whileSeq as ab, $yield as ac, type BCallRecord as ad, type BClassSpec as ae, type BMemberDiag as af, DEFAULT_MAX_LOOP_ITERS as ag, type HofCollectCtx as ah, type LiteralValue as ai, NudoThrow as aj, type RunTranspiledOptions as ak, type TranspileOptions as al, type TranspiledCallResult as am, abs as an, absToString as ao, alphaOf as ap, and as aq, anyVar as ar, app as as, applyCallbackAbs as at, asAbs as au, asAbsVal as av, betaOf as aw, bindImports as ax, bool as ay, boolLit as az, type Pred as b, litTruth as b0, litValue as b1, lt as b2, ltNum as b3, mapElementFallback as b4, namespaceNameOf as b5, ne as b6, never as b7, not as b8, noteMemberDispatchMiss as b9, str as bA, strLit as bB, substAbs as bC, substPred as bD, substPredAbs as bE, tagAbsOrigin as bF, termEquals as bG, termToString as bH, transpile as bI, transpileExpression as bJ, transpileFile as bK, transpileSource as bL, tryPromoteDirectCall as bM, tryPromoteForOfIteratee as bN, tryPromoteHofCallback as bO, tryPromoteReceiverAsArr as bP, undefAbs as bQ, unknown as bR, v as bS, withExecPhi as bT, notePrimMemberMissing as ba, noteUnknownMemberMissing as bb, num as bc, numLit as bd, numVar as be, obj as bf, or as bg, pFalse as bh, pTrue as bi, phiAnd as bj, predEquals as bk, predToString as bl, predVars as bm, projectFlatMapResult as bn, promoteParamShape as bo, ptypeof as bp, recordMemberDiag as bq, registerBClass as br, runTranspiled as bs, setApplyCallbackHost as bt, setBCallCollector as bu, setMemberDiagCollector as bv, shapeOfTerm as bw, shapeToString as bx, simplifyTerm as by, snapshotAbs as bz, type AbsModuleExports as c, type PrimName as d, $arr as e, $async as f, $asyncReturn as g, $await as h, $call as i, $callNamed as j, $catchVal as k, $class as l, $concat as m, $div as n, $elems as o, $eq as p, $fnVal as q, $for as r, $forIter as s, $forOf as t, $fork as u, $ge as v, $gen as w, $get as x, $gt as y, $idx as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,195 +1,44 @@
|
|
|
1
|
+
import { A as Abs, P as Phi, a as AstEnv, C as Confidence, b as Pred, S as Shape, T as Term, c as AbsModuleExports, d as PrimName, R as RelSource, H as HofSite } from './index-FITqyJ8v.js';
|
|
2
|
+
export { $ as $add, e as $arr, f as $async, g as $asyncReturn, h as $await, i as $call, j as $callNamed, k as $catchVal, l as $class, m as $concat, n as $div, o as $elems, p as $eq, q as $fnVal, r as $for, s as $forIter, t as $forOf, u as $fork, v as $ge, w as $gen, x as $get, y as $gt, z as $idx, B as $idxSet, D as $invoke, E as $invokeSuper, F as $join, G as $le, I as $len, J as $lit, K as $lt, L as $mod, M as $mul, N as $ne, O as $neg, Q as $new, U as $not, V as $obj, W as $optionalGet, X as $optionalInvoke, Y as $orDefault, Z as $regex, _ as $set, a0 as $setKey, a1 as $spread, a2 as $staticInvoke, a3 as $sub, a4 as $super, a5 as $switch, a6 as $thisGet, a7 as $thisSet, a8 as $throw, a9 as $typeof, aa as $while, ab as $whileSeq, ac as $yield, ad as BCallRecord, ae as BClassSpec, af as BMemberDiag, ag as DEFAULT_MAX_LOOP_ITERS, ah as HofCollectCtx, ai as LiteralValue, aj as NudoThrow, ak as RunTranspiledOptions, al as TranspileOptions, am as TranspiledCallResult, an as abs, ao as absToString, ap as alphaOf, aq as and, ar as anyVar, as as app, at as applyCallbackAbs, au as asAbs, av as asAbsVal, aw as betaOf, ax as bindImports, ay as bool, az as boolLit, aA as callTranspiledExport, aB as callTranspiledExportFull, aC as clearBClasses, aD as collectAbsExports, aE as confJoin, aF as createHofCollectCtx, aG as currentExecPhi, aH as emptyPhi, aI as eq, aJ as ge, aK as geNum, aL as getAbsOrigin, aM as getBCallCollector, aN as getBClass, aO as gt, aP as gtNum, aQ as implies, aR as instantiateReturn, aS as isDefinitelyFalse, aT as isDefinitelyTrue, aU as isExactLit, aV as isNudoThrow, aW as isNumPrim, aX as isRelFn, aY as isStrPrim, aZ as le, a_ as leNum, a$ as lit, b0 as litTruth, b1 as litValue, b2 as lt, b3 as ltNum, b4 as mapElementFallback, b5 as namespaceNameOf, b6 as ne, b7 as never, b8 as not, b9 as noteMemberDispatchMiss, ba as notePrimMemberMissing, bb as noteUnknownMemberMissing, bc as num, bd as numLit, be as numVar, bf as obj, bg as or, bh as pFalse, bi as pTrue, bj as phiAnd, bk as predEquals, bl as predToString, bm as predVars, bn as projectFlatMapResult, bo as promoteParamShape, bp as ptypeof, bq as recordMemberDiag, br as registerBClass, bs as runTranspiled, bt as setApplyCallbackHost, bu as setBCallCollector, bv as setMemberDiagCollector, bw as shapeOfTerm, bx as shapeToString, by as simplifyTerm, bz as snapshotAbs, bA as str, bB as strLit, bC as substAbs, bD as substPred, bE as substPredAbs, bF as tagAbsOrigin, bG as termEquals, bH as termToString, bI as transpile, bJ as transpileExpression, bK as transpileFile, bL as transpileSource, bM as tryPromoteDirectCall, bN as tryPromoteForOfIteratee, bO as tryPromoteHofCallback, bP as tryPromoteReceiverAsArr, bQ as undefAbs, bR as unknown, bS as v, bT as withExecPhi } from './index-FITqyJ8v.js';
|
|
1
3
|
import { Node, File } from '@babel/types';
|
|
2
|
-
import { P as Phi, A as AstEnv, a as Abs, C as Confidence, b as Pred, S as Shape, T as Term, c as AbsModuleExports, d as PrimName, R as RelSource, H as HofSite } from './index-OfNo5qlN.js';
|
|
3
|
-
export { $ as $add, e as $arr, f as $async, g as $asyncReturn, h as $await, i as $call, j as $callNamed, k as $catchVal, l as $class, m as $concat, n as $div, o as $elems, p as $eq, q as $fnVal, r as $for, s as $forIter, t as $forOf, u as $fork, v as $ge, w as $gen, x as $get, y as $gt, z as $idx, B as $idxSet, D as $invoke, E as $invokeSuper, F as $join, G as $le, I as $len, J as $lit, K as $lt, L as $mod, M as $mul, N as $ne, O as $neg, Q as $new, U as $not, V as $obj, W as $optionalGet, X as $optionalInvoke, Y as $orDefault, Z as $regex, _ as $set, a0 as $setKey, a1 as $spread, a2 as $staticInvoke, a3 as $sub, a4 as $super, a5 as $switch, a6 as $thisGet, a7 as $thisSet, a8 as $throw, a9 as $typeof, aa as $while, ab as $whileSeq, ac as $yield, ad as BCallRecord, ae as BClassSpec, af as BMemberDiag, ag as DEFAULT_MAX_LOOP_ITERS, ah as HofCollectCtx, ai as NudoThrow, aj as RunTranspiledOptions, ak as TranspileOptions, al as TranspiledCallResult, am as abs, an as absToString, ao as alphaOf, ap as and, aq as anyVar, ar as app, as as applyCallbackAbs, at as asAbs, au as asAbsVal, av as betaOf, aw as bindImports, ax as bool, ay as boolLit, az as callTranspiledExport, aA as callTranspiledExportFull, aB as clearBClasses, aC as collectAbsExports, aD as confJoin, aE as createHofCollectCtx, aF as currentExecPhi, aG as emptyPhi, aH as eq, aI as ge, aJ as geNum, aK as getAbsOrigin, aL as getBCallCollector, aM as getBClass, aN as gt, aO as gtNum, aP as implies, aQ as instantiateReturn, aR as isDefinitelyFalse, aS as isDefinitelyTrue, aT as isExactLit, aU as isNudoThrow, aV as isNumPrim, aW as isRelFn, aX as isStrPrim, aY as le, aZ as leNum, a_ as lit, a$ as litTruth, b0 as litValue, b1 as lt, b2 as ltNum, b3 as mapElementFallback, b4 as namespaceNameOf, b5 as ne, b6 as never, b7 as not, b8 as noteMemberDispatchMiss, b9 as notePrimMemberMissing, ba as noteUnknownMemberMissing, bb as num, bc as numLit, bd as numVar, be as obj, bf as or, bg as pFalse, bh as pTrue, bi as phiAnd, bj as predEquals, bk as predToString, bl as predVars, bm as projectFlatMapResult, bn as promoteParamShape, bo as ptypeof, bp as recordMemberDiag, bq as registerBClass, br as runTranspiled, bs as setApplyCallbackHost, bt as setBCallCollector, bu as setMemberDiagCollector, bv as shapeOfTerm, bw as shapeToString, bx as simplifyTerm, by as snapshotAbs, bz as str, bA as strLit, bB as substAbs, bC as substPred, bD as substPredAbs, bE as tagAbsOrigin, bF as termEquals, bG as termToString, bH as transpile, bI as transpileExpression, bJ as transpileFile, bK as transpileSource, bL as tryPromoteDirectCall, bM as tryPromoteForOfIteratee, bN as tryPromoteHofCallback, bO as tryPromoteReceiverAsArr, bP as undefAbs, bQ as unknown, bR as v, bS as withExecPhi } from './index-OfNo5qlN.js';
|
|
4
4
|
|
|
5
5
|
type Environment = {
|
|
6
|
-
lookup(name: string):
|
|
7
|
-
bind(name: string, value:
|
|
8
|
-
update(name: string, value:
|
|
9
|
-
extend(bindings: Record<string,
|
|
6
|
+
lookup(name: string): Abs;
|
|
7
|
+
bind(name: string, value: Abs): Environment;
|
|
8
|
+
update(name: string, value: Abs): boolean;
|
|
9
|
+
extend(bindings: Record<string, Abs>): Environment;
|
|
10
10
|
fork(): Environment;
|
|
11
11
|
has(name: string): boolean;
|
|
12
12
|
snapshot(): Environment;
|
|
13
|
-
getOwnBindings(): Record<string,
|
|
13
|
+
getOwnBindings(): Record<string, Abs>;
|
|
14
14
|
};
|
|
15
|
-
declare function createEnvironment(parent?: Environment, bindings?: Map<string,
|
|
16
|
-
|
|
17
|
-
type LiteralValue = string | number | boolean | bigint | null | undefined;
|
|
18
|
-
type SigImpl = (args: TypeValue[], thisVal?: TypeValue) => TypeValue | undefined;
|
|
19
|
-
type FunctionSignature = {
|
|
20
|
-
paramTypes: TypeValue[];
|
|
21
|
-
returnType: TypeValue;
|
|
22
|
-
throwsType: TypeValue;
|
|
23
|
-
impl?: SigImpl;
|
|
24
|
-
};
|
|
25
|
-
type Refinement = {
|
|
26
|
-
name: string;
|
|
27
|
-
meta: Record<string, unknown>;
|
|
28
|
-
check?: (value: unknown) => boolean;
|
|
29
|
-
ops?: Record<string, (self: TypeValue, other: TypeValue) => TypeValue | undefined>;
|
|
30
|
-
methods?: Record<string, (self: TypeValue, args: TypeValue[]) => TypeValue | undefined>;
|
|
31
|
-
properties?: Record<string, (self: TypeValue) => TypeValue | undefined>;
|
|
32
|
-
};
|
|
33
|
-
type TypeValue = {
|
|
34
|
-
kind: "literal";
|
|
35
|
-
value: LiteralValue;
|
|
36
|
-
} | {
|
|
37
|
-
kind: "primitive";
|
|
38
|
-
type: "number" | "string" | "boolean" | "bigint" | "symbol";
|
|
39
|
-
} | {
|
|
40
|
-
kind: "refined";
|
|
41
|
-
base: TypeValue;
|
|
42
|
-
refinement: Refinement;
|
|
43
|
-
} | {
|
|
44
|
-
kind: "object";
|
|
45
|
-
properties: Record<string, TypeValue>;
|
|
46
|
-
id: symbol;
|
|
47
|
-
} | {
|
|
48
|
-
kind: "array";
|
|
49
|
-
element: TypeValue;
|
|
50
|
-
} | {
|
|
51
|
-
kind: "tuple";
|
|
52
|
-
elements: TypeValue[];
|
|
53
|
-
} | {
|
|
54
|
-
kind: "function";
|
|
55
|
-
params: string[];
|
|
56
|
-
body: Node;
|
|
57
|
-
closure: Environment;
|
|
58
|
-
} | {
|
|
59
|
-
kind: "promise";
|
|
60
|
-
value: TypeValue;
|
|
61
|
-
} | {
|
|
62
|
-
kind: "instance";
|
|
63
|
-
className: string;
|
|
64
|
-
properties: Record<string, TypeValue>;
|
|
65
|
-
} | {
|
|
66
|
-
kind: "union";
|
|
67
|
-
members: TypeValue[];
|
|
68
|
-
} | {
|
|
69
|
-
kind: "never";
|
|
70
|
-
} | {
|
|
71
|
-
kind: "unknown";
|
|
72
|
-
};
|
|
73
|
-
declare function createUnion(...members: TypeValue[]): TypeValue;
|
|
74
|
-
declare const T: {
|
|
75
|
-
readonly literal: (value: LiteralValue) => TypeValue;
|
|
76
|
-
readonly number: TypeValue;
|
|
77
|
-
readonly string: TypeValue;
|
|
78
|
-
readonly boolean: TypeValue;
|
|
79
|
-
readonly bigint: TypeValue;
|
|
80
|
-
readonly symbol: TypeValue;
|
|
81
|
-
readonly null: TypeValue;
|
|
82
|
-
readonly undefined: TypeValue;
|
|
83
|
-
readonly unknown: TypeValue;
|
|
84
|
-
readonly never: TypeValue;
|
|
85
|
-
readonly object: (properties: Record<string, TypeValue>) => TypeValue;
|
|
86
|
-
readonly array: (element: TypeValue) => TypeValue;
|
|
87
|
-
readonly tuple: (elements: TypeValue[]) => TypeValue;
|
|
88
|
-
readonly promise: (value: TypeValue) => TypeValue;
|
|
89
|
-
readonly instanceOf: (className: string, properties?: Record<string, TypeValue>) => TypeValue;
|
|
90
|
-
readonly union: typeof createUnion;
|
|
91
|
-
readonly fn: (params: string[], body: Node, closure: Environment) => TypeValue;
|
|
92
|
-
readonly refine: (base: TypeValue, refinement: Refinement) => TypeValue;
|
|
93
|
-
readonly fnSig: (paramTypes: TypeValue[], returnType: TypeValue, throwsType?: TypeValue, impl?: SigImpl) => TypeValue;
|
|
94
|
-
};
|
|
95
|
-
declare function typeValueEquals(a: TypeValue, b: TypeValue): boolean;
|
|
96
|
-
declare function simplifyUnion(members: TypeValue[]): TypeValue;
|
|
97
|
-
declare function widenLiteral(tv: TypeValue): TypeValue;
|
|
98
|
-
/**
|
|
99
|
-
* union 成员全部为同原语基底的字面量且数量 > maxLiterals 时塌缩为该基类型;
|
|
100
|
-
* 非 union、混合类型、或数量不超限的原样返回。
|
|
101
|
-
*
|
|
102
|
-
* 复用 simplifyUnion(内含吸收律与去重):先让「基类型已在场」的字面量被吸收
|
|
103
|
-
* (3 | number → number),再对剩余的纯字面量联合做阈值坍缩(1|2|…|20 → number)。
|
|
104
|
-
* 两步不冲突也不重复:吸收只删基类型已在场的字面量,阈值坍缩只处理无基类型
|
|
105
|
-
* 在场的纯字面量联合。
|
|
106
|
-
*/
|
|
107
|
-
declare function collapseLiteralUnion(tv: TypeValue, maxLiterals: number): TypeValue;
|
|
108
|
-
declare function isSubtypeOf(a: TypeValue, b: TypeValue): boolean;
|
|
109
|
-
declare function deepCloneTypeValue(tv: TypeValue, idMap?: Map<symbol, symbol>): TypeValue;
|
|
110
|
-
declare function mergeObjectProperties(a: TypeValue & {
|
|
111
|
-
kind: "object";
|
|
112
|
-
}, b: TypeValue & {
|
|
113
|
-
kind: "object";
|
|
114
|
-
}): TypeValue;
|
|
115
|
-
declare function typeValueToString(tv: TypeValue): string;
|
|
116
|
-
declare function narrowType(tv: TypeValue, predicate: (member: TypeValue) => boolean): TypeValue;
|
|
117
|
-
declare function subtractType(tv: TypeValue, predicate: (member: TypeValue) => boolean): TypeValue;
|
|
118
|
-
declare function getPrimitiveTypeOf(tv: TypeValue): string | undefined;
|
|
119
|
-
declare function getRefinedBase(tv: TypeValue): TypeValue;
|
|
120
|
-
declare function isFnSig(tv: TypeValue): boolean;
|
|
121
|
-
declare function getFnSig(tv: TypeValue): FunctionSignature | undefined;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* 残差 IR 兜底(不是类型运算真理源)。
|
|
125
|
-
*
|
|
126
|
-
* 真理在 algebra:算术/比较/相等/typeof/!/−/字符串词法序/nullish 均走 Abs。
|
|
127
|
-
* 这里只保留:
|
|
128
|
-
* - add:代数拒绝时的混合 `+`
|
|
129
|
-
* - 比较/相等:代数无法判定时的保守 boolean / 字面量折叠
|
|
130
|
-
* - dispatchMethod/Property:宿主 refined 扩展(startsWith、length…)
|
|
131
|
-
*/
|
|
132
|
-
|
|
133
|
-
declare const Ops: {
|
|
134
|
-
readonly add: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
135
|
-
readonly strictEq: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
136
|
-
readonly strictNeq: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
137
|
-
readonly gt: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
138
|
-
readonly lt: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
139
|
-
readonly gte: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
140
|
-
readonly lte: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
141
|
-
readonly not: (operand: TypeValue) => TypeValue;
|
|
142
|
-
};
|
|
143
|
-
declare function applyBinaryOp(op: string, left: TypeValue, right: TypeValue): TypeValue;
|
|
144
|
-
declare function dispatchBinaryOp(op: string, left: TypeValue, right: TypeValue): TypeValue;
|
|
145
|
-
declare function dispatchMethod(receiver: TypeValue, name: string, args: TypeValue[]): TypeValue | undefined;
|
|
146
|
-
declare function dispatchProperty(receiver: TypeValue, name: string): TypeValue | undefined;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* 模板字面量谓词,独立于 template.ts 以断开运行时循环引用:
|
|
150
|
-
* type-value.ts(联合吸收律)与 template.ts 都依赖本模块,而本模块对
|
|
151
|
-
* type-value.ts 只有 `import type` 边(编译后消失),运行时依赖保持单向
|
|
152
|
-
* type-value.ts / template.ts -> template-predicates.ts。
|
|
153
|
-
*/
|
|
154
|
-
declare function isTemplate(tv: TypeValue): boolean;
|
|
155
|
-
|
|
156
|
-
declare function createTemplate(parts: TypeValue[]): TypeValue;
|
|
157
|
-
|
|
158
|
-
declare function getTemplateParts(tv: TypeValue): TypeValue[] | undefined;
|
|
159
|
-
declare function concatTemplates(left: TypeValue, right: TypeValue): TypeValue;
|
|
160
|
-
|
|
161
|
-
type RangeMeta = {
|
|
162
|
-
min?: number;
|
|
163
|
-
max?: number;
|
|
164
|
-
/** 下界开区间:value > min(JS 实数,不能写成 >= min+1) */
|
|
165
|
-
minExclusive?: boolean;
|
|
166
|
-
/** 上界开区间:value < max */
|
|
167
|
-
maxExclusive?: boolean;
|
|
168
|
-
integer?: boolean;
|
|
169
|
-
};
|
|
170
|
-
declare function createRange(meta: RangeMeta): TypeValue;
|
|
171
|
-
declare function isRange(tv: TypeValue): boolean;
|
|
172
|
-
declare function getRangeMeta(tv: TypeValue): RangeMeta | undefined;
|
|
15
|
+
declare function createEnvironment(parent?: Environment, bindings?: Map<string, Abs>): Environment;
|
|
173
16
|
|
|
174
17
|
/**
|
|
175
18
|
* Nudo Mock 帮助函数
|
|
176
19
|
*
|
|
177
|
-
* 提供类型安全的 mock 创建,替代 sinon
|
|
20
|
+
* 提供类型安全的 mock 创建,替代 sinon 表达式。
|
|
21
|
+
* 值字段为 Abs(类型系统真理源)。
|
|
22
|
+
* Abs 路径经 mock-abs.ts / mockDirectivesToAbsSeeds 消费。
|
|
178
23
|
*/
|
|
179
24
|
|
|
180
25
|
type MockHelper = {
|
|
181
26
|
kind: "mock-helper";
|
|
182
|
-
returnValue?:
|
|
183
|
-
resolvedValue?:
|
|
184
|
-
rejectedValue?:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
onSecondCallValue?: TypeValue;
|
|
27
|
+
returnValue?: Abs;
|
|
28
|
+
resolvedValue?: Abs;
|
|
29
|
+
rejectedValue?: Abs;
|
|
30
|
+
onFirstCallValue?: Abs;
|
|
31
|
+
onSecondCallValue?: Abs;
|
|
188
32
|
withArgsCases?: {
|
|
189
|
-
args:
|
|
190
|
-
returnValue:
|
|
33
|
+
args: Abs[];
|
|
34
|
+
returnValue: Abs;
|
|
191
35
|
}[];
|
|
192
|
-
|
|
36
|
+
/** callsFake 的函数体(AST);params 同步存下供 Abs absFunction */
|
|
37
|
+
callsFakeImpl?: {
|
|
38
|
+
params: string[];
|
|
39
|
+
body: Node;
|
|
40
|
+
async?: boolean;
|
|
41
|
+
};
|
|
193
42
|
};
|
|
194
43
|
/**
|
|
195
44
|
* 创建一个 stub mock
|
|
@@ -197,13 +46,17 @@ type MockHelper = {
|
|
|
197
46
|
*/
|
|
198
47
|
declare function stub(): MockHelper;
|
|
199
48
|
declare namespace stub {
|
|
200
|
-
var returns: (value:
|
|
201
|
-
var resolves: (value:
|
|
202
|
-
var rejects: (value:
|
|
203
|
-
var onFirstCall: (value:
|
|
204
|
-
var onSecondCall: (value:
|
|
205
|
-
var withArgs: (...args:
|
|
206
|
-
var callsFake: (fn:
|
|
49
|
+
var returns: (value: Abs) => MockHelper;
|
|
50
|
+
var resolves: (value: Abs) => MockHelper;
|
|
51
|
+
var rejects: (value: Abs) => MockHelper;
|
|
52
|
+
var onFirstCall: (value: Abs) => MockHelper;
|
|
53
|
+
var onSecondCall: (value: Abs) => MockHelper;
|
|
54
|
+
var withArgs: (...args: Abs[]) => MockHelper;
|
|
55
|
+
var callsFake: (fn: {
|
|
56
|
+
params: string[];
|
|
57
|
+
body: Node;
|
|
58
|
+
async?: boolean;
|
|
59
|
+
}) => MockHelper;
|
|
207
60
|
}
|
|
208
61
|
/**
|
|
209
62
|
* 创建一个 spy mock
|
|
@@ -211,17 +64,13 @@ declare namespace stub {
|
|
|
211
64
|
*/
|
|
212
65
|
declare function spy(): MockHelper;
|
|
213
66
|
declare namespace spy {
|
|
214
|
-
var returns: (value:
|
|
67
|
+
var returns: (value: Abs) => MockHelper;
|
|
215
68
|
}
|
|
216
69
|
/**
|
|
217
70
|
* 创建一个 mock
|
|
218
71
|
* 用法: @nudo:mock service = mock()
|
|
219
72
|
*/
|
|
220
73
|
declare function mock(): MockHelper;
|
|
221
|
-
/**
|
|
222
|
-
* 将 MockHelper 转换为 TypeValue
|
|
223
|
-
*/
|
|
224
|
-
declare function mockHelperToTypeValue(helper: MockHelper, env: Environment): TypeValue;
|
|
225
74
|
|
|
226
75
|
/**
|
|
227
76
|
* 原地剥除 AST 中的 TS-only 语法节点/字段,返回同一棵 AST(便于链式使用)。
|
|
@@ -256,6 +105,8 @@ declare function describePhi(): string;
|
|
|
256
105
|
* 与 term-registry 同一纪律:不给共享单例挂 impl。
|
|
257
106
|
*/
|
|
258
107
|
|
|
108
|
+
/** Abs 原生 env/builtin 实现(B-path 优先) */
|
|
109
|
+
type AbsSigImpl = (args: Abs[], thisVal?: Abs) => Abs | undefined;
|
|
259
110
|
type AbsFnImpl = {
|
|
260
111
|
params: string[];
|
|
261
112
|
/** 可选:无 body 时走 relation(纯关系 fn) */
|
|
@@ -501,6 +352,7 @@ declare function joinObjects(a: Abs, b: Abs): Abs;
|
|
|
501
352
|
/** 值级 join:字面量保留为… Phase A 对 prim 做 term 保留策略 */
|
|
502
353
|
declare function joinValues(a: Abs, b: Abs): Abs;
|
|
503
354
|
declare function makeSum(a: Abs, b: Abs): Abs;
|
|
355
|
+
declare function absShapeKey(a: Abs, seen?: Set<object>): string;
|
|
504
356
|
type FnAbs = Abs & {
|
|
505
357
|
shape: {
|
|
506
358
|
k: "fn";
|
|
@@ -559,6 +411,13 @@ type EvalOptions = {
|
|
|
559
411
|
file?: File;
|
|
560
412
|
/** host 已求值的相对依赖导出表 */
|
|
561
413
|
modules?: Record<string, AbsModuleExports>;
|
|
414
|
+
/** host 注入(@nudo:mock 等)在求值前绑定(evalSource 也认) */
|
|
415
|
+
seedVars?: Record<string, Abs>;
|
|
416
|
+
seedFns?: Record<string, {
|
|
417
|
+
params: string[];
|
|
418
|
+
body: Node;
|
|
419
|
+
async?: boolean;
|
|
420
|
+
}>;
|
|
562
421
|
};
|
|
563
422
|
declare const MAX_CALL_DEPTH = 64;
|
|
564
423
|
declare const MAX_TOTAL_CALLS = 200000;
|
|
@@ -577,7 +436,8 @@ type AbsCallRecord = {
|
|
|
577
436
|
};
|
|
578
437
|
threw?: boolean;
|
|
579
438
|
};
|
|
580
|
-
|
|
439
|
+
/** 设置收集器并返回先前值(嵌套/并发宿主须 restore,勿直接置 null) */
|
|
440
|
+
declare function setAbsCallCollector(collector: ((r: AbsCallRecord) => void) | null): ((r: AbsCallRecord) => void) | null;
|
|
581
441
|
declare function setAbsNodeCollector(collector: ((node: Node, value: Abs) => void) | null): void;
|
|
582
442
|
/** 赋值记录:结构可赋值检查用 */
|
|
583
443
|
type AbsAssignRecord = {
|
|
@@ -602,6 +462,11 @@ type EvalResult = {
|
|
|
602
462
|
cont?: boolean;
|
|
603
463
|
/** throw 了 value(未捕获时向上传播) */
|
|
604
464
|
threw?: boolean;
|
|
465
|
+
/** throw 语句源位置(1-based line,0-based column;Babel loc 口径) */
|
|
466
|
+
throwLoc?: {
|
|
467
|
+
line: number;
|
|
468
|
+
column: number;
|
|
469
|
+
};
|
|
605
470
|
/**
|
|
606
471
|
* if 无 else 且 consequent 已 return/throw:真分支已产出 value,
|
|
607
472
|
* 假分支 fall-through 仍可能走后续语句。evalBlock 需与后续结果 join。
|
|
@@ -617,6 +482,18 @@ declare function evalSource(source: string, entry: {
|
|
|
617
482
|
fn: string;
|
|
618
483
|
args: Abs[];
|
|
619
484
|
}, opts?: EvalOptions): EvalResult;
|
|
485
|
+
/**
|
|
486
|
+
* 调用具名函数并返回 throws/loc(T20)。
|
|
487
|
+
* threw 时 result=never、throws=抛出值、throwLoc=throw 语句位置。
|
|
488
|
+
*/
|
|
489
|
+
declare function callFunctionFull(env: AstEnv, name: string, args: Abs[], phi?: Phi, budget?: LeakBudget): {
|
|
490
|
+
result: Abs;
|
|
491
|
+
throws: Abs;
|
|
492
|
+
throwLoc?: {
|
|
493
|
+
line: number;
|
|
494
|
+
column: number;
|
|
495
|
+
};
|
|
496
|
+
};
|
|
620
497
|
declare function callFunction(env: AstEnv, name: string, args: Abs[], phi?: Phi, budget?: LeakBudget): Abs;
|
|
621
498
|
/**
|
|
622
499
|
* 在 this=receiver 下求值方法体。
|
|
@@ -647,6 +524,18 @@ declare function applyAbsFn(fnVal: Abs, args: Abs[], env: AstEnv, phi: Phi, budg
|
|
|
647
524
|
* `, "scale", [numVar("x", gtNum(v("x"), 0))], gtNum(v("x"), 0))
|
|
648
525
|
*/
|
|
649
526
|
declare function analyzeFn(source: string, fnName: string, args: Abs[], phi?: Phi, budget?: LeakBudget, file?: File, modules?: Record<string, AbsModuleExports>): Abs;
|
|
527
|
+
/**
|
|
528
|
+
* analyzeFn 的 throws/loc 感知版(T19/T20):threw 时 result=never、throws=抛出值。
|
|
529
|
+
* 供 case 兜底在 B-path 失败时仍可无损拿 throws+loc,不经 TypeValue evaluateFunctionFull。
|
|
530
|
+
*/
|
|
531
|
+
declare function analyzeFnFull(source: string, fnName: string, args: Abs[], opts?: EvalOptions): {
|
|
532
|
+
result: Abs;
|
|
533
|
+
throws: Abs;
|
|
534
|
+
throwLoc?: {
|
|
535
|
+
line: number;
|
|
536
|
+
column: number;
|
|
537
|
+
};
|
|
538
|
+
};
|
|
650
539
|
/**
|
|
651
540
|
* 程序级 Abs 求值:注册全部顶层函数/class,再顺序执行语句。
|
|
652
541
|
* 返回最终 env(vars 含导出绑定)。TypeValue 仅在调用方 bridge 时出现。
|
|
@@ -984,10 +873,10 @@ type InterfaceSource = "handwritten" | "generated" | "implicit";
|
|
|
984
873
|
*/
|
|
985
874
|
declare function localNamedExports(source: string): Set<string>;
|
|
986
875
|
/**
|
|
987
|
-
*
|
|
988
|
-
*
|
|
989
|
-
*
|
|
990
|
-
*
|
|
876
|
+
* 侧车源码的生成段导出名:export 之前(跳过紧邻的 import/const 链)的注释
|
|
877
|
+
* 行含 `@generated` → 该名为 generated。组合式下行段(§5.3)形态为
|
|
878
|
+
* `import` + `@generated 头` + prelude + export;callsite 段则是头紧贴
|
|
879
|
+
* export。隔了其他代码行 / 无标记 / re-export 列表均不算。
|
|
991
880
|
*/
|
|
992
881
|
declare function generatedExportNames(sidecarSrc: string): Set<string>;
|
|
993
882
|
type EffectiveInterfaceOpts = RefineResolveOpts & {
|
|
@@ -1162,7 +1051,7 @@ declare function formatDiagnostics(diags: Diagnostic[]): string;
|
|
|
1162
1051
|
*
|
|
1163
1052
|
* 本模块是模板语义的唯一真理源:前缀/后缀/固定文本/长度/匹配/名称渲染/
|
|
1164
1053
|
* 相邻合并/谓词判定等纯计算以「中性 part 视图」(TemplatePartView)暴露;
|
|
1165
|
-
*
|
|
1054
|
+
* Abs 方法表(methods.ts)只做薄适配。
|
|
1166
1055
|
*/
|
|
1167
1056
|
|
|
1168
1057
|
type TemplateMeta = {
|
|
@@ -1197,7 +1086,7 @@ declare function formatTemplateNameViews(views: TemplatePartView[]): string;
|
|
|
1197
1086
|
declare function mergeAdjacentFixedViews<P>(views: TemplatePartView<P>[], rebuildFixed: (text: string) => TemplatePartView<P>): TemplatePartView<P>[];
|
|
1198
1087
|
/** 具体字符串是否匹配模板(Refinement.check 的判定语义) */
|
|
1199
1088
|
declare function templateMatchesValue(value: string, views: TemplatePartView[]): boolean;
|
|
1200
|
-
/**
|
|
1089
|
+
/** 三值判定;Abs 方法表把 "unknown" 适配为 boolPrim */
|
|
1201
1090
|
type TemplatePredicateDecision = boolean | "unknown";
|
|
1202
1091
|
declare function decideStartsWith(prefix: string, search: string): TemplatePredicateDecision;
|
|
1203
1092
|
declare function decideEndsWith(suffix: string, search: string): TemplatePredicateDecision;
|
|
@@ -1496,28 +1385,6 @@ declare function collectAbsInlays(source: string, refineOpts?: {
|
|
|
1496
1385
|
/** Abs 上的运行时守卫表达式(JS boolean 布尔串) */
|
|
1497
1386
|
declare function denoteGuard(a: Abs, v: string): string;
|
|
1498
1387
|
|
|
1499
|
-
/**
|
|
1500
|
-
* Abs ⇄ TypeValue 桥。
|
|
1501
|
-
*
|
|
1502
|
-
* 纪律:
|
|
1503
|
-
* - absToTypeValue 有损:丢 term/pred 时 conf 降为 widened,禁止假装 exact
|
|
1504
|
-
* - typeValueToAbs 尽量恢复 term=lit
|
|
1505
|
-
* - 下游(dts/lsp/service)吃 TypeValue;代数运算吃 Abs
|
|
1506
|
-
*/
|
|
1507
|
-
|
|
1508
|
-
declare function setTvConfidence(tv: TypeValue, conf: Confidence): void;
|
|
1509
|
-
declare function getTvConfidence(tv: TypeValue): Confidence | undefined;
|
|
1510
|
-
/**
|
|
1511
|
-
* Abs → TypeValue(给下游)。
|
|
1512
|
-
* 有损:非 lit term 丢弃;pred 尽量 encode 成 refined,否则丢。
|
|
1513
|
-
*/
|
|
1514
|
-
declare function absToTypeValue(a: Abs): TypeValue;
|
|
1515
|
-
/**
|
|
1516
|
-
* TypeValue → Abs(给代数运算)。
|
|
1517
|
-
* 置信度:优先读 abs→tv 时挂上的 conf 旁路,避免 #widened 回升 #exact。
|
|
1518
|
-
*/
|
|
1519
|
-
declare function typeValueToAbs(tv: TypeValue): Abs;
|
|
1520
|
-
|
|
1521
1388
|
/**
|
|
1522
1389
|
* Abs → NudoConstraint 投影(Phase 1,interface 分层推导的生成侧半边)。
|
|
1523
1390
|
*
|
|
@@ -1556,6 +1423,93 @@ declare function absToConstraint(a: Abs): NudoConstraint | undefined;
|
|
|
1556
1423
|
*/
|
|
1557
1424
|
declare function joinThenProject(absList: Abs[]): NudoConstraint | undefined;
|
|
1558
1425
|
|
|
1426
|
+
/**
|
|
1427
|
+
* 推导图(derivation trace)side-channel(design-refine-derivation §14.3#6 / §11 Phase 2)。
|
|
1428
|
+
*
|
|
1429
|
+
* 不叫 provenance:`setProvenanceTracking` 已被 evaluator 的 TypeValue origin map
|
|
1430
|
+
* 占用。机制对齐 `setCallCollector` / `setAbsTruncationCollector` 先例——
|
|
1431
|
+
* **不进 Abs payload**;ast-eval 与 B-path 共用 core ops(`add` / `joinAbs`),
|
|
1432
|
+
* 两条路径天然都覆盖。
|
|
1433
|
+
*
|
|
1434
|
+
* 设计原则:emit 打印的是推导图的投影,**禁止**事后从最终 Abs 反编译 shift 链。
|
|
1435
|
+
* 本模块在 ops 层打点:数值常量加法 → shift 边;joinAbs → join 边。
|
|
1436
|
+
* 根约束(手写契约参数)由宿主在入口 Abs 上打 root 标签。
|
|
1437
|
+
*/
|
|
1438
|
+
|
|
1439
|
+
/** 推导节点:边带调用位点 / +k / join;root 携带可打印的约束源表达式 */
|
|
1440
|
+
type DerivationNode = {
|
|
1441
|
+
id: number;
|
|
1442
|
+
kind: "root" | "shift" | "join" | "opaque";
|
|
1443
|
+
/** root:宿主给的可读约束表达式(`positive` / `number().gt(0)`) */
|
|
1444
|
+
expr?: string;
|
|
1445
|
+
/** root:跨文件 import 源(相对 specifier,相对 root 侧车目录) */
|
|
1446
|
+
importFrom?: string;
|
|
1447
|
+
/** root:import 绑定名(与 expr 一致时省略) */
|
|
1448
|
+
importName?: string;
|
|
1449
|
+
/** shift:数值偏移 */
|
|
1450
|
+
offset?: number;
|
|
1451
|
+
/** 父节点 id(root 无父) */
|
|
1452
|
+
parents: number[];
|
|
1453
|
+
};
|
|
1454
|
+
/** 调用位点上的实参推导(供 emit 投影组合式) */
|
|
1455
|
+
type ArgDerivation = {
|
|
1456
|
+
node: DerivationNode;
|
|
1457
|
+
/** 从该节点回溯到 root 的路径(含自身,root 在末尾) */
|
|
1458
|
+
chain: DerivationNode[];
|
|
1459
|
+
};
|
|
1460
|
+
type Collector = (node: DerivationNode) => void;
|
|
1461
|
+
/** 设置观察者(null 清除);缓冲照常累积 */
|
|
1462
|
+
declare function setDerivationCollector(fn: Collector | null): void;
|
|
1463
|
+
declare function hasDerivationSession(): boolean;
|
|
1464
|
+
/** 开始一次推导会话(root 驱动下行求值前调用);与 end/abort 成对 */
|
|
1465
|
+
declare function beginDerivationSession(): void;
|
|
1466
|
+
/** 结束会话并取走全部节点(顺序 = 创建序) */
|
|
1467
|
+
declare function endDerivationSession(): DerivationNode[];
|
|
1468
|
+
/** 丢弃当前会话(求值失败时) */
|
|
1469
|
+
declare function abortDerivationSession(): void;
|
|
1470
|
+
/**
|
|
1471
|
+
* 在入口 Abs 上打 root 标签:该值来自手写契约参数约束。
|
|
1472
|
+
* expr 是可打印源(`positive`);importFrom 指向共享模板侧车。
|
|
1473
|
+
*/
|
|
1474
|
+
declare function tagDerivationRoot(abs: Abs, meta: {
|
|
1475
|
+
expr: string;
|
|
1476
|
+
importFrom?: string;
|
|
1477
|
+
importName?: string;
|
|
1478
|
+
}): DerivationNode;
|
|
1479
|
+
/** 读取 Abs 上的推导节点(无标签 → undefined) */
|
|
1480
|
+
declare function getDerivation(abs: Abs): DerivationNode | undefined;
|
|
1481
|
+
/** 手动把推导挂到结果 Abs(宿主在 analyzeFn 返回值上补标签时用) */
|
|
1482
|
+
declare function setDerivation(abs: Abs, node: DerivationNode): void;
|
|
1483
|
+
/** 从节点回溯 root 路径(含自身;环/缺失截断) */
|
|
1484
|
+
declare function derivationChain(node: DerivationNode): DerivationNode[];
|
|
1485
|
+
/**
|
|
1486
|
+
* ops 层打点:`a + k`(k 为有限数值字面量)且 a 带推导 → 结果挂 shift 节点。
|
|
1487
|
+
* 由 arithmetic.add 在返回前调用;无会话/无父标签时 no-op。
|
|
1488
|
+
*/
|
|
1489
|
+
declare function noteDerivationAdd(a: Abs, b: Abs, result: Abs): void;
|
|
1490
|
+
/**
|
|
1491
|
+
* ops 层打点:join 结果挂 join 节点(任一侧有推导即可)。
|
|
1492
|
+
* 工件聚合路径会经 join;check 分轨不依赖 join 节点。
|
|
1493
|
+
*/
|
|
1494
|
+
declare function noteDerivationJoin(inputs: Abs[], result: Abs): void;
|
|
1495
|
+
/**
|
|
1496
|
+
* 把推导链投影为组合式(§2.4:写组合式,不展开)。
|
|
1497
|
+
*
|
|
1498
|
+
* 返回 prelude(`const x = positive.shift(1);`)+ expr(`x` / `x.shift(2)`)
|
|
1499
|
+
* + 需要的 import。无 root 锚或链上出现 join/opaque → undefined(调用方
|
|
1500
|
+
* 退回展开式投影或 not-projectable)。
|
|
1501
|
+
*/
|
|
1502
|
+
declare function projectDerivationDsl(node: DerivationNode, localName: string): {
|
|
1503
|
+
prelude: string[];
|
|
1504
|
+
expr: string;
|
|
1505
|
+
imports: Array<{
|
|
1506
|
+
name: string;
|
|
1507
|
+
from: string;
|
|
1508
|
+
}>;
|
|
1509
|
+
} | undefined;
|
|
1510
|
+
/** 项结构调试用(测试断言) */
|
|
1511
|
+
declare function termKey(t: Term | undefined): string;
|
|
1512
|
+
|
|
1559
1513
|
/**
|
|
1560
1514
|
* 源码级调用图侦察:从 check 门禁拆出的 AST 扫描层。
|
|
1561
1515
|
*
|
|
@@ -1567,13 +1521,13 @@ declare function joinThenProject(absList: Abs[]): NudoConstraint | undefined;
|
|
|
1567
1521
|
*/
|
|
1568
1522
|
|
|
1569
1523
|
/**
|
|
1570
|
-
*
|
|
1571
|
-
* service 的 CallRecord 声明,按结构兼容接收)。
|
|
1524
|
+
* 注入记录的最小结构面。Abs 为唯一真理源。
|
|
1572
1525
|
*/
|
|
1573
1526
|
type InjectedDomainRecord = {
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1527
|
+
/** 无损参数 Abs(必填;domain 证据唯一来源) */
|
|
1528
|
+
argAbs?: Abs[];
|
|
1529
|
+
resultAbs?: Abs;
|
|
1530
|
+
throwsAbs?: Abs;
|
|
1577
1531
|
};
|
|
1578
1532
|
type InjectedDomainEvidenceOpts = {
|
|
1579
1533
|
/** 被调函数形参名(位置序);契约按参数名对齐证据位 */
|
|
@@ -1598,15 +1552,14 @@ type InjectedDomainEvidenceOpts = {
|
|
|
1598
1552
|
*
|
|
1599
1553
|
* 证据门槛(§6):
|
|
1600
1554
|
* - 只有 plain literal 实参构成证据:union/unknown/primitive/refined 形态
|
|
1601
|
-
*
|
|
1602
|
-
*
|
|
1555
|
+
* 无法归因到确定值,不参与。Abs 路径直接读 `litValue` + conf
|
|
1556
|
+
* ∈ {exact, path}。
|
|
1603
1557
|
* - null 证据预过滤(T4 caveat:lit(null) 编码 prim undefined + eq(self,
|
|
1604
1558
|
* null),对任何约束恒不满足,不过滤必 FP);undefined/bigint/symbol
|
|
1605
1559
|
* 不在字面量证据域内,一并跳过;
|
|
1606
1560
|
* - resultType=never ∧ throws=never 是求值中断泄漏(analyzer 注入消费区
|
|
1607
|
-
*
|
|
1608
|
-
*
|
|
1609
|
-
* targetExport/targetAliases/fnModule 十项,无截断标记)——递归截断走
|
|
1561
|
+
* 同款过滤;有 resultAbs/throwsAbs 时同口径)。CallRecord 上没有截断字段
|
|
1562
|
+
* (查证于 evaluator.ts CallRecord 声明)——递归截断走
|
|
1610
1563
|
* nudo:recursion-truncated 诊断通道且只 widen 结果,不产生新字面量证据;
|
|
1611
1564
|
* - fn/shape/array 参数位 Phase 1 不执法(§3.3 HOF 豁免:
|
|
1612
1565
|
* literalMeetsConstraint 对这些形态恒 false,直接查必 FP)。
|
|
@@ -1615,4 +1568,4 @@ type InjectedDomainEvidenceOpts = {
|
|
|
1615
1568
|
*/
|
|
1616
1569
|
declare function checkInjectedDomainEvidence(fnName: string, source: string, records: InjectedDomainRecord[], opts: InjectedDomainEvidenceOpts): CheckIssue[];
|
|
1617
1570
|
|
|
1618
|
-
export { Abs, type AbsAssignRecord, type AbsCallRecord, type AbsFnImpl, type AbsInlay, AbsModuleExports, AstEnv, type CheckIssue, type CheckJson, type CheckOptions, type CheckReport, type ClassDef, Confidence, type ConstraintBuilder, type Diagnostic, type EffectiveInterface, type EffectiveInterfaceOpts, type Environment, type EvalOptions, type EvalResult, type FnAbs, type FnFp, type FormatOptions,
|
|
1571
|
+
export { Abs, type AbsAssignRecord, type AbsCallRecord, type AbsFnImpl, type AbsInlay, AbsModuleExports, type AbsSigImpl, type ArgDerivation, AstEnv, type CheckIssue, type CheckJson, type CheckOptions, type CheckReport, type ClassDef, Confidence, type ConstraintBuilder, type DerivationNode, type Diagnostic, type EffectiveInterface, type EffectiveInterfaceOpts, type Environment, type EvalOptions, type EvalResult, type FnAbs, type FnFp, type FormatOptions, HofSite, type InjectedDomainRecord, type InterfaceDiag, type InterfaceSource, type LeakBudget, type LeqResult, type LoadDepsFingerprint, MAX_CALL_DEPTH, MAX_TOTAL_CALLS, type MethodDef, type MockHelper, type NamedImport, type NudoConstraint, type NudoField, type NudoFnConstraint, NudoSidecarError, type NudoSig, type ObjShape, Phi, type PolyFn, Pred, PrimName, type RefineDiag, type RefineEntry, type RefineResolveOpts, RelSource, SELF, Shape, type Slot, type TemplateMeta, type TemplatePartDesc, type TemplatePartView, type TemplatePredicateDecision, Term, type TypeParam, abortDerivationSession, absFunction, absShapeKey, absTemplateViews, absToConstraint, add, allFixedTextOfViews, analyzeFn, analyzeFnFull, applyAbsFn, array, attachFnImpl, awaitAbs, beginDerivationSession, boolean, buildArgsFromAssume, callAbsMethod, callFunction, callFunctionFull, canSkipLiteralCallScan, checkArg, checkCall, checkInjectedDomainEvidence, checkSource, classFromMethods, cmp, coerceAsyncReturn, collectAbsInlays, collectAbsNodeTypes, concatString, constraintToEntryAbs, createEnvironment, createTemplateAbs, currentPhi, decideEndsWith, decideIncludes, decideStartsWith, defaultLeakBudget, defineClass, definitelyNotNullishShape, denoteGuard, derivationChain, describePhi, div, effectiveInterface, emptyEnv, endDerivationSession, evalArrayStatic, evalBuiltinInstanceMethod, evalBuiltinNew, evalDateCtor, evalDateMethod, evalDateStatic, evalGlobalFn, evalJsonMethod, evalMathMethod, evalMethodBody, evalNamespaceCall, evalNode, evalNumberStatic, evalObjectMethod, evalProgramAbs, evalPromiseCtor, evalPromiseStatic, evalRegExpCtor, evalRegExpMethod, evalSource, evictCheckSourceMemoForPaths, evictGeneralizeMemoForPaths, exceedsBudget, execNudoModule, extractAllLoadSpecs, extractFn, extractNudoImports, extractRefineReturnFromSource, extractRefinesFromSource, falseConstraint, findAbsAtPosition, fixedLengthOfViews, fn, fnConstraintToEntryReqs, fnFingerprints, fnOf, formatAbs, formatAbsMultiline, formatCheckReport, formatConstraint, formatDiagnostics, formatShape, formatShapeSlot, formatTemplateNameViews, generalizeAll, generalizeFromAst, generalizeSourceKeyPart, generatedExportNames, getAbsProperty, getClass, getClassChain, getDerivation, getFnImpl, getFnNameAndBodies, getGeneralizeMemoSize, getParseSourceCacheSize, getSlot, getTerm, hasDerivationSession, hashSource, instanceOf, instantiateClass, instantiateConstraint, interfaceDiagCount, isIntFlag, isNodeModulesPath, isNudoConstraint, isNullishLitAbs, isObj, isTemplateLike, joinAbs, joinFunctions, joinObjects, joinThenProject, joinValues, knownPrefixOfViews, knownSuffixOfViews, leakIfNeeded, lenTerm, leqAbs, listFunctionNames, literalMeetsConstraint, loadModuleDepsFingerprint, localNamedExports, lookupMethod, lookupMethodWithOwner, lookupSuperMethod, makeSum, matchRelIdentLit, maybeLeak, mergeAdjacentFixedViews, mock, mod, mul, negAbs, normPath, notAbs, noteDerivationAdd, noteDerivationJoin, number, objOf, omit, parseSource, partial, pick, popPhi, projectBrand, projectDerivationDsl, pushPhi, refineAbsForRelTrue, refineDiagCount, refineToIndexedFull, relationFingerprint, relationFn, resetAbsCallBudget, resetCheckSourceMemo, resetFnFpCache, resetGeneralizeMemo, resetHashSourceCache, resetLeakCounter, resetNudoModuleExecCache, resetParseSourceCache, resetPhi, resolveDepPath, serializeCheckJson, setAbsAssignCollector, setAbsCallCollector, setAbsNodeCollector, setAbsTruncationCollector, setDerivation, setDerivationCollector, setInterfaceDiagCollector, setRefineDiagCollector, shape, shapeOnlyFn, sidecarClosureFingerprint, sidecarPathOf, sidecarSpecsOf, spread, spy, stableAnalyzeKeySource, strictEqAbs, string, stripTypes, stub, sub, superNameOf, tagDerivationRoot, takeInterfaceDiags, takeInterfaceDiagsSince, takeRefineDiags, takeRefineDiagsSince, templateMatchesValue, templatePartsOf, termDepth, termKey, termNodes, trueConstraint, typeofAbs, union, viewTemplateParts, withPhiConstraint, withVar, wrapPromise };
|