@nudojs/core 1.0.1 → 2.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-P3G2TODS.js → chunk-6REHMIAE.js} +3331 -441
- package/dist/exec.d.ts +1 -1
- package/dist/exec.js +55 -1
- package/dist/{index-FITqyJ8v.d.ts → index-DxjxtxOJ.d.ts} +112 -18
- package/dist/index.d.ts +241 -14
- package/dist/index.js +819 -257
- package/package.json +1 -1
package/dist/exec.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { $ as $add, e as $arr, f as $
|
|
1
|
+
export { $ as $add, e as $arr, f as $arrMutContainer, g as $arrRest, h as $async, i as $asyncReturn, j as $await, k as $call, l as $callNamed, m as $catchVal, n as $class, o as $concat, p as $div, q as $elems, r as $eq, s as $eqLoose, t as $fnVal, u as $for, v as $forIter, w as $forOf, x as $fork, y as $ge, z as $gen, B as $get, D as $gt, E as $idx, F as $idxSet, G as $invoke, I as $invokeSuper, J as $isForkExit, K as $join, L as $le, M as $len, N as $lit, O as $loopReturn, Q as $lt, U as $mod, V as $mul, W as $ne, X as $neLoose, Y as $neg, Z as $new, _ as $not, a0 as $nullishTest, a1 as $obj, a2 as $objRest, a3 as $optionalGet, a4 as $optionalInvoke, a5 as $orDefault, a6 as $pushLoopExit, a7 as $regex, a8 as $rethrowIfNudoReturn, a9 as $set, aa as $setKey, ab as $spread, ac as $staticInvoke, ad as $sub, ae as $super, af as $switch, ag as $thisGet, ah as $thisSet, ai as $throw, aj as $tryCurrentMark, ak as $tryMark, al as $tryPopMark, am as $tryTakeSince, an as $typeof, ao as $while, ap as $whileSeq, aq as $yield, ar as BCallRecord, as as BClassSpec, at as BMemberDiag, au as DEFAULT_MAX_LOOP_ITERS, ax as NudoReturn, ay as NudoThrow, az as RunTranspiledOptions, aA as TranspileOptions, aB as TranspiledCallResult, aK as asAbsVal, aP as callAtFunctionBoundary, aQ as callTranspiledExport, aR as callTranspiledExportFull, aS as clearBClasses, aW as currentExecPhi, a$ as getAbsOrigin, b0 as getBCallCollector, b1 as getBClass, b6 as isArrMutator, b7 as isDefinitelyFalse, b8 as isDefinitelyTrue, b9 as isEvalMissingSlotEnabled, bb as isNudoReturn, bc as isNudoThrow, bj as litTruth, bo as namespaceNameOf, bs as noteMemberDispatchMiss, bt as noteObjSlotMissing, bu as notePrimMemberMissing, bv as noteUnknownMemberMissing, bK as pushLoopExit, bL as pushThrowExit, bM as recordMemberDiag, bN as registerBClass, bO as runTranspiled, bP as runWithEvalMissingSlot, bQ as runWithLoopExits, bS as setBCallCollector, bT as setEvalMissingSlotEnabled, bU as setMemberDiagCollector, c2 as tagAbsOrigin, c3 as takeLoopExits, c4 as takeThrowExits, c7 as transpile, c8 as transpileExpression, c9 as transpileFile, ca as transpileSource, ci as withExecPhi } from './index-DxjxtxOJ.js';
|
|
2
2
|
import '@babel/types';
|
package/dist/exec.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
$add,
|
|
3
3
|
$arr,
|
|
4
|
+
$arrMutContainer,
|
|
5
|
+
$arrRest,
|
|
4
6
|
$async,
|
|
5
7
|
$asyncReturn,
|
|
6
8
|
$await,
|
|
@@ -12,6 +14,7 @@ import {
|
|
|
12
14
|
$div,
|
|
13
15
|
$elems,
|
|
14
16
|
$eq,
|
|
17
|
+
$eqLoose,
|
|
15
18
|
$fnVal,
|
|
16
19
|
$for,
|
|
17
20
|
$forIter,
|
|
@@ -25,22 +28,29 @@ import {
|
|
|
25
28
|
$idxSet,
|
|
26
29
|
$invoke,
|
|
27
30
|
$invokeSuper,
|
|
31
|
+
$isForkExit,
|
|
28
32
|
$join,
|
|
29
33
|
$le,
|
|
30
34
|
$len,
|
|
31
35
|
$lit,
|
|
36
|
+
$loopReturn,
|
|
32
37
|
$lt,
|
|
33
38
|
$mod,
|
|
34
39
|
$mul,
|
|
35
40
|
$ne,
|
|
41
|
+
$neLoose,
|
|
36
42
|
$neg,
|
|
37
43
|
$new,
|
|
38
44
|
$not,
|
|
45
|
+
$nullishTest,
|
|
39
46
|
$obj,
|
|
47
|
+
$objRest,
|
|
40
48
|
$optionalGet,
|
|
41
49
|
$optionalInvoke,
|
|
42
50
|
$orDefault,
|
|
51
|
+
$pushLoopExit,
|
|
43
52
|
$regex,
|
|
53
|
+
$rethrowIfNudoReturn,
|
|
44
54
|
$set,
|
|
45
55
|
$setKey,
|
|
46
56
|
$spread,
|
|
@@ -51,13 +61,19 @@ import {
|
|
|
51
61
|
$thisGet,
|
|
52
62
|
$thisSet,
|
|
53
63
|
$throw,
|
|
64
|
+
$tryCurrentMark,
|
|
65
|
+
$tryMark,
|
|
66
|
+
$tryPopMark,
|
|
67
|
+
$tryTakeSince,
|
|
54
68
|
$typeof,
|
|
55
69
|
$while,
|
|
56
70
|
$whileSeq,
|
|
57
71
|
$yield,
|
|
58
72
|
DEFAULT_MAX_LOOP_ITERS,
|
|
73
|
+
NudoReturn,
|
|
59
74
|
NudoThrow,
|
|
60
75
|
asAbsVal,
|
|
76
|
+
callAtFunctionBoundary,
|
|
61
77
|
callTranspiledExport,
|
|
62
78
|
callTranspiledExportFull,
|
|
63
79
|
clearBClasses,
|
|
@@ -65,29 +81,42 @@ import {
|
|
|
65
81
|
getAbsOrigin,
|
|
66
82
|
getBCallCollector,
|
|
67
83
|
getBClass,
|
|
84
|
+
isArrMutator,
|
|
68
85
|
isDefinitelyFalse,
|
|
69
86
|
isDefinitelyTrue,
|
|
87
|
+
isEvalMissingSlotEnabled,
|
|
88
|
+
isNudoReturn,
|
|
70
89
|
isNudoThrow,
|
|
71
90
|
litTruth,
|
|
72
91
|
namespaceNameOf,
|
|
73
92
|
noteMemberDispatchMiss,
|
|
93
|
+
noteObjSlotMissing,
|
|
74
94
|
notePrimMemberMissing,
|
|
75
95
|
noteUnknownMemberMissing,
|
|
96
|
+
pushLoopExit,
|
|
97
|
+
pushThrowExit,
|
|
76
98
|
recordMemberDiag,
|
|
77
99
|
registerBClass,
|
|
78
100
|
runTranspiled,
|
|
101
|
+
runWithEvalMissingSlot,
|
|
102
|
+
runWithLoopExits,
|
|
79
103
|
setBCallCollector,
|
|
104
|
+
setEvalMissingSlotEnabled,
|
|
80
105
|
setMemberDiagCollector,
|
|
81
106
|
tagAbsOrigin,
|
|
107
|
+
takeLoopExits,
|
|
108
|
+
takeThrowExits,
|
|
82
109
|
transpile,
|
|
83
110
|
transpileExpression,
|
|
84
111
|
transpileFile,
|
|
85
112
|
transpileSource,
|
|
86
113
|
withExecPhi
|
|
87
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-6REHMIAE.js";
|
|
88
115
|
export {
|
|
89
116
|
$add,
|
|
90
117
|
$arr,
|
|
118
|
+
$arrMutContainer,
|
|
119
|
+
$arrRest,
|
|
91
120
|
$async,
|
|
92
121
|
$asyncReturn,
|
|
93
122
|
$await,
|
|
@@ -99,6 +128,7 @@ export {
|
|
|
99
128
|
$div,
|
|
100
129
|
$elems,
|
|
101
130
|
$eq,
|
|
131
|
+
$eqLoose,
|
|
102
132
|
$fnVal,
|
|
103
133
|
$for,
|
|
104
134
|
$forIter,
|
|
@@ -112,22 +142,29 @@ export {
|
|
|
112
142
|
$idxSet,
|
|
113
143
|
$invoke,
|
|
114
144
|
$invokeSuper,
|
|
145
|
+
$isForkExit,
|
|
115
146
|
$join,
|
|
116
147
|
$le,
|
|
117
148
|
$len,
|
|
118
149
|
$lit,
|
|
150
|
+
$loopReturn,
|
|
119
151
|
$lt,
|
|
120
152
|
$mod,
|
|
121
153
|
$mul,
|
|
122
154
|
$ne,
|
|
155
|
+
$neLoose,
|
|
123
156
|
$neg,
|
|
124
157
|
$new,
|
|
125
158
|
$not,
|
|
159
|
+
$nullishTest,
|
|
126
160
|
$obj,
|
|
161
|
+
$objRest,
|
|
127
162
|
$optionalGet,
|
|
128
163
|
$optionalInvoke,
|
|
129
164
|
$orDefault,
|
|
165
|
+
$pushLoopExit,
|
|
130
166
|
$regex,
|
|
167
|
+
$rethrowIfNudoReturn,
|
|
131
168
|
$set,
|
|
132
169
|
$setKey,
|
|
133
170
|
$spread,
|
|
@@ -138,13 +175,19 @@ export {
|
|
|
138
175
|
$thisGet,
|
|
139
176
|
$thisSet,
|
|
140
177
|
$throw,
|
|
178
|
+
$tryCurrentMark,
|
|
179
|
+
$tryMark,
|
|
180
|
+
$tryPopMark,
|
|
181
|
+
$tryTakeSince,
|
|
141
182
|
$typeof,
|
|
142
183
|
$while,
|
|
143
184
|
$whileSeq,
|
|
144
185
|
$yield,
|
|
145
186
|
DEFAULT_MAX_LOOP_ITERS,
|
|
187
|
+
NudoReturn,
|
|
146
188
|
NudoThrow,
|
|
147
189
|
asAbsVal,
|
|
190
|
+
callAtFunctionBoundary,
|
|
148
191
|
callTranspiledExport,
|
|
149
192
|
callTranspiledExportFull,
|
|
150
193
|
clearBClasses,
|
|
@@ -152,20 +195,31 @@ export {
|
|
|
152
195
|
getAbsOrigin,
|
|
153
196
|
getBCallCollector,
|
|
154
197
|
getBClass,
|
|
198
|
+
isArrMutator,
|
|
155
199
|
isDefinitelyFalse,
|
|
156
200
|
isDefinitelyTrue,
|
|
201
|
+
isEvalMissingSlotEnabled,
|
|
202
|
+
isNudoReturn,
|
|
157
203
|
isNudoThrow,
|
|
158
204
|
litTruth,
|
|
159
205
|
namespaceNameOf,
|
|
160
206
|
noteMemberDispatchMiss,
|
|
207
|
+
noteObjSlotMissing,
|
|
161
208
|
notePrimMemberMissing,
|
|
162
209
|
noteUnknownMemberMissing,
|
|
210
|
+
pushLoopExit,
|
|
211
|
+
pushThrowExit,
|
|
163
212
|
recordMemberDiag,
|
|
164
213
|
registerBClass,
|
|
165
214
|
runTranspiled,
|
|
215
|
+
runWithEvalMissingSlot,
|
|
216
|
+
runWithLoopExits,
|
|
166
217
|
setBCallCollector,
|
|
218
|
+
setEvalMissingSlotEnabled,
|
|
167
219
|
setMemberDiagCollector,
|
|
168
220
|
tagAbsOrigin,
|
|
221
|
+
takeLoopExits,
|
|
222
|
+
takeThrowExits,
|
|
169
223
|
transpile,
|
|
170
224
|
transpileExpression,
|
|
171
225
|
transpileFile,
|
|
@@ -157,6 +157,11 @@ type Abs = {
|
|
|
157
157
|
term?: Term;
|
|
158
158
|
pred?: Pred;
|
|
159
159
|
conf: Confidence;
|
|
160
|
+
/**
|
|
161
|
+
* C2.4:分支 join 可解释标注(如 `join(number | string)`)。
|
|
162
|
+
* 仅展示用:不进 leq / 指纹 / check 等价;formatAbs 读取。
|
|
163
|
+
*/
|
|
164
|
+
pathNote?: string;
|
|
160
165
|
};
|
|
161
166
|
declare const never: Abs;
|
|
162
167
|
/** 分析无信息 */
|
|
@@ -426,6 +431,9 @@ declare function $typeof(a: Abs): Abs;
|
|
|
426
431
|
declare function $not(a: Abs): Abs;
|
|
427
432
|
declare function $eq(a: Abs, b: Abs): Abs;
|
|
428
433
|
declare function $ne(a: Abs, b: Abs): Abs;
|
|
434
|
+
/** `==` / `!=`(C2.3):双字面量 Abstract Equality,否则回落严格判定 */
|
|
435
|
+
declare function $eqLoose(a: Abs, b: Abs): Abs;
|
|
436
|
+
declare function $neLoose(a: Abs, b: Abs): Abs;
|
|
429
437
|
declare function $lt(a: Abs, b: Abs): Abs;
|
|
430
438
|
declare function $le(a: Abs, b: Abs): Abs;
|
|
431
439
|
declare function $gt(a: Abs, b: Abs): Abs;
|
|
@@ -439,17 +447,37 @@ declare function $join(a: Abs, b: Abs): Abs;
|
|
|
439
447
|
* extractParamNames 回退口径一致);带真实参数名走 $fnVal(transpile 侧)。
|
|
440
448
|
*/
|
|
441
449
|
declare function asAbsVal(v: unknown): Abs;
|
|
442
|
-
/**
|
|
443
|
-
|
|
450
|
+
/**
|
|
451
|
+
* 函数调用边界:callee 的 loop/early-return 不得冒泡成 caller 结果。
|
|
452
|
+
* 每个 B 路径调用帧独立 ALS;NudoReturn 收成该调用的返回值。
|
|
453
|
+
*/
|
|
454
|
+
declare function callAtFunctionBoundary<T>(body: () => T): T;
|
|
455
|
+
/** 函数表达式 → 一等 fn Abs(transpile 侧带真实参数名;异步 body 包 $async)
|
|
456
|
+
* opts.bindThis:对象方法——$invoke 会把 receiver 作为 impl 首参注入。 */
|
|
457
|
+
declare function $fnVal(params: string[], impl: (...args: Abs[]) => Abs, opts?: {
|
|
458
|
+
bindThis?: boolean;
|
|
459
|
+
}): Abs;
|
|
444
460
|
/** 字面量 → Abs(transpile 侧数字/字符串/布尔/null/undefined) */
|
|
445
461
|
declare function $lit(v: unknown): Abs;
|
|
446
462
|
/** JS 真值:字面量按 Boolean(v);对象形恒真;不可判 → undefined */
|
|
447
463
|
declare function litTruth(a: Abs): boolean | undefined;
|
|
448
464
|
declare function isDefinitelyTrue(a: Abs): boolean;
|
|
449
465
|
declare function isDefinitelyFalse(a: Abs): boolean;
|
|
450
|
-
/**
|
|
451
|
-
|
|
452
|
-
|
|
466
|
+
/** 函数求值作用域:收集抽象分支上的 early-return / throw 值;try 标记栈同边界 */
|
|
467
|
+
declare function runWithLoopExits<T>(body: () => T): T;
|
|
468
|
+
declare function takeLoopExits(): Abs[];
|
|
469
|
+
declare function takeThrowExits(): Abs[];
|
|
470
|
+
declare function pushLoopExit(v: Abs): void;
|
|
471
|
+
declare function pushThrowExit(v: Abs): void;
|
|
472
|
+
/** transpile 生成代码用:`$pushLoopExit` */
|
|
473
|
+
declare function $pushLoopExit(v: Abs): void;
|
|
474
|
+
/** try 块开始:压栈并返回当前 throwExits 长度 */
|
|
475
|
+
declare function $tryMark(): number;
|
|
476
|
+
/** 当前最内层 try 的 mark(return 时 drain 用;嵌套调用不串栈) */
|
|
477
|
+
declare function $tryCurrentMark(): number;
|
|
478
|
+
declare function $tryPopMark(): void;
|
|
479
|
+
/** 取出 mark 之后新记录的 throw(try 吸收 / catch 合并) */
|
|
480
|
+
declare function $tryTakeSince(mark: number): Abs[];
|
|
453
481
|
declare function $fork(test: Abs, consequent: () => Abs, alternate?: () => Abs): Abs;
|
|
454
482
|
declare const DEFAULT_MAX_LOOP_ITERS = 8;
|
|
455
483
|
/**
|
|
@@ -465,9 +493,18 @@ declare function $forIter(init: Abs, test: (s: Abs) => Abs, step: (s: Abs) => Ab
|
|
|
465
493
|
* 有界 for:unroll ≤ maxIters,每步「可能退出」的态 join;
|
|
466
494
|
* 相邻态 leq 视为不动点提前停。
|
|
467
495
|
*/
|
|
468
|
-
declare function $for(init: Abs, test: (s: Abs) => Abs, step: (s: Abs) => Abs, body: (s: Abs) => Abs, maxIters?: number
|
|
496
|
+
declare function $for(init: Abs, test: (s: Abs) => Abs, step: (s: Abs) => Abs, body: (s: Abs) => Abs, maxIters?: number, opts?: {
|
|
497
|
+
pack?: () => Abs;
|
|
498
|
+
unpack?: (s: Abs) => void;
|
|
499
|
+
}): Abs;
|
|
469
500
|
/** 数组字面量 → ≤cap tuple(逐元素精确)/ >cap arr;策略与 ast-eval 同源(containers.ts) */
|
|
470
501
|
declare function $arr(items: Abs[]): Abs;
|
|
502
|
+
declare function isArrMutator(name: string): boolean;
|
|
503
|
+
/**
|
|
504
|
+
* C1.4 语句重绑:返回**变更后容器** Abs(不是 JS 返回值)。
|
|
505
|
+
* `a.pop()` 语句应把 `a` 绑成去掉末元的 tuple,而不是被移除的元素。
|
|
506
|
+
*/
|
|
507
|
+
declare function $arrMutContainer(arr: Abs, method: string, args: Abs[]): Abs;
|
|
471
508
|
/** 下标读 a[i];字面量 i 走 tuple 精确投影,否则并所有元素;string[i] → 单字符 */
|
|
472
509
|
declare function $idx(a: Abs, i: Abs): Abs;
|
|
473
510
|
/** 下标写 a[i]=v → 新 tuple(越界写按 JS 语义增长,空洞为 undefined) */
|
|
@@ -478,15 +515,28 @@ declare function $len(a: Abs): Abs;
|
|
|
478
515
|
declare function $obj(slots: Record<string, Abs>): Abs;
|
|
479
516
|
/** 对象展开 { ...a, b } */
|
|
480
517
|
declare function $spread(a: Abs, b: Abs): Abs;
|
|
518
|
+
/**
|
|
519
|
+
* 解构 rest:`const { a, ...rest } = o` → rest = o 去掉 named keys。
|
|
520
|
+
* closed obj:剩余槽 closed;open / optional 键:rest 仍 open(可能有未知键)。
|
|
521
|
+
*/
|
|
522
|
+
declare function $objRest(o: Abs, keys: string[]): Abs;
|
|
523
|
+
/** 数组 rest:`const [a, ...rest] = arr` → rest = 从 start 起的尾段 */
|
|
524
|
+
declare function $arrRest(a: Abs, start: number): Abs;
|
|
481
525
|
/** 数组连接 [...a, ...b] / [...a, x];结果超 cap 时与字面量同策略降 arr */
|
|
482
526
|
declare function $concat(a: Abs, b: Abs): Abs;
|
|
483
|
-
/** 元素列表(tuple 展开;arr
|
|
527
|
+
/** 元素列表(tuple 展开;arr 抽象;C1 Set/Map 逐条目)。
|
|
528
|
+
* Map 迭代语义是 entry `[key, value]` 元组,不是裸 value。 */
|
|
484
529
|
declare function $elems(a: Abs): Abs[];
|
|
485
530
|
/**
|
|
486
531
|
* for-of:对 iterable 每个元素跑 body;有界展开。
|
|
487
532
|
* body(item, i) 可返回 void;状态由外部 JS 变量承接。
|
|
533
|
+
* - 具体空 tuple:体 0 次(不得用 `length || maxIters` 展开成 maxIters)
|
|
534
|
+
* - 抽象 arr / 未知长度:0..maxIters 出口与 pack 状态 join
|
|
488
535
|
*/
|
|
489
|
-
declare function $forOf(iterable: Abs, body: (item: Abs, index: Abs) => void, maxIters?: number
|
|
536
|
+
declare function $forOf(iterable: Abs, body: (item: Abs, index: Abs) => void, maxIters?: number, opts?: {
|
|
537
|
+
pack?: () => Abs;
|
|
538
|
+
unpack?: (s: Abs) => void;
|
|
539
|
+
}): void;
|
|
490
540
|
/**
|
|
491
541
|
* 命名空间身份表:transpile 后 `Math.max(0, x)` 的接收者是宿主 JS 全局对象
|
|
492
542
|
* (非 Abs)。按对象身份识别命名空间,路由到 Abs builtin 表。
|
|
@@ -507,10 +557,25 @@ declare function $set(o: Abs, key: string, value: Abs): Abs;
|
|
|
507
557
|
declare function $while(init: Abs, test: (s: Abs) => Abs, step: (s: Abs) => Abs, maxIters?: number): Abs;
|
|
508
558
|
/**
|
|
509
559
|
* 顺序 while(具体/可变闭包):body 内对 JS 变量赋值。
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
*/
|
|
513
|
-
declare function $whileSeq(test: () => Abs, body: () => void, maxIters?: number
|
|
560
|
+
* 提供 pack/unpack 时,抽象条件的可能出口会 join 回绑定(P0 健全);
|
|
561
|
+
* 未 instrument 的调用保持旧语义(预算截断,文档已声明)。
|
|
562
|
+
*/
|
|
563
|
+
declare function $whileSeq(test: () => Abs, body: () => void, maxIters?: number, opts?: {
|
|
564
|
+
/** 把当前绑定收成 Abs 状态(transpile 注入) */
|
|
565
|
+
pack?: () => Abs;
|
|
566
|
+
/** 把 join 后的状态写回绑定 */
|
|
567
|
+
unpack?: (s: Abs) => void;
|
|
568
|
+
}): void;
|
|
569
|
+
/** B 路径「函数提前 return」信号(区别于 throw) */
|
|
570
|
+
declare class NudoReturn extends Error {
|
|
571
|
+
readonly absValue: Abs;
|
|
572
|
+
constructor(absValue: Abs);
|
|
573
|
+
}
|
|
574
|
+
/** transpile `return x` inside for/while → `$loopReturn(x)` */
|
|
575
|
+
declare function $loopReturn(v: Abs): never;
|
|
576
|
+
declare function isNudoReturn(e: unknown): e is NudoReturn;
|
|
577
|
+
/** catch 转译辅助:控制流信号透传(生成代码只注入 `$` 前缀符号) */
|
|
578
|
+
declare function $rethrowIfNudoReturn(e: unknown): void;
|
|
514
579
|
/** B 路径 throw 载荷:携带 Abs 抛出值 */
|
|
515
580
|
declare class NudoThrow extends Error {
|
|
516
581
|
readonly absValue: Abs;
|
|
@@ -519,7 +584,13 @@ declare class NudoThrow extends Error {
|
|
|
519
584
|
/** transpile `throw x` → `$throw(x)` */
|
|
520
585
|
declare function $throw(v: Abs): never;
|
|
521
586
|
declare function isNudoThrow(e: unknown): e is NudoThrow;
|
|
522
|
-
/**
|
|
587
|
+
/**
|
|
588
|
+
* fork 臂是否以控制流退出(return / throw)。
|
|
589
|
+
* 生成代码用此决定 continue-path free-write 标志:退出臂的写
|
|
590
|
+
* 不得污染 join 后的 continue 绑定。
|
|
591
|
+
*/
|
|
592
|
+
declare function $isForkExit(e: unknown): boolean;
|
|
593
|
+
/** catch 参数:从 NudoThrow 取出 Abs;宿主 Error 补 name/message;否则 unknown */
|
|
523
594
|
declare function $catchVal(e: unknown): Abs;
|
|
524
595
|
/**
|
|
525
596
|
* async 函数体包进 thunk,返回值经 wrapPromise。
|
|
@@ -529,17 +600,22 @@ declare function $async(thunk: () => Abs): Abs;
|
|
|
529
600
|
declare function $await(v: Abs): Abs;
|
|
530
601
|
/** async 直接 return 的 coerce */
|
|
531
602
|
declare function $asyncReturn(v: Abs): Abs;
|
|
532
|
-
/** function* 体:收集所有 yield 值为 tuple Abs */
|
|
603
|
+
/** function* 体:收集所有 yield 值为 tuple Abs;抽象分支时降 conf(P0-6) */
|
|
533
604
|
declare function $gen(body: () => void): Abs;
|
|
534
605
|
/** yield v:压入当前生成器收集器;表达式值用 unknown */
|
|
535
606
|
declare function $yield(v: Abs): Abs;
|
|
536
607
|
/**
|
|
537
608
|
* switch:具体 disc 选中匹配 case;抽象 disc 并所有分支。
|
|
609
|
+
* 抽象路径与 $fork 同构:集合 side-table 按臂 overlay,共享 body 只跑一次;
|
|
610
|
+
* 臂内 NudoReturn/NudoThrow 不冒泡污染兄弟臂。
|
|
611
|
+
* **无 default 时必须隐式 fall-through 臂(undef)**,否则无匹配路径被丢掉(P0-2)。
|
|
538
612
|
*/
|
|
539
613
|
declare function $switch(disc: Abs, cases: Array<{
|
|
540
614
|
test: Abs;
|
|
541
615
|
run: () => Abs;
|
|
542
616
|
}>, dflt?: () => Abs): Abs;
|
|
617
|
+
/** `??` / `??=` 测试:确定非 nullish → false;lit nullish → true;否则抽象 boolean */
|
|
618
|
+
declare function $nullishTest(v: Abs): Abs;
|
|
543
619
|
|
|
544
620
|
/**
|
|
545
621
|
* B 路径 transpile:JS AST → 可在 Node 上执行的抽象值程序(源码字符串)。
|
|
@@ -571,6 +647,12 @@ type TranspileOptions = {
|
|
|
571
647
|
stmtStart: number;
|
|
572
648
|
stmtEnd: number;
|
|
573
649
|
}>;
|
|
650
|
+
/** 循环嵌套深度(>0 时 return → $loopReturn,C2.1) */
|
|
651
|
+
inLoop?: number;
|
|
652
|
+
/** try 嵌套深度(>0 时 return 前 drain throwExits,使 catch 能吸收抽象 throw) */
|
|
653
|
+
inTry?: number;
|
|
654
|
+
/** 当前 try 的 mark 变量名(return drain 用;避免全局栈顶污染) */
|
|
655
|
+
tryMarkName?: string;
|
|
574
656
|
};
|
|
575
657
|
declare function transpileSource(source: string, opts?: TranspileOptions): string;
|
|
576
658
|
declare function transpileFile(file: File, opts?: TranspileOptions): string;
|
|
@@ -630,7 +712,7 @@ declare function $invoke(thisVal: Abs, method: string, args: Abs[], loc?: [numbe
|
|
|
630
712
|
declare function $invokeSuper(thisVal: Abs, childName: string, method: string, args: Abs[]): Abs;
|
|
631
713
|
declare function $thisGet(thisVal: Abs, key: string): Abs;
|
|
632
714
|
declare function $thisSet(thisVal: Abs, key: string, value: Abs): Abs;
|
|
633
|
-
/** 解构默认值:undefined
|
|
715
|
+
/** 解构默认值:undefined(含 sum 成员 / 可能缺失)时用 default 并入非 undefined 部分 */
|
|
634
716
|
declare function $orDefault(v: Abs, dflt: () => Abs): Abs;
|
|
635
717
|
/** 可选链 a?.b:nullish 短路为 undefined 字面量 */
|
|
636
718
|
declare function $optionalGet(o: Abs, key: string): Abs;
|
|
@@ -638,7 +720,7 @@ declare function $optionalGet(o: Abs, key: string): Abs;
|
|
|
638
720
|
declare function $optionalInvoke(thisVal: Abs, method: string, args: Abs[]): Abs;
|
|
639
721
|
/** 静态方法:cls.staticMethod(args) */
|
|
640
722
|
declare function $staticInvoke(cls: Abs, method: string, args: Abs[]): Abs;
|
|
641
|
-
/** 计算属性写:o[kAbs] = v */
|
|
723
|
+
/** 计算属性写:o[kAbs] = v。非字面量 key → open + index join(不得写成字面槽 "?") */
|
|
642
724
|
declare function $setKey(o: Abs, key: Abs, value: Abs): Abs;
|
|
643
725
|
|
|
644
726
|
/**
|
|
@@ -649,7 +731,7 @@ declare function $setKey(o: Abs, key: Abs, value: Abs): Abs;
|
|
|
649
731
|
type BMemberDiag = {
|
|
650
732
|
kind: "method" | "property";
|
|
651
733
|
name: string;
|
|
652
|
-
/** 接收者 prim 类型名,或 "unknown" */
|
|
734
|
+
/** 接收者 prim 类型名,或 "unknown" / "object"(C0.5 闭 shape 缺槽) */
|
|
653
735
|
receiver: string;
|
|
654
736
|
line?: number;
|
|
655
737
|
column?: number;
|
|
@@ -658,6 +740,8 @@ type BMemberDiag = {
|
|
|
658
740
|
line: number;
|
|
659
741
|
column: number;
|
|
660
742
|
};
|
|
743
|
+
/** 覆盖默认 no-method 码;C0.5 用 nudo:missing-slot */
|
|
744
|
+
code?: string;
|
|
661
745
|
};
|
|
662
746
|
/** 给实参 Abs 打 provenance(调用点参数字面量) */
|
|
663
747
|
declare function tagAbsOrigin(a: Abs, loc: {
|
|
@@ -682,6 +766,16 @@ declare function notePrimMemberMissing(recv: Abs | undefined, name: string, kind
|
|
|
682
766
|
declare function noteUnknownMemberMissing(recv: Abs | undefined, name: string, kind: "method" | "property", loc?: [number, number]): boolean;
|
|
683
767
|
/** 方法分派失败时的统一记账(prim / unknown;obj/brand/promise 静默) */
|
|
684
768
|
declare function noteMemberDispatchMiss(recv: Abs | undefined, name: string, kind: "method" | "property", loc?: [number, number]): void;
|
|
769
|
+
/** host(service analysisConfig)在 B-path 前设置;默认 false */
|
|
770
|
+
declare function setEvalMissingSlotEnabled(enabled: boolean): void;
|
|
771
|
+
declare function isEvalMissingSlotEnabled(): boolean;
|
|
772
|
+
/** per-analysis 作用域:body 内 flag 隔离,结束后自动恢复外层值 */
|
|
773
|
+
declare function runWithEvalMissingSlot<T>(enabled: boolean, body: () => T): T;
|
|
774
|
+
/**
|
|
775
|
+
* 闭对象 shape 上缺失字段且**求值真实走到**该读取 → `nudo:missing-slot`。
|
|
776
|
+
* 仅展示/草稿提示;不参与 handwritten check 义务(C0:禁止 body AST 预扫)。
|
|
777
|
+
*/
|
|
778
|
+
declare function noteObjSlotMissing(recv: Abs | undefined, name: string, loc?: [number, number]): boolean;
|
|
685
779
|
|
|
686
780
|
/**
|
|
687
781
|
* B 路径调用点记录:transpile 把 `f(args)` 改成 $callNamed,
|
|
@@ -758,4 +852,4 @@ declare function callTranspiledExportFull(exports: Record<string, unknown>, name
|
|
|
758
852
|
/** 调用 runTranspiled 导出(仅结果) */
|
|
759
853
|
declare function callTranspiledExport(exports: Record<string, unknown>, name: string, args: Abs[]): Abs;
|
|
760
854
|
|
|
761
|
-
export { $add as $, type Abs as A, $
|
|
855
|
+
export { $add as $, type Abs as A, $get as B, type Confidence as C, $gt as D, $idx as E, $idxSet as F, $invoke as G, type HofSite as H, $invokeSuper as I, $isForkExit as J, $join as K, $le as L, $len as M, $lit as N, $loopReturn as O, type Phi as P, $lt as Q, type RelSource as R, type Shape as S, type Term as T, $mod as U, $mul as V, $ne as W, $neLoose as X, $neg as Y, $new as Z, $not as _, type AstEnv as a, getAbsOrigin as a$, $nullishTest as a0, $obj as a1, $objRest as a2, $optionalGet as a3, $optionalInvoke as a4, $orDefault as a5, $pushLoopExit as a6, $regex as a7, $rethrowIfNudoReturn as a8, $set as a9, type TranspileOptions as aA, type TranspiledCallResult as aB, abs as aC, absToString as aD, alphaOf as aE, and as aF, anyVar as aG, app as aH, applyCallbackAbs as aI, asAbs as aJ, asAbsVal as aK, betaOf as aL, bindImports as aM, bool as aN, boolLit as aO, callAtFunctionBoundary as aP, callTranspiledExport as aQ, callTranspiledExportFull as aR, clearBClasses as aS, collectAbsExports as aT, confJoin as aU, createHofCollectCtx as aV, currentExecPhi as aW, emptyPhi as aX, eq as aY, ge as aZ, geNum as a_, $setKey as aa, $spread as ab, $staticInvoke as ac, $sub as ad, $super as ae, $switch as af, $thisGet as ag, $thisSet as ah, $throw as ai, $tryCurrentMark as aj, $tryMark as ak, $tryPopMark as al, $tryTakeSince as am, $typeof as an, $while as ao, $whileSeq as ap, $yield as aq, type BCallRecord as ar, type BClassSpec as as, type BMemberDiag as at, DEFAULT_MAX_LOOP_ITERS as au, type HofCollectCtx as av, type LiteralValue as aw, NudoReturn as ax, NudoThrow as ay, type RunTranspiledOptions as az, type Pred as b, substAbs as b$, getBCallCollector as b0, getBClass as b1, gt as b2, gtNum as b3, implies as b4, instantiateReturn as b5, isArrMutator as b6, isDefinitelyFalse as b7, isDefinitelyTrue as b8, isEvalMissingSlotEnabled as b9, or as bA, pFalse as bB, pTrue as bC, phiAnd as bD, predEquals as bE, predToString as bF, predVars as bG, projectFlatMapResult as bH, promoteParamShape as bI, ptypeof as bJ, pushLoopExit as bK, pushThrowExit as bL, recordMemberDiag as bM, registerBClass as bN, runTranspiled as bO, runWithEvalMissingSlot as bP, runWithLoopExits as bQ, setApplyCallbackHost as bR, setBCallCollector as bS, setEvalMissingSlotEnabled as bT, setMemberDiagCollector as bU, shapeOfTerm as bV, shapeToString as bW, simplifyTerm as bX, snapshotAbs as bY, str as bZ, strLit as b_, isExactLit as ba, isNudoReturn as bb, isNudoThrow as bc, isNumPrim as bd, isRelFn as be, isStrPrim as bf, le as bg, leNum as bh, lit as bi, litTruth as bj, litValue as bk, lt as bl, ltNum as bm, mapElementFallback as bn, namespaceNameOf as bo, ne as bp, never as bq, not as br, noteMemberDispatchMiss as bs, noteObjSlotMissing as bt, notePrimMemberMissing as bu, noteUnknownMemberMissing as bv, num as bw, numLit as bx, numVar as by, obj as bz, type AbsModuleExports as c, substPred as c0, substPredAbs as c1, tagAbsOrigin as c2, takeLoopExits as c3, takeThrowExits as c4, termEquals as c5, termToString as c6, transpile as c7, transpileExpression as c8, transpileFile as c9, transpileSource as ca, tryPromoteDirectCall as cb, tryPromoteForOfIteratee as cc, tryPromoteHofCallback as cd, tryPromoteReceiverAsArr as ce, undefAbs as cf, unknown as cg, v as ch, withExecPhi as ci, type PrimName as d, $arr as e, $arrMutContainer as f, $arrRest as g, $async as h, $asyncReturn as i, $await as j, $call as k, $callNamed as l, $catchVal as m, $class as n, $concat as o, $div as p, $elems as q, $eq as r, $eqLoose as s, $fnVal as t, $for as u, $forIter as v, $forOf as w, $fork as x, $ge as y, $gen as z };
|