@nudojs/core 1.9.3 → 1.10.0
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-VMGJYMIF.js → chunk-HX4IEPRI.js} +256 -43
- package/dist/{chunk-HD6XZFOU.js → chunk-YREYFITQ.js} +13215 -11479
- package/dist/exec.d.ts +58 -14
- package/dist/exec.js +11 -1
- package/dist/index.d.ts +34 -13
- package/dist/index.js +23 -14
- package/dist/internal.d.ts +6 -4
- package/dist/internal.js +10 -5
- package/dist/{projection-budget-Dm1YWZ1U.d.ts → projection-budget-Dey0IUJa.d.ts} +22 -3
- package/dist/{run-WZKUu1y1.d.ts → run-Bgj2tCrv.d.ts} +40 -1
- package/package.json +1 -1
package/dist/exec.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Abs, M as MayThrowEffect, b as Phi } from './run-
|
|
2
|
-
export { W as $assignRecord, X as $call, Y as $callNamed, Z as $recordBinding, a5 as EvalAbsAssignRecord, a6 as EvalCallRecord, a7 as EvalFallback, g as EvalFallbackStats,
|
|
1
|
+
import { A as Abs, M as MayThrowEffect, b as Phi } from './run-Bgj2tCrv.js';
|
|
2
|
+
export { W as $assignRecord, X as $call, Y as $callNamed, bI as $nodoPos, Z as $recordBinding, a5 as EvalAbsAssignRecord, a6 as EvalCallRecord, a7 as EvalFallback, g as EvalFallbackStats, a8 as EvalPosRecord, ab as MAX_EVAL_CALL_DEPTH, ac as MAX_EVAL_TOTAL_CALLS, ad as RUNTIME_IMPORT_RE, V as RunTranspiledOptions, af as TranspiledCallResult, at as bindingsOf, aw as callTranspiledExport, ax as callTranspiledExportApply, ay as callTranspiledExportFull, l as clearPureCallMemo, m as clearPureMemo, n as enterEvalCallBudgetSession, aD as evalExprAbs, p as exitEvalCallBudgetSession, v as getEvalCallBudgetState, aG as getEvalCallCollector, w as getEvalFallbackStats, bJ as getPosCollector, aO as isAbsVal, aQ as isCjsMainRun, b5 as noteEvalCallRecord, b6 as noteEvalFallback, bn as resetEvalCallBudget, H as resetEvalFallbackStats, bK as routeApplyThrows, bo as runTranspiled, bp as runTranspiledOptionsMemoKey, bq as setEvalAssignCollector, br as setEvalBindingSink, bs as setEvalCallCollector, bt as setEvalFallbackCollector, bv as setPosCollector, bF as tryRunTranspiled, O as withEvalBudgetOverride } from './run-Bgj2tCrv.js';
|
|
3
3
|
import { Node, Expression, File } from '@babel/types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -192,8 +192,9 @@ declare function lookupObjAccessor(o: Abs, key: string): {
|
|
|
192
192
|
set?: (t: Abs, v: Abs) => Abs;
|
|
193
193
|
} | undefined;
|
|
194
194
|
/**
|
|
195
|
-
* `key in obj`:闭形状精确判定(含 Object.prototype
|
|
196
|
-
* class 方法/访问器与内建 brand
|
|
195
|
+
* `key in obj`:闭形状精确判定(含 Object.prototype/Array.prototype 名、
|
|
196
|
+
* 数组下标/length、class 方法/访问器与内建 brand 方法/访问器);
|
|
197
|
+
* prim/nullish 接收者原生抛 TypeError →
|
|
197
198
|
* unknown;抽象键/开形状 → boolean。
|
|
198
199
|
*/
|
|
199
200
|
declare function $in(key: Abs, o: Abs): Abs;
|
|
@@ -338,8 +339,11 @@ declare function $idx(a: Abs, i: Abs, opts?: {
|
|
|
338
339
|
}): Abs;
|
|
339
340
|
/** 下标写 a[i]=v → 新 tuple(越界写按 JS 语义增长,空洞为 undefined) */
|
|
340
341
|
declare function $idxSet(a: Abs, i: Abs, value: Abs): Abs;
|
|
341
|
-
/**
|
|
342
|
-
|
|
342
|
+
/** 数组/字符串长度。opts.silent:可选链(a?.length)守卫臂——接收者已过
|
|
343
|
+
* $removeNullish,仅 any 不记 may-throw(Bug 3,与 $get 的 silent 同口径)。 */
|
|
344
|
+
declare function $len(a: Abs, opts?: {
|
|
345
|
+
silent?: boolean;
|
|
346
|
+
}): Abs;
|
|
343
347
|
/** 对象字面量 → Abs obj(槽位写走 setSlot,`__proto__` 不踩宿主 setter) */
|
|
344
348
|
declare function $obj(slots: Record<string, Abs>): Abs;
|
|
345
349
|
/**
|
|
@@ -368,7 +372,9 @@ declare function $iterCheck(a: unknown): void;
|
|
|
368
372
|
/** 元素列表(tuple 展开;arr 抽象;C1 Set/Map 逐条目;matchAll 迭代器逐匹配项;
|
|
369
373
|
* 字符串按 code points)。Map 迭代语义是 entry `[key, value]` 元组,不是裸 value。
|
|
370
374
|
* 消费前先过可迭代性守卫(Bug 6):prim 字面量接收者 → 原生 definite
|
|
371
|
-
* TypeError;any/unknown → may。$forOf 与 call/new spread 实参路径继承。
|
|
375
|
+
* TypeError;any/unknown → may。$forOf 与 call/new spread 实参路径继承。
|
|
376
|
+
* Bug 34:生成器对象的体内延迟异常(definite 抛 / soft may-throw 重记)
|
|
377
|
+
* 在消费点重放——迭代不再静默截断成前缀。 */
|
|
372
378
|
declare function $elems(a: Abs): Abs[];
|
|
373
379
|
/** 模板标签对象(GetTemplateObject,Bug 34):冻结的类数组 obj——数字槽
|
|
374
380
|
* 为 cooked 字符串(无效转义序列时 cooked 是 undefined,原生实测)、
|
|
@@ -428,15 +434,17 @@ declare function $asyncReturn(v: Abs): Abs;
|
|
|
428
434
|
/** function* 体:收集所有 yield 值;返回带迭代器协议面的生成器对象 Abs;
|
|
429
435
|
* 抽象分支时降 conf(P0-6)
|
|
430
436
|
*
|
|
431
|
-
* Bug 58:调用生成器是原生全操作——体只在首个 next()
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
* yield 收集保持 eager(既有值域建模,注释口径不变)。
|
|
437
|
+
* Bug 58:调用生成器是原生全操作——体只在首个 next() 执行。body() eager
|
|
438
|
+
* 执行的体内效果(成员读 may-throw / 显式 throw)不折进**调用方** throws
|
|
439
|
+
* 域——以捕获式 may-throw 帧包裹:soft 效果与 NudoThrow 挂生成器对象
|
|
440
|
+
* (Bug 34 延迟重放:首个触达抛点的 next()/迭代消费,仅构造不消费不
|
|
441
|
+
* 表面)。yield 收集保持 eager(既有值域建模,注释口径不变)。
|
|
442
|
+
* Bug 2:thunk 返回值 = 终末 return 值——不再丢弃,经 makeGenObject 在
|
|
443
|
+
* 首个 done:true 作为 value 交付(node 实测:此后 next 回 undefined)。
|
|
436
444
|
* Bug 22:结果从 yield 元组数组改为生成器对象(next/return/throw 方法面 +
|
|
437
445
|
* constructor 身份);元素域经侧表保留($arr 的 ≤cap tuple / >cap arr
|
|
438
446
|
* widen 策略不变),迭代路径(for-of/spread/Array.from)继续工作。 */
|
|
439
|
-
declare function $gen(body: () =>
|
|
447
|
+
declare function $gen(body: () => Abs): Abs;
|
|
440
448
|
/** yield v:压入当前生成器收集器;表达式值用 unknown */
|
|
441
449
|
declare function $yield(v: Abs): Abs;
|
|
442
450
|
/** yield* v(Bug 82):委托迭代 ≠ yield v——GetIterator 校验先行($elems
|
|
@@ -496,6 +504,18 @@ declare function $removeMemberNullish(a: Abs, key: string): Abs;
|
|
|
496
504
|
* 原样返回(臂不可达的保守近似,与 $removeNullish 空集口径一致)。
|
|
497
505
|
*/
|
|
498
506
|
declare function $narrowTypeOf(a: Abs, typeOf: string, keep: boolean): Abs;
|
|
507
|
+
/**
|
|
508
|
+
* 关系守卫臂剪影(Bug 1):`x >= 0` 真臂把 x 重绑为带 ge(x,0) 界的 Abs
|
|
509
|
+
* ——守卫建立的隐含约束随**普通变量读取**进入返回值 / 签名面。此前只有
|
|
510
|
+
* 算术折叠消费 exec Φ(`x + 0` 携带界),裸 `return x` 丢守卫事实 →
|
|
511
|
+
* return-constraint gate 假阳(可证合规的函数过不了 CI)。只做事实臂:
|
|
512
|
+
* ¬(x≥0) 含 NaN 可能(NaN 与任何比较皆假),补集界不可健全表示。精确
|
|
513
|
+
* 字面量(lit term)的界由域隶属折叠,不加 pred 保持精确面干净。
|
|
514
|
+
* 只精化 number prim:any 的真臂还含 bigint(`10n >= 0` 为真)与
|
|
515
|
+
* ToPrimitive 对象面,refineAbsForRelTrue 的 number|string 并集会
|
|
516
|
+
* 凭空排除 bigint → 假证明;any/unknown 保持原样(宁缺毋假)。
|
|
517
|
+
*/
|
|
518
|
+
declare function $refineRel(a: Abs, op: "gt" | "ge" | "lt" | "le", k: number): Abs;
|
|
499
519
|
/**
|
|
500
520
|
* 判别等值守卫臂剪影(issue #126):`x.key === lit` 事实臂(keep=true)内把
|
|
501
521
|
* x 重绑为「key 值域可能等于 lit」的成员子集(剪 "never" 成员);对偶补集臂
|
|
@@ -575,6 +595,16 @@ type TranspileOptions = {
|
|
|
575
595
|
destrTmpSeq?: {
|
|
576
596
|
n: number;
|
|
577
597
|
};
|
|
598
|
+
/**
|
|
599
|
+
* try 临时名单调计数器(`__nudoTm_`/`__nudoE_`;transpileFile /
|
|
600
|
+
* transpileBodyNode 创建,单次转译输出内共享)。此前按源行号命名——
|
|
601
|
+
* 同一作用域同一行两个 try(压缩/生成代码)重名 → 重复 `const` 声明 →
|
|
602
|
+
* `new Function` SyntaxError 整模块 fail-closed;计数器与行号解耦
|
|
603
|
+
* (含 loc 缺失 `?? 0` 的碰撞),跨语句单调。
|
|
604
|
+
*/
|
|
605
|
+
tryTmpSeq?: {
|
|
606
|
+
n: number;
|
|
607
|
+
};
|
|
578
608
|
/**
|
|
579
609
|
* 当前词法作用域可见的 const 绑定名(用户层再赋值须 TypeError)。
|
|
580
610
|
* 成员/下标写对根的内部重绑不在用户赋值路径,不走此表。
|
|
@@ -591,6 +621,14 @@ type TranspileOptions = {
|
|
|
591
621
|
* 声明语句),此类名字从提升集扣除、不发改赋值。
|
|
592
622
|
*/
|
|
593
623
|
keepVarDecl?: boolean;
|
|
624
|
+
/**
|
|
625
|
+
* 节点级 Abs 记录插桩(hover 重放用):Identifier 值读与
|
|
626
|
+
* 静态成员读的转译输出包 `$nodoPos(<src>, line, column)`,
|
|
627
|
+
* 运行时把 (行, 列) → Abs 记入活跃的位置 collector(无收
|
|
628
|
+
* 集器时 no-op 直通)。默认关——热路径(check/模块图)不
|
|
629
|
+
* 承担插桩开销;仅 replayFnAbsNodes 重放开。
|
|
630
|
+
*/
|
|
631
|
+
recordPositions?: boolean;
|
|
594
632
|
};
|
|
595
633
|
|
|
596
634
|
/**
|
|
@@ -619,6 +657,12 @@ declare function transpileBodyNode(node: Node, opts: TranspileOptions): string;
|
|
|
619
657
|
* 表达式发射:transpileExpression / transpileShortCircuitExpr。
|
|
620
658
|
*/
|
|
621
659
|
|
|
660
|
+
/**
|
|
661
|
+
* 表达式发射入口(位置插桩包装层)。recordPositions 时把
|
|
662
|
+
* Identifier 值读 / 静态成员读的转译输出包 `$nodoPos`——
|
|
663
|
+
* 运行时记 (行, 列) → Abs 并原样返回(语义恒等;无收集
|
|
664
|
+
* 器时直通)。内部递归经本包装——每个子表达式恰包一次。
|
|
665
|
+
*/
|
|
622
666
|
declare function transpileExpression(expr: Expression, opts?: TranspileOptions): string;
|
|
623
667
|
|
|
624
668
|
/**
|
|
@@ -773,4 +817,4 @@ declare class NudoUnsupportedError extends Error {
|
|
|
773
817
|
detail?: string);
|
|
774
818
|
}
|
|
775
819
|
|
|
776
|
-
export { $absVal, $add, $arguments, $arr, $arrMutContainer, $arrRest, $arrWithHoles, $async, $asyncReturn, $await, $bitand, $bitnot, $bitor, $bitxor, $catchVal, $class, $classExpr, $collectionForEach, $concat, $copy, $del, $delRes, $div, $dynamicImport, $elems, $eq, $eqLoose, $fnVal, $for, $forInKeys, $forIter, $forOf, $fork, $ge, $gen, $get, $getSuper, $getSuperObj, $gt, $idx, $idxSet, $importMeta, $in, $instanceof, $instanceofNonIdent, $invoke, $invokeSuper, $invokeSuperKey, $invokeSuperObj, $isBreakTo, $isForkExit, $iterCheck, $join, $le, $len, $lit, $loopBreak, $loopContinue, $loopReturn, $lt, $mod, $mul, $narrowMemberEq, $narrowTypeOf, $ne, $neLoose, $neg, $new, $newTarget, $not, $nullishTest, $obj, $objAccessor, $objAccessorKey, $objRest, $optionalGet, $optionalInvoke, $orDefault, $pow, $pushLoopExit, $rawThis, $reStateCall, $regex, $removeMemberNullish, $removeNull, $removeNullish, $removeUndefined, $restBind, $rethrowIfNudoReturn, $set, $setKey, $setProto, $shl, $shr, $spread, $staticInit, $staticInvoke, $sub, $super, $switch, $thisGet, $thisSet, $throw, $toNumber, $toNumeric, $tpl, $tryCurrentMark, $tryDetachSoftCatch, $tryDigestSoftCatch, $tryDiscardSoft, $tryMark, $tryOrphanSoft, $tryPopMark, $tryReleaseSoftCatch, $tryReleaseSoftOut, $tryTakeSince, $typeof, $unknown, $updateAdd, $updateSub, $ushr, $while, $whileSeq, $yield, $yieldStar, DEFAULT_MAX_LOOP_ITERS, type EvalClassSpec, NudoLoopSignal, NudoReturn, NudoThrow, NudoUnsupportedError, type TranspileOptions, asAbsVal, callAtFunctionBoundary, clearBClasses, clearStaleTermPred, currentExecPhi, fillTuple, foldRequireSpecArg, foldStaticStringExpr, getEvalClass, isArrMutator, isDefinitelyFalse, isDefinitelyTrue, isNudoBreak, isNudoContinue, isNudoReturn, isNudoThrow, litTruth, lookupObjAccessor, namespaceNameOf, pushLoopExit, pushThrowExit, registerEvalClass, runWithLoopExits, runtimeImportOf, takeLoopExits, takeThrowExits, transpile, transpileBodyNode, transpileExpression, transpileFile, transpileSource, withExecPhi };
|
|
820
|
+
export { $absVal, $add, $arguments, $arr, $arrMutContainer, $arrRest, $arrWithHoles, $async, $asyncReturn, $await, $bitand, $bitnot, $bitor, $bitxor, $catchVal, $class, $classExpr, $collectionForEach, $concat, $copy, $del, $delRes, $div, $dynamicImport, $elems, $eq, $eqLoose, $fnVal, $for, $forInKeys, $forIter, $forOf, $fork, $ge, $gen, $get, $getSuper, $getSuperObj, $gt, $idx, $idxSet, $importMeta, $in, $instanceof, $instanceofNonIdent, $invoke, $invokeSuper, $invokeSuperKey, $invokeSuperObj, $isBreakTo, $isForkExit, $iterCheck, $join, $le, $len, $lit, $loopBreak, $loopContinue, $loopReturn, $lt, $mod, $mul, $narrowMemberEq, $narrowTypeOf, $ne, $neLoose, $neg, $new, $newTarget, $not, $nullishTest, $obj, $objAccessor, $objAccessorKey, $objRest, $optionalGet, $optionalInvoke, $orDefault, $pow, $pushLoopExit, $rawThis, $reStateCall, $refineRel, $regex, $removeMemberNullish, $removeNull, $removeNullish, $removeUndefined, $restBind, $rethrowIfNudoReturn, $set, $setKey, $setProto, $shl, $shr, $spread, $staticInit, $staticInvoke, $sub, $super, $switch, $thisGet, $thisSet, $throw, $toNumber, $toNumeric, $tpl, $tryCurrentMark, $tryDetachSoftCatch, $tryDigestSoftCatch, $tryDiscardSoft, $tryMark, $tryOrphanSoft, $tryPopMark, $tryReleaseSoftCatch, $tryReleaseSoftOut, $tryTakeSince, $typeof, $unknown, $updateAdd, $updateSub, $ushr, $while, $whileSeq, $yield, $yieldStar, DEFAULT_MAX_LOOP_ITERS, type EvalClassSpec, NudoLoopSignal, NudoReturn, NudoThrow, NudoUnsupportedError, type TranspileOptions, asAbsVal, callAtFunctionBoundary, clearBClasses, clearStaleTermPred, currentExecPhi, fillTuple, foldRequireSpecArg, foldStaticStringExpr, getEvalClass, isArrMutator, isDefinitelyFalse, isDefinitelyTrue, isNudoBreak, isNudoContinue, isNudoReturn, isNudoThrow, litTruth, lookupObjAccessor, namespaceNameOf, pushLoopExit, pushThrowExit, registerEvalClass, runWithLoopExits, runtimeImportOf, takeLoopExits, takeThrowExits, transpile, transpileBodyNode, transpileExpression, transpileFile, transpileSource, withExecPhi };
|
package/dist/exec.js
CHANGED
|
@@ -72,6 +72,7 @@ import {
|
|
|
72
72
|
$neg,
|
|
73
73
|
$new,
|
|
74
74
|
$newTarget,
|
|
75
|
+
$nodoPos,
|
|
75
76
|
$not,
|
|
76
77
|
$nullishTest,
|
|
77
78
|
$obj,
|
|
@@ -86,6 +87,7 @@ import {
|
|
|
86
87
|
$rawThis,
|
|
87
88
|
$reStateCall,
|
|
88
89
|
$recordBinding,
|
|
90
|
+
$refineRel,
|
|
89
91
|
$regex,
|
|
90
92
|
$removeMemberNullish,
|
|
91
93
|
$removeNull,
|
|
@@ -158,8 +160,10 @@ import {
|
|
|
158
160
|
getEvalCallCollector,
|
|
159
161
|
getEvalClass,
|
|
160
162
|
getEvalFallbackStats,
|
|
163
|
+
getPosCollector,
|
|
161
164
|
isAbsVal,
|
|
162
165
|
isArrMutator,
|
|
166
|
+
isCjsMainRun,
|
|
163
167
|
isDefinitelyFalse,
|
|
164
168
|
isDefinitelyTrue,
|
|
165
169
|
isNudoBreak,
|
|
@@ -185,6 +189,7 @@ import {
|
|
|
185
189
|
setEvalBindingSink,
|
|
186
190
|
setEvalCallCollector,
|
|
187
191
|
setEvalFallbackCollector,
|
|
192
|
+
setPosCollector,
|
|
188
193
|
takeLoopExits,
|
|
189
194
|
takeThrowExits,
|
|
190
195
|
transpile,
|
|
@@ -195,7 +200,7 @@ import {
|
|
|
195
200
|
tryRunTranspiled,
|
|
196
201
|
withEvalBudgetOverride,
|
|
197
202
|
withExecPhi
|
|
198
|
-
} from "./chunk-
|
|
203
|
+
} from "./chunk-YREYFITQ.js";
|
|
199
204
|
export {
|
|
200
205
|
$absVal,
|
|
201
206
|
$add,
|
|
@@ -269,6 +274,7 @@ export {
|
|
|
269
274
|
$neg,
|
|
270
275
|
$new,
|
|
271
276
|
$newTarget,
|
|
277
|
+
$nodoPos,
|
|
272
278
|
$not,
|
|
273
279
|
$nullishTest,
|
|
274
280
|
$obj,
|
|
@@ -283,6 +289,7 @@ export {
|
|
|
283
289
|
$rawThis,
|
|
284
290
|
$reStateCall,
|
|
285
291
|
$recordBinding,
|
|
292
|
+
$refineRel,
|
|
286
293
|
$regex,
|
|
287
294
|
$removeMemberNullish,
|
|
288
295
|
$removeNull,
|
|
@@ -355,8 +362,10 @@ export {
|
|
|
355
362
|
getEvalCallCollector,
|
|
356
363
|
getEvalClass,
|
|
357
364
|
getEvalFallbackStats,
|
|
365
|
+
getPosCollector,
|
|
358
366
|
isAbsVal,
|
|
359
367
|
isArrMutator,
|
|
368
|
+
isCjsMainRun,
|
|
360
369
|
isDefinitelyFalse,
|
|
361
370
|
isDefinitelyTrue,
|
|
362
371
|
isNudoBreak,
|
|
@@ -382,6 +391,7 @@ export {
|
|
|
382
391
|
setEvalBindingSink,
|
|
383
392
|
setEvalCallCollector,
|
|
384
393
|
setEvalFallbackCollector,
|
|
394
|
+
setPosCollector,
|
|
385
395
|
takeLoopExits,
|
|
386
396
|
takeThrowExits,
|
|
387
397
|
transpile,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { d as AstEnv, A as Abs, b as Phi, T as Term, Q as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, U as HofSite, c as AbsModuleExports, V as RunTranspiledOptions } from './run-
|
|
2
|
-
export { W as $assignRecord, X as $call, Y as $callNamed, Z as $recordBinding, _ as AbsApplyNoThrow, a0 as AbsApplyNoThrowFn, a1 as AbsApplyResult, a2 as AbsApplyReturn, a3 as AbsFnImpl, a4 as AbsSigImpl, a5 as EvalAbsAssignRecord, a6 as EvalCallRecord, a7 as EvalFallback, a8 as
|
|
1
|
+
import { d as AstEnv, A as Abs, b as Phi, T as Term, Q as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, U as HofSite, c as AbsModuleExports, V as RunTranspiledOptions } from './run-Bgj2tCrv.js';
|
|
2
|
+
export { W as $assignRecord, X as $call, Y as $callNamed, Z as $recordBinding, _ as AbsApplyNoThrow, a0 as AbsApplyNoThrowFn, a1 as AbsApplyResult, a2 as AbsApplyReturn, a3 as AbsFnImpl, a4 as AbsSigImpl, a5 as EvalAbsAssignRecord, a6 as EvalCallRecord, a7 as EvalFallback, a8 as EvalPosRecord, a9 as ImplicationOracle, aa as LitValueResult, L as LiteralValue, ab as MAX_EVAL_CALL_DEPTH, ac as MAX_EVAL_TOTAL_CALLS, P as PrimName, ad as RUNTIME_IMPORT_RE, ae as TYPEOF_NAMES, af as TranspiledCallResult, ag as TypeofName, ah as abs, ai as absFunction, aj as absOnly, ak as absToString, al as and, am as anyAbs, an as anyVar, ao as app, ap as assumeFinite, aq as attachFnImpl, ar as bigintLit, as as bindImports, at as bindingsOf, au as bool, av as boolLit, aw as callTranspiledExport, ax as callTranspiledExportApply, ay as callTranspiledExportFull, az as collectAbsExports, aA as confJoin, aB as emptyPhi, aC as eq, aD as evalExprAbs, aE as ge, aF as geNum, aG as getEvalCallCollector, aH as getFnImpl, aI as getImplicationOracle, aJ as gt, aK as gtNum, aL as hostFnCtorFacet, aM as implies, aN as isAbsApplyResult, aO as isAbsVal, aP as isBigPrim, aQ as isCjsMainRun, aR as isExactLit, aS as isNumPrim, aT as isStrPrim, aU as le, aV as leNum, aW as lit, aX as litValue, aY as lt, aZ as ltNum, a_ as makeAbsApplyResult, a$ as markPureFn, b0 as namespaceAbsOf, b1 as ne, b2 as negatePred, b3 as never, b4 as not, b5 as noteEvalCallRecord, b6 as noteEvalFallback, b7 as num, b8 as numLit, b9 as numVar, ba as obj, bb as or, bc as pFalse, bd as pTrue, be as phiAnd, bf as predEquals, bg as predToString, bh as predVars, bi as primToTypeof, bj as ptypeof, bk as pureFnNameOf, bl as relationFingerprint, bm as relationFn, bn as resetEvalCallBudget, bo as runTranspiled, bp as runTranspiledOptionsMemoKey, bq as setEvalAssignCollector, br as setEvalBindingSink, bs as setEvalCallCollector, bt as setEvalFallbackCollector, bu as setImplicationOracle, bv as setPosCollector, bw as shapeOfTerm, bx as shapeOnlyFn, by as shapeToString, bz as simplifyTerm, bA as str, bB as strLit, bC as substPred, bD as termEquals, bE as termToString, bF as tryRunTranspiled, bG as unknown, bH as v } from './run-Bgj2tCrv.js';
|
|
3
3
|
import { Node, File } from '@babel/types';
|
|
4
|
-
import { p as parseSource, L as LeakBudget, E as EffectiveInterfaceOpts, b as LoadDepsFingerprint, v as CheckReport, N as NudoConstraint, c as ProjectionBudget } from './projection-budget-
|
|
5
|
-
export { w as CONSTRAINT_BUILDERS, x as CONSTRAINT_BUILDER_NAMES, y as CONSTRAINT_EXPR_RE, z as CheckAction, C as CheckIssue, A as CheckJson, B as CheckJsonMulti, D as ConstraintBuilder, F as Diagnostic, G as EffectiveInterface, H as GitlabCodeQualityIssue, J as INTERFACE_SOURCE_ABBR, K as InterfaceDiag, I as InterfaceSource, O as InterfaceTierInfo, a as InterfaceTierOpts, Q as NamedImport, R as NudoField, S as NudoFnConstraint, T as NudoSidecarError, U as NudoSig, V as RefineDiag, W as RefineEntry, X as RefineResolveOpts, Y as SELF, Z as actionsForIssue, _ as andC, $ as any, a0 as array, a1 as boolean, a2 as checkArg, a3 as checkCall, a4 as constraintAdmitsNullish, a5 as constraintToEntryAbs, a6 as derefConstraint, a7 as drainPromiseMicros, a8 as effectiveInterface, a9 as enterPromiseExecutorScope, aa as evalPromiseCtor, ab as evalPromiseMethod, ac as evalPromiseStatic, ad as execNudoModule, ae as extractDeclaredThrows, af as extractFnBudget, ag as extractNudoImports, ah as extractRefineReturnFromSource, ai as extractRefinesFromSource, aj as fn, ak as fnConstraintToEntryReqs, al as formatCheckReport, am as formatConstraint, an as formatDiagnostics, ao as formatEffectiveInterfaceDisplay, ap as formatGithubAnnotations, aq as formatGitlabCodeQuality, ar as formatInterfaceTierLine, as as generatedExportNames, at as getParseSourceCacheSize, au as getTerm, av as instantiateConstraint, aw as interfaceDiagCount, ax as interfaceSourceOf, ay as interfaceTierOf, az as isIntFlag, aA as isNodeModulesPath, aB as isNudoConstraint, aC as lazy, aD as leavePromiseExecutorScope, aE as lenTerm, aF as litC, aG as localNamedExports, aH as notePromiseExecutorFork, aI as nullable, aJ as number, aK as omit, aL as partial, aM as pick, aN as queuePromiseMicro, aO as refineDiagCount, aP as refineToIndexedFull, aQ as resetNudoModuleExecCache, aR as resetParseSourceCache, aS as resetSidecarLoadFailureCache, aT as serializeCheckJson, aU as serializeCheckJsonMulti, aV as setInterfaceDiagCollector, aW as setRefineDiagCollector, aX as shape, aY as sidecarClosureFingerprint, aZ as sidecarPathOf, a_ as string, a$ as takeInterfaceDiags, b0 as takeInterfaceDiagsSince, b1 as takeRefineDiags, b2 as takeRefineDiagsSince, b3 as throwConstraintToKinds, b4 as union } from './projection-budget-
|
|
4
|
+
import { p as parseSource, L as LeakBudget, E as EffectiveInterfaceOpts, b as LoadDepsFingerprint, v as CheckReport, N as NudoConstraint, c as ProjectionBudget } from './projection-budget-Dey0IUJa.js';
|
|
5
|
+
export { w as CONSTRAINT_BUILDERS, x as CONSTRAINT_BUILDER_NAMES, y as CONSTRAINT_EXPR_RE, z as CheckAction, C as CheckIssue, A as CheckJson, B as CheckJsonMulti, D as ConstraintBuilder, F as Diagnostic, G as EffectiveInterface, H as GitlabCodeQualityIssue, J as INTERFACE_SOURCE_ABBR, K as InterfaceDiag, I as InterfaceSource, O as InterfaceTierInfo, a as InterfaceTierOpts, Q as NamedImport, R as NudoField, S as NudoFnConstraint, T as NudoSidecarError, U as NudoSig, V as RefineDiag, W as RefineEntry, X as RefineResolveOpts, Y as SELF, Z as actionsForIssue, _ as andC, $ as any, a0 as array, a1 as boolean, a2 as checkArg, a3 as checkCall, a4 as constraintAdmitsNullish, a5 as constraintToEntryAbs, a6 as derefConstraint, a7 as drainPromiseMicros, a8 as effectiveInterface, a9 as enterPromiseExecutorScope, aa as evalPromiseCtor, ab as evalPromiseMethod, ac as evalPromiseStatic, ad as execNudoModule, ae as extractDeclaredThrows, af as extractFnBudget, ag as extractNudoImports, ah as extractRefineReturnFromSource, ai as extractRefinesFromSource, aj as fn, ak as fnConstraintToEntryReqs, al as formatCheckReport, am as formatConstraint, an as formatDiagnostics, ao as formatEffectiveInterfaceDisplay, ap as formatGithubAnnotations, aq as formatGitlabCodeQuality, ar as formatInterfaceTierLine, as as generatedExportNames, at as getParseSourceCacheSize, au as getTerm, av as instantiateConstraint, aw as interfaceDiagCount, ax as interfaceSourceOf, ay as interfaceTierOf, az as isIntFlag, aA as isNodeModulesPath, aB as isNudoConstraint, aC as lazy, aD as leavePromiseExecutorScope, aE as lenTerm, aF as litC, aG as localNamedExports, aH as notePromiseExecutorFork, aI as nullable, aJ as number, aK as omit, aL as partial, aM as pick, aN as queuePromiseMicro, aO as refineDiagCount, aP as refineToIndexedFull, aQ as resetNudoModuleExecCache, aR as resetParseSourceCache, aS as resetSidecarLoadFailureCache, aT as serializeCheckJson, aU as serializeCheckJsonMulti, aV as setInterfaceDiagCollector, aW as setRefineDiagCollector, aX as shape, aY as sidecarClosureFingerprint, aZ as sidecarPathOf, a_ as string, a$ as takeInterfaceDiags, b0 as takeInterfaceDiagsSince, b1 as takeRefineDiags, b2 as takeRefineDiagsSince, b3 as throwConstraintToKinds, b4 as union } from './projection-budget-Dey0IUJa.js';
|
|
6
6
|
export { $add, $arguments, $arr, $arrMutContainer, $arrRest, $arrWithHoles, $async, $asyncReturn, $await, $bitand, $bitnot, $bitor, $bitxor, $catchVal, $class, $classExpr, $collectionForEach, $concat, $copy, $del, $delRes, $div, $dynamicImport, $elems, $eq, $eqLoose, $fnVal, $for, $forInKeys, $forIter, $forOf, $fork, $ge, $gen, $get, $gt, $idx, $idxSet, $importMeta, $in, $instanceof, $instanceofNonIdent, $invoke, $invokeSuper, $isBreakTo, $isForkExit, $join, $le, $len, $lit, $loopBreak, $loopContinue, $loopReturn, $lt, $mod, $mul, $ne, $neLoose, $neg, $new, $not, $nullishTest, $obj, $objAccessor, $objRest, $optionalGet, $optionalInvoke, $orDefault, $pow, $pushLoopExit, $rawThis, $reStateCall, $regex, $rethrowIfNudoReturn, $set, $setKey, $shl, $shr, $spread, $staticInvoke, $sub, $super, $switch, $thisGet, $thisSet, $throw, $toNumber, $toNumeric, $tryCurrentMark, $tryDetachSoftCatch, $tryDigestSoftCatch, $tryDiscardSoft, $tryMark, $tryOrphanSoft, $tryPopMark, $tryReleaseSoftCatch, $tryReleaseSoftOut, $tryTakeSince, $typeof, $unknown, $updateAdd, $updateSub, $ushr, $while, $whileSeq, $yield, DEFAULT_MAX_LOOP_ITERS, EvalClassSpec, NudoLoopSignal, NudoReturn, NudoThrow, NudoUnsupportedError, TranspileOptions, asAbsVal, callAtFunctionBoundary, clearBClasses, clearStaleTermPred, currentExecPhi, fillTuple, foldRequireSpecArg, foldStaticStringExpr, getEvalClass, isArrMutator, isDefinitelyFalse, isDefinitelyTrue, isNudoBreak, isNudoContinue, isNudoReturn, isNudoThrow, litTruth, lookupObjAccessor, namespaceNameOf, pushLoopExit, pushThrowExit, registerEvalClass, runWithLoopExits, runtimeImportOf, takeLoopExits, takeThrowExits, transpile, transpileBodyNode, transpileExpression, transpileFile, transpileSource, withExecPhi } from './exec.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -689,13 +689,20 @@ declare function isMapAbs(a: Abs | undefined): boolean;
|
|
|
689
689
|
declare function isSetAbs(a: Abs | undefined): boolean;
|
|
690
690
|
/**
|
|
691
691
|
* 构造器实参**确定**非法(原生 TypeError 域):
|
|
692
|
-
* - 非可迭代字面量(number/boolean/symbol/bigint
|
|
693
|
-
*
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
* (
|
|
697
|
-
*
|
|
698
|
-
*
|
|
692
|
+
* - 非可迭代字面量(number/boolean/symbol/bigint、闭对象字面量、symbol
|
|
693
|
+
* 字面量)→ 四个集合构造器都抛
|
|
694
|
+
* - Map/WeakMap 条目必须是对象(IsObject):prim 条目(含字符串实参的
|
|
695
|
+
* 每个字符、tuple/Set 元素)与 nullish 字面量条目 → TypeError
|
|
696
|
+
* (Bug 8:null/undefined/symbol 字面量挂 shape unknown + lit term,
|
|
697
|
+
* 旧 primEntry 只查 prim 形态 → 漏抛)
|
|
698
|
+
* - WeakMap 键 = Get(entry, "0") 须可弱持有(classifyCanBeHeldWeakly 同
|
|
699
|
+
* 口径):零/一元组、闭对象/fn/无 0 槽 brand 条目键 undefined、prim/
|
|
700
|
+
* nullish 键 → TypeError(Bug 8:旧口径只查 ≥2 元组首元素 prim)
|
|
701
|
+
* - WeakSet 元素须可弱持有:prim/nullish 字面量元素(含字符串字符)→
|
|
702
|
+
* TypeError;symbol 元素合法(node 实测 new WeakSet([Symbol()]) 不抛)
|
|
703
|
+
* - Bug 8 gate 面:抽象外层 iterable(any/unknown/开放 obj/fn/其它 brand)
|
|
704
|
+
* 可能非可迭代、抽象元素(含抽象字符串实参的字符臂)可能非 entry/
|
|
705
|
+
* 非弱键 → recordMayThrow(三个分派点共用本判定,集中记录)
|
|
699
706
|
*/
|
|
700
707
|
declare function ctorArgDefinitelyInvalid(name: "Map" | "Set" | "WeakMap" | "WeakSet", iterable: Abs | undefined): boolean;
|
|
701
708
|
declare function makeMapAbs(iterable?: Abs): Abs;
|
|
@@ -807,7 +814,11 @@ type FormatOptions = {
|
|
|
807
814
|
declare function formatAbs(a: Abs, opts?: FormatOptions): string;
|
|
808
815
|
/** fn/arr 槽位:shape + 非 lit term(禁止在 format 里内联复制 term 逻辑) */
|
|
809
816
|
declare function formatShapeSlot(a: Abs): string;
|
|
810
|
-
declare function formatShape(a: Abs
|
|
817
|
+
declare function formatShape(a: Abs, opts?: {
|
|
818
|
+
maxDepth?: number;
|
|
819
|
+
showLits?: boolean;
|
|
820
|
+
pretty?: boolean;
|
|
821
|
+
}): string;
|
|
811
822
|
/** 多行展示,CLI 用 */
|
|
812
823
|
declare function formatAbsMultiline(a: Abs, label?: string): string;
|
|
813
824
|
|
|
@@ -847,6 +858,11 @@ type FormalParam = {
|
|
|
847
858
|
propKey: Record<string, string>;
|
|
848
859
|
/** 仅嵌套内出现、顶层不可单独表达的名(降级用) */
|
|
849
860
|
nested: string[];
|
|
861
|
+
/**
|
|
862
|
+
* #137:嵌套解构点路径契约面('card.grade',源属性键点连接)。
|
|
863
|
+
* 中间键(card)同时在 bound 里平铺可绑(整对象 shape 契约)。
|
|
864
|
+
*/
|
|
865
|
+
nestedPaths: string[];
|
|
850
866
|
index: number;
|
|
851
867
|
};
|
|
852
868
|
type AstParam = {
|
|
@@ -877,13 +893,17 @@ declare function contractParamNameSet(formals: FormalParam[]): Set<string>;
|
|
|
877
893
|
/**
|
|
878
894
|
* 契约参数名 → 形参定位。
|
|
879
895
|
* - 命中 id/default/rest → 该 index(执法按整参)
|
|
880
|
-
* - 命中 pattern 顶层 bound 名 → 该 pattern index + field
|
|
896
|
+
* - 命中 pattern 顶层 bound 名 → 该 pattern index + field(fieldPath 单段)
|
|
881
897
|
* - 命中 placeholder / `_` → pattern index(整对象)
|
|
898
|
+
* - #137:命中嵌套点路径('card.grade' ∈ nestedPaths)→ index + fieldPath
|
|
899
|
+
* 多段(field 为展示用点连接串)。平铺精确匹配必须先于任何点路径解析:
|
|
900
|
+
* 源键 'a.b' 与路径 'a.b' 不可歧义——平铺胜。
|
|
882
901
|
* - 未命中 → undefined(C4.5 param-mismatch)
|
|
883
902
|
*/
|
|
884
903
|
declare function locateContractParam(formals: FormalParam[], contractName: string): {
|
|
885
904
|
index: number;
|
|
886
905
|
field?: string;
|
|
906
|
+
fieldPath?: string[];
|
|
887
907
|
rest?: boolean;
|
|
888
908
|
} | undefined;
|
|
889
909
|
|
|
@@ -917,6 +937,7 @@ type PolyFn = {
|
|
|
917
937
|
entryReqs?: Array<{
|
|
918
938
|
param: string;
|
|
919
939
|
pred: Pred;
|
|
940
|
+
display?: string;
|
|
920
941
|
}>;
|
|
921
942
|
/**
|
|
922
943
|
* 形参表面(C4.1):默认/rest/解构的契约可绑定名。
|
package/dist/index.js
CHANGED
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
takeInterfaceDiagsSince,
|
|
65
65
|
takeRefineDiags,
|
|
66
66
|
takeRefineDiagsSince
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-HX4IEPRI.js";
|
|
68
68
|
import {
|
|
69
69
|
$add,
|
|
70
70
|
$arguments,
|
|
@@ -328,6 +328,7 @@ import {
|
|
|
328
328
|
isAbsVal,
|
|
329
329
|
isArrMutator,
|
|
330
330
|
isBigPrim,
|
|
331
|
+
isCjsMainRun,
|
|
331
332
|
isDefinitelyFalse,
|
|
332
333
|
isDefinitelyTrue,
|
|
333
334
|
isErrorCtorName,
|
|
@@ -469,6 +470,7 @@ import {
|
|
|
469
470
|
setHasEntry,
|
|
470
471
|
setImplicationOracle,
|
|
471
472
|
setMayThrowCollector,
|
|
473
|
+
setPosCollector,
|
|
472
474
|
setPropFlags,
|
|
473
475
|
setSizeAbs,
|
|
474
476
|
shape,
|
|
@@ -520,7 +522,7 @@ import {
|
|
|
520
522
|
v,
|
|
521
523
|
withExecPhi,
|
|
522
524
|
withVar
|
|
523
|
-
} from "./chunk-
|
|
525
|
+
} from "./chunk-YREYFITQ.js";
|
|
524
526
|
|
|
525
527
|
// src/environment.ts
|
|
526
528
|
function createEnvironment(parent, bindings = /* @__PURE__ */ new Map()) {
|
|
@@ -1920,13 +1922,17 @@ function structuralAssignIssues(records) {
|
|
|
1920
1922
|
}
|
|
1921
1923
|
|
|
1922
1924
|
// src/algebra/check-case-scan.ts
|
|
1923
|
-
function projectCaseArgField(arg,
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1925
|
+
function projectCaseArgField(arg, fieldPath) {
|
|
1926
|
+
let cur = arg;
|
|
1927
|
+
for (const seg of fieldPath) {
|
|
1928
|
+
if (!cur) return void 0;
|
|
1929
|
+
if (cur.shape.k === "brand") {
|
|
1930
|
+
cur = cur.shape.shape;
|
|
1931
|
+
}
|
|
1932
|
+
if (cur.shape.k !== "obj") return void 0;
|
|
1933
|
+
cur = getSlot(cur.shape.slots, seg)?.value;
|
|
1927
1934
|
}
|
|
1928
|
-
|
|
1929
|
-
return getSlot(arg.shape.slots, field)?.value;
|
|
1935
|
+
return cur;
|
|
1930
1936
|
}
|
|
1931
1937
|
function scanCaseInconsistency(source, knownFns, opts) {
|
|
1932
1938
|
const out = [];
|
|
@@ -2007,12 +2013,12 @@ function scanCaseInconsistency(source, knownFns, opts) {
|
|
|
2007
2013
|
for (const p of eff.params) {
|
|
2008
2014
|
if (conflictParams.has(p.param)) continue;
|
|
2009
2015
|
let idx = paramNames.indexOf(p.param);
|
|
2010
|
-
let
|
|
2016
|
+
let fieldPath;
|
|
2011
2017
|
if (idx < 0 && formals.length > 0) {
|
|
2012
2018
|
const hit = locateContractParam(formals, p.param);
|
|
2013
2019
|
if (hit) {
|
|
2014
2020
|
idx = hit.index;
|
|
2015
|
-
|
|
2021
|
+
fieldPath = hit.fieldPath ?? (hit.field !== void 0 ? [hit.field] : void 0);
|
|
2016
2022
|
}
|
|
2017
2023
|
}
|
|
2018
2024
|
if (idx < 0) continue;
|
|
@@ -2023,7 +2029,7 @@ function scanCaseInconsistency(source, knownFns, opts) {
|
|
|
2023
2029
|
pred: instantiateConstraint(p.constraint, p.param),
|
|
2024
2030
|
constraint: p.constraint
|
|
2025
2031
|
},
|
|
2026
|
-
|
|
2032
|
+
fieldPath
|
|
2027
2033
|
]);
|
|
2028
2034
|
}
|
|
2029
2035
|
if (reqs.length === 0) return;
|
|
@@ -2031,16 +2037,17 @@ function scanCaseInconsistency(source, knownFns, opts) {
|
|
|
2031
2037
|
for (const req of reqs) {
|
|
2032
2038
|
const idx = req[0];
|
|
2033
2039
|
const entry = req[1];
|
|
2034
|
-
const
|
|
2040
|
+
const fieldPath = req[2];
|
|
2035
2041
|
if (entry.constraint.fields) continue;
|
|
2036
2042
|
let arg = absArgs[idx];
|
|
2037
2043
|
if (!arg) continue;
|
|
2038
|
-
if (
|
|
2039
|
-
const projected = projectCaseArgField(arg,
|
|
2044
|
+
if (fieldPath) {
|
|
2045
|
+
const projected = projectCaseArgField(arg, fieldPath);
|
|
2040
2046
|
if (!projected) {
|
|
2041
2047
|
const k = arg.shape.k;
|
|
2042
2048
|
if (k !== "unknown" && k !== "any") {
|
|
2043
2049
|
const paramName = entry.param || paramNames[idx] || `arg${idx}`;
|
|
2050
|
+
const field = fieldPath.join(".");
|
|
2044
2051
|
out.push({
|
|
2045
2052
|
severity: "error",
|
|
2046
2053
|
code: "nudo:case-inconsistency",
|
|
@@ -3429,6 +3436,7 @@ export {
|
|
|
3429
3436
|
isAbsVal,
|
|
3430
3437
|
isArrMutator,
|
|
3431
3438
|
isBigPrim,
|
|
3439
|
+
isCjsMainRun,
|
|
3432
3440
|
isDefinitelyFalse,
|
|
3433
3441
|
isDefinitelyTrue,
|
|
3434
3442
|
isErrorCtorName,
|
|
@@ -3588,6 +3596,7 @@ export {
|
|
|
3588
3596
|
setHasEntry,
|
|
3589
3597
|
setImplicationOracle,
|
|
3590
3598
|
setInterfaceDiagCollector,
|
|
3599
|
+
setPosCollector,
|
|
3591
3600
|
setPropFlags,
|
|
3592
3601
|
setRefineDiagCollector,
|
|
3593
3602
|
setSizeAbs,
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-
|
|
2
|
-
export { L as LeakBudget, b as LoadDepsFingerprint, M as MAX_PROMISE_MICROS, P as PROJECTION_MAX_DEPTH, c as ProjectionBudget, d as ProjectionStopReason, e as defaultLeakBudget, f as exceedsBudget, g as exportedNameOfLocal, h as extractAllLoadSpecs, i as getPromiseMicrosLength, l as leakIfNeeded, j as loadModuleDepsFingerprint, m as maybeLeak, n as normPath, r as resetLeakCounter, k as resolveDepPath, s as sidecarSpecsOf, o as stablePathKey, q as stablePathKeyGraph, t as termDepth, u as termNodes } from './projection-budget-
|
|
3
|
-
import { A as Abs, T as Term, c as AbsModuleExports, d as AstEnv } from './run-
|
|
4
|
-
export { $ as $tryDigestSoft, e as $tryMarkSoft, f as $tryReleaseSoft, E as ERROR_FAMILY, g as EvalFallbackStats, M as MayThrowEffect, h as absLit, i as absNumLit, j as absStrLit, k as allAbsStr, l as clearPureCallMemo, m as clearPureMemo, n as enterEvalCallBudgetSession, o as errorTypeAbs, p as exitEvalCallBudgetSession, q as filterDeclaredThrows, r as filterGateThrows, s as filterIgnoredThrows, t as flushMayThrowEffects, u as formatThrowsAbs, v as getEvalCallBudgetState, w as getEvalFallbackStats, x as getMayThrowCollector, y as isThrowsIgnored, z as mayThrowEffectsToAbs, B as orphanMayThrowEffects, D as popMayThrowFrame, F as pushMayThrowFrame, G as recordMayThrow, H as resetEvalFallbackStats, I as runWithMayThrowSession, J as setMayThrowCollector, K as throwAbsToKinds, N as throwsKindCovered, O as withEvalBudgetOverride } from './run-
|
|
1
|
+
import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-Dey0IUJa.js';
|
|
2
|
+
export { L as LeakBudget, b as LoadDepsFingerprint, M as MAX_PROMISE_MICROS, P as PROJECTION_MAX_DEPTH, c as ProjectionBudget, d as ProjectionStopReason, e as defaultLeakBudget, f as exceedsBudget, g as exportedNameOfLocal, h as extractAllLoadSpecs, i as getPromiseMicrosLength, l as leakIfNeeded, j as loadModuleDepsFingerprint, m as maybeLeak, n as normPath, r as resetLeakCounter, k as resolveDepPath, s as sidecarSpecsOf, o as stablePathKey, q as stablePathKeyGraph, t as termDepth, u as termNodes } from './projection-budget-Dey0IUJa.js';
|
|
3
|
+
import { A as Abs, T as Term, c as AbsModuleExports, d as AstEnv } from './run-Bgj2tCrv.js';
|
|
4
|
+
export { $ as $tryDigestSoft, e as $tryMarkSoft, f as $tryReleaseSoft, E as ERROR_FAMILY, g as EvalFallbackStats, M as MayThrowEffect, h as absLit, i as absNumLit, j as absStrLit, k as allAbsStr, l as clearPureCallMemo, m as clearPureMemo, n as enterEvalCallBudgetSession, o as errorTypeAbs, p as exitEvalCallBudgetSession, q as filterDeclaredThrows, r as filterGateThrows, s as filterIgnoredThrows, t as flushMayThrowEffects, u as formatThrowsAbs, v as getEvalCallBudgetState, w as getEvalFallbackStats, x as getMayThrowCollector, y as isThrowsIgnored, z as mayThrowEffectsToAbs, B as orphanMayThrowEffects, D as popMayThrowFrame, F as pushMayThrowFrame, G as recordMayThrow, H as resetEvalFallbackStats, I as runWithMayThrowSession, J as setMayThrowCollector, K as throwAbsToKinds, N as throwsKindCovered, O as withEvalBudgetOverride } from './run-Bgj2tCrv.js';
|
|
5
5
|
import { File, Node } from '@babel/types';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -385,6 +385,8 @@ type AbsInlay = {
|
|
|
385
385
|
interfaceSource?: InterfaceSource;
|
|
386
386
|
/** true = 隐式推导展示(非义务契约),label 已带 `· derived` */
|
|
387
387
|
derived?: boolean;
|
|
388
|
+
/** 折叠展示时的完整 pred 文本(hover tooltip;display 缺席时无) */
|
|
389
|
+
tooltip?: string;
|
|
388
390
|
};
|
|
389
391
|
type CollectAbsInlaysOpts = InterfaceTierOpts & {
|
|
390
392
|
loadModule?: (spec: string, fromFile: string) => string | undefined;
|
package/dist/internal.js
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
stableAnalyzeKeySource,
|
|
22
22
|
stablePathKey,
|
|
23
23
|
stablePathKeyGraph
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-HX4IEPRI.js";
|
|
25
25
|
import {
|
|
26
26
|
$tryDigestSoft,
|
|
27
27
|
$tryMarkSoft,
|
|
@@ -169,7 +169,7 @@ import {
|
|
|
169
169
|
withEvalBudgetOverride,
|
|
170
170
|
withFnBudgetOverride,
|
|
171
171
|
wrapPromise
|
|
172
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-YREYFITQ.js";
|
|
173
173
|
|
|
174
174
|
// src/algebra/inlay.ts
|
|
175
175
|
function listFunctions(source) {
|
|
@@ -282,7 +282,9 @@ function collectAbsInlays(source, opts) {
|
|
|
282
282
|
const predsByName = /* @__PURE__ */ new Map();
|
|
283
283
|
if (g.entryReqs) {
|
|
284
284
|
for (const r of g.entryReqs) {
|
|
285
|
-
predsByName.set(r.param, [
|
|
285
|
+
predsByName.set(r.param, [
|
|
286
|
+
{ pred: r.pred, ...r.display !== void 0 ? { display: r.display } : {} }
|
|
287
|
+
]);
|
|
286
288
|
}
|
|
287
289
|
}
|
|
288
290
|
const fnNode = node;
|
|
@@ -293,12 +295,15 @@ function collectAbsInlays(source, opts) {
|
|
|
293
295
|
if (!p?.loc || !pname) continue;
|
|
294
296
|
const preds = predsByName.get(pname);
|
|
295
297
|
if (preds && preds.length > 0) {
|
|
296
|
-
const text = preds.map(predToString).join(" \u2227 ");
|
|
298
|
+
const text = preds.map((p2) => predToString(p2.pred)).join(" \u2227 ");
|
|
299
|
+
const displays = preds.map((p2) => p2.display);
|
|
300
|
+
const display = displays.every((d) => d !== void 0) ? displays.map((d) => d).join(" \u2227 ") : void 0;
|
|
297
301
|
inlays.push({
|
|
298
302
|
line: p.loc.end.line,
|
|
299
303
|
character: p.loc.end.column,
|
|
300
|
-
label: ` where ${text}`,
|
|
304
|
+
label: display !== void 0 ? ` where ${display}` : ` where ${text}`,
|
|
301
305
|
kind: "parameter",
|
|
306
|
+
...display !== void 0 ? { tooltip: text } : {},
|
|
302
307
|
...tierSrc ? { interfaceSource: tierSrc } : {}
|
|
303
308
|
});
|
|
304
309
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { File } from '@babel/types';
|
|
2
|
-
import { A as Abs, T as Term, P as PrimName, a as Pred, L as LiteralValue, b as Phi, C as Confidence } from './run-
|
|
2
|
+
import { A as Abs, T as Term, P as PrimName, a as Pred, L as LiteralValue, b as Phi, C as Confidence } from './run-Bgj2tCrv.js';
|
|
3
3
|
|
|
4
4
|
declare function resetParseSourceCache(): void;
|
|
5
5
|
declare function getParseSourceCacheSize(): number;
|
|
@@ -338,14 +338,15 @@ type RefineResolveOpts = {
|
|
|
338
338
|
};
|
|
339
339
|
declare function resetNudoModuleExecCache(): void;
|
|
340
340
|
/**
|
|
341
|
-
*
|
|
342
|
-
* 多条用 && 或换行连接。
|
|
341
|
+
* @nudo:contract 提取条目(pred 相对 param 项)。
|
|
343
342
|
* 同时保留原始 NudoConstraint(shape 字段检查用)。
|
|
344
343
|
*/
|
|
345
344
|
type RefineEntry = {
|
|
346
345
|
param: string;
|
|
347
346
|
pred: Pred;
|
|
348
347
|
constraint: NudoConstraint;
|
|
348
|
+
/** 指令引用的约束名(`@nudo:contract x positive` 的 `positive`);display 折叠用 */
|
|
349
|
+
name?: string;
|
|
349
350
|
};
|
|
350
351
|
declare function extractRefinesFromSource(source: string, fnName: string, opts?: RefineResolveOpts): RefineEntry[];
|
|
351
352
|
/** refine 参数 → 带约束模板的下标表(shape 检查用) */
|
|
@@ -485,9 +486,11 @@ type EffectiveInterfaceOpts = RefineResolveOpts & {
|
|
|
485
486
|
};
|
|
486
487
|
type EffectiveInterface = {
|
|
487
488
|
fnName: string;
|
|
489
|
+
/** display = 表达式原文/约束名折叠形(运行时标志);缺席 = 消费端回落 pred 全展 */
|
|
488
490
|
params: Array<{
|
|
489
491
|
param: string;
|
|
490
492
|
constraint: NudoConstraint;
|
|
493
|
+
display?: string;
|
|
491
494
|
}>;
|
|
492
495
|
returns?: {
|
|
493
496
|
constraint: NudoConstraint;
|
|
@@ -496,6 +499,10 @@ type EffectiveInterface = {
|
|
|
496
499
|
throws?: {
|
|
497
500
|
kinds: string[] | "*";
|
|
498
501
|
};
|
|
502
|
+
/** 契约来源侧车 canonical 路径(侧车绑定时);契约原文链接跳转用 */
|
|
503
|
+
sidecarPath?: string;
|
|
504
|
+
/** 侧车绑定声明行(1-based;契约原文链接 `#L<n>` 跳转目标) */
|
|
505
|
+
sidecarLine?: number;
|
|
499
506
|
source: InterfaceSource;
|
|
500
507
|
/**
|
|
501
508
|
* 合取不可满足标记:params = 常数界交叉矛盾(或 prim 矛盾等 and() 不可
|
|
@@ -537,6 +544,10 @@ type InterfaceTierInfo = {
|
|
|
537
544
|
source: InterfaceSource;
|
|
538
545
|
/** handwritten/generated 时的契约展示;implicit 为 undefined */
|
|
539
546
|
display?: string;
|
|
547
|
+
/** 契约来源侧车 canonical 路径(侧车绑定时);契约原文链接跳转用 */
|
|
548
|
+
sidecarPath?: string;
|
|
549
|
+
/** 侧车绑定声明行(1-based;契约原文链接 `#L<n>` 跳转目标) */
|
|
550
|
+
sidecarLine?: number;
|
|
540
551
|
};
|
|
541
552
|
type InterfaceTierOpts = EffectiveInterfaceOpts;
|
|
542
553
|
/**
|
|
@@ -832,6 +843,14 @@ declare class ProjectionBudget {
|
|
|
832
843
|
#private;
|
|
833
844
|
/** 粘性:本次投影是否发生过截断("cycle" / "depth"),供台账记录 */
|
|
834
845
|
truncated: ProjectionStopReason | undefined;
|
|
846
|
+
/** 展示口径:eq(self, lit(v)) pred 渲染为 lit(v)(lit 判别值
|
|
847
|
+
* 可见——hover 求值态面);默认 false(纯 shape 外延渲染,
|
|
848
|
+
* 与既有全部展示面同口径) */
|
|
849
|
+
showLits: boolean;
|
|
850
|
+
/** 展示口径:多行缩进渲染(hover 弹窗面)——obj 槽位每槽一行 +
|
|
851
|
+
* 尾逗号 + 2 空格缩进递增,复合臂 union 按臂断行;默认 false
|
|
852
|
+
* (单行——check 签名 / dts / inlay 等既有面字节不变) */
|
|
853
|
+
pretty: boolean;
|
|
835
854
|
constructor(maxDepth?: number);
|
|
836
855
|
/**
|
|
837
856
|
* 进入一个 Abs(或 Shape)子树。返回 null → 继续递归,之后必须配对
|