@nudojs/core 1.7.2 → 1.7.4

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/exec.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Abs, M as MayThrowEffect, b as Phi } from './run-BuTz_p4k.js';
2
- export { W as $assignRecord, X as $call, Y as $callNamed, Z as $recordBinding, a5 as EvalAbsAssignRecord, a6 as EvalCallRecord, a7 as EvalFallback, f as EvalFallbackStats, aa as MAX_EVAL_CALL_DEPTH, ab as MAX_EVAL_TOTAL_CALLS, ac as RUNTIME_IMPORT_RE, V as RunTranspiledOptions, ae as TranspiledCallResult, as as bindingsOf, av as callTranspiledExport, aw as callTranspiledExportApply, ax as callTranspiledExportFull, k as clearPureCallMemo, l as clearPureMemo, m as enterEvalCallBudgetSession, aC as evalExprAbs, o as exitEvalCallBudgetSession, u as getEvalCallBudgetState, aF as getEvalCallCollector, v as getEvalFallbackStats, aM as isAbsVal, b2 as noteEvalCallRecord, b3 as noteEvalFallback, bk as resetEvalCallBudget, G as resetEvalFallbackStats, bE as routeApplyThrows, bl as runTranspiled, bm as runTranspiledOptionsMemoKey, bn as setEvalAssignCollector, bo as setEvalBindingSink, bp as setEvalCallCollector, bq as setEvalFallbackCollector, bB as tryRunTranspiled, N as withEvalBudgetOverride } from './run-BuTz_p4k.js';
1
+ import { A as Abs, M as MayThrowEffect, b as Phi } from './run-CDaGIWH_.js';
2
+ export { W as $assignRecord, X as $call, Y as $callNamed, Z as $recordBinding, a5 as EvalAbsAssignRecord, a6 as EvalCallRecord, a7 as EvalFallback, f as EvalFallbackStats, aa as MAX_EVAL_CALL_DEPTH, ab as MAX_EVAL_TOTAL_CALLS, ac as RUNTIME_IMPORT_RE, V as RunTranspiledOptions, ae as TranspiledCallResult, as as bindingsOf, av as callTranspiledExport, aw as callTranspiledExportApply, ax as callTranspiledExportFull, k as clearPureCallMemo, l as clearPureMemo, m as enterEvalCallBudgetSession, aC as evalExprAbs, o as exitEvalCallBudgetSession, u as getEvalCallBudgetState, aF as getEvalCallCollector, v as getEvalFallbackStats, aN as isAbsVal, b3 as noteEvalCallRecord, b4 as noteEvalFallback, bl as resetEvalCallBudget, G as resetEvalFallbackStats, bF as routeApplyThrows, bm as runTranspiled, bn as runTranspiledOptionsMemoKey, bo as setEvalAssignCollector, bp as setEvalBindingSink, bq as setEvalCallCollector, br as setEvalFallbackCollector, bC as tryRunTranspiled, N as withEvalBudgetOverride } from './run-CDaGIWH_.js';
3
3
  import { Node, Expression, File } from '@babel/types';
4
4
 
5
5
  /**
@@ -37,6 +37,9 @@ declare function withExecPhi<T>(p: Phi, body: () => T): T;
37
37
  * extractParamNames 回退口径一致);带真实参数名走 $fnVal(transpile 侧)。
38
38
  */
39
39
  declare function asAbsVal(v: unknown): Abs;
40
+ /** transpile 侧收形入口(instanceof RHS 值等):host 裸值 / Abs → Abs。
41
+ * `$` 前缀是运行时绑定表(runtimeArgNames)的注入约定。 */
42
+ declare function $absVal(v: unknown): Abs;
40
43
  /**
41
44
  * 函数调用边界:callee 的 loop/early-return 不得冒泡成 caller 结果。
42
45
  * 每个 求值引擎调用帧独立 ALS;NudoReturn 收成该调用的返回值。
@@ -47,10 +50,14 @@ declare function asAbsVal(v: unknown): Abs;
47
50
  * always-throw 走 NudoThrow 异常原样 rethrow(不经此转发)。
48
51
  */
49
52
  declare function callAtFunctionBoundary<T>(body: () => T): T;
50
- /** 函数表达式 → 一等 fn Abs(transpile 侧带真实参数名;异步 body 包 $async)
51
- * opts.bindThis:对象方法——$invoke 会把 receiver 作为 impl 首参注入。 */
53
+ /**
54
+ * 函数表达式 → 一等 fn Abs(transpile 侧带真实参数名;异步 body 包 $async)
55
+ * opts.bindThis:对象方法——$invoke 会把 receiver 作为 impl 的首参注入。
56
+ * opts.ctor:Bug 9 可构造性 facet(箭头/方法/async/generator → false;
57
+ * 函数表达式/类表达式值 → true)。 */
52
58
  declare function $fnVal(params: string[], impl: (...args: Abs[]) => Abs, opts?: {
53
59
  bindThis?: boolean;
60
+ ctor?: boolean;
54
61
  }): Abs;
55
62
  /**
56
63
  * 宿主 this → Abs:函数体 prologue 用它承接 call/apply/bind 传入的 thisArg。
@@ -59,6 +66,8 @@ declare function $fnVal(params: string[], impl: (...args: Abs[]) => Abs, opts?:
59
66
  * globalThis——归一到 $lit(undefined)(strict 模块语义下的 this)。
60
67
  */
61
68
  declare function $rawThis(v: unknown): Abs;
69
+ /** `new.target` 读:栈顶类值;普通调用面已清空 → undefined 字面量 */
70
+ declare function $newTarget(): Abs;
62
71
  /** 字面量 → Abs(transpile 侧数字/字符串/布尔/null/undefined) */
63
72
  declare function $lit(v: unknown): Abs;
64
73
  /** JS 真值:字面量按 Boolean(v);对象形恒真;不可判 → undefined */
@@ -188,18 +197,23 @@ declare function lookupObjAccessor(o: Abs, key: string): {
188
197
  declare function $in(key: Abs, o: Abs): Abs;
189
198
  /**
190
199
  * `x instanceof Right`(Right 为标识符名):按左值形状精确判定。
191
- * nullish 左侧原生抛 TypeError → unknown;未知用户构造器名 → boolean(不得 exact false)。
200
+ * RHS 非对象 → 原生 definite TypeError;nullish 左侧原生**不抛**(无装箱、
201
+ * OrdinaryHasInstance 恒 false)→ 精确 boolLit(false);未知用户构造器名 →
202
+ * boolean(不得 exact false)。
192
203
  */
193
204
  declare function $instanceof(left: Abs, rightName: string, rightVal?: Abs): Abs;
194
- /** instanceof 右操作数非标识符(表达式/成员路径):构造器值未知 → 抽象 boolean */
195
- declare function $instanceofNonIdent(_left: Abs): Abs;
205
+ /** instanceof 右操作数非标识符(表达式/成员路径):RHS 值传入时先做原生
206
+ * 非对象校验(definite / may TypeError);构造器值未知 → 抽象 boolean */
207
+ declare function $instanceofNonIdent(left: Abs, right?: Abs): Abs;
196
208
  /** ClassExpression 值:构造器函数形状,不得折成精确 undefined */
197
209
  declare function $classExpr(): Abs;
198
210
  /**
199
211
  * `delete obj[key]` 的结果判定(只读,不写回)。
200
212
  * frozen/sealed 或 configurable:false 键 → false;preventExtensions 可删;
201
213
  * closed 目标恒 true(其余 non-configurable 形态不建模);
202
- * prim/nullish 接收者原生抛 TypeError → unknown。
214
+ * nullish 接收者原生 definite TypeError(ToObject(null) 抛)→ hard NudoThrow;
215
+ * 非 nullish prim 接收者原生不抛(装箱临时对象上 delete 恒 true,strict 亦然)
216
+ * → 保持 unknown 折叠;any/unknown 接收者可能 nullish → may TypeError。
203
217
  */
204
218
  declare function $delRes(o: Abs, _key: Abs): Abs;
205
219
  /**
@@ -312,7 +326,9 @@ declare function $copy(a: Abs): Abs;
312
326
  * 可见);transpile 重绑 `a = $arrMutContainer(a, …)` 仍写回同一对象。 */
313
327
  declare function $arrMutContainer(arr: Abs, method: string, args: Abs[]): Abs;
314
328
  /** 下标读 a[i];规范数组下标走精确投影,确定非下标键 → undefined,否则并所有元素;string[i] → 单字符 */
315
- declare function $idx(a: Abs, i: Abs): Abs;
329
+ declare function $idx(a: Abs, i: Abs, opts?: {
330
+ silent?: boolean;
331
+ }): Abs;
316
332
  /** 下标写 a[i]=v → 新 tuple(越界写按 JS 语义增长,空洞为 undefined) */
317
333
  declare function $idxSet(a: Abs, i: Abs, value: Abs): Abs;
318
334
  /** 数组/字符串长度 */
@@ -337,9 +353,22 @@ declare function $objRest(o: Abs, keys: string[]): Abs;
337
353
  declare function $arrRest(a: Abs, start: number): Abs;
338
354
  /** 数组连接 [...a, ...b] / [...a, x];结果超 cap 时与字面量同策略降 arr */
339
355
  declare function $concat(a: Abs, b: Abs): Abs;
356
+ /** 数组解构模式接收者守卫:原生数组解构 = GetIterator + IteratorNext,
357
+ * 非可迭代接收者抛 TypeError。emitDestructure 的 ArrayPattern 分支在逐项
358
+ * $idx / $arrRest 投影前调用;值域投影不变(字符串/元组等可迭代接收者
359
+ * 不受影响)。 */
360
+ declare function $iterCheck(a: unknown): void;
340
361
  /** 元素列表(tuple 展开;arr 抽象;C1 Set/Map 逐条目;matchAll 迭代器逐匹配项;
341
- * 字符串按 code points)。Map 迭代语义是 entry `[key, value]` 元组,不是裸 value。 */
362
+ * 字符串按 code points)。Map 迭代语义是 entry `[key, value]` 元组,不是裸 value。
363
+ * 消费前先过可迭代性守卫(Bug 6):prim 字面量接收者 → 原生 definite
364
+ * TypeError;any/unknown → may。$forOf 与 call/new spread 实参路径继承。 */
342
365
  declare function $elems(a: Abs): Abs[];
366
+ /** 模板标签对象(GetTemplateObject,Bug 34):冻结的类数组 obj——数字槽
367
+ * 为 cooked 字符串(无效转义序列时 cooked 是 undefined,原生实测)、
368
+ * length 精确、.raw 为 raw 字符串数组;@@iterator 槽给函数形状
369
+ * (`[...s]` / `for..of` / `Symbol.iterator in s` 均按可迭代面判定,
370
+ * 不得把冻结数组误判 definite 不可迭代)。 */
371
+ declare function $tpl(cooked: Array<string | undefined>, raw: string[]): Abs;
343
372
  /**
344
373
  * for-of:对 iterable 每个元素跑 body;有界展开。
345
374
  * body(item, i) 可返回 void;状态由外部 JS 变量承接。
@@ -356,6 +385,10 @@ declare function $forOf(iterable: Abs, body: (item: Abs, index: Abs) => void, ma
356
385
  unpack?: (s: Abs) => void;
357
386
  /** 标签循环:仅吸收同标签 break/continue 信号 */
358
387
  label?: string;
388
+ /** for await:接收者按 GetIterator(hint=async) 校验(@@asyncIterator 槽
389
+ * 即全量);仅异步可迭代(无 @@iterator 槽)的接收者不折同步槽位投影,
390
+ * 元素取抽象 unknown(原生由 next() 链驱动)。 */
391
+ forAwait?: boolean;
359
392
  }): void;
360
393
  declare function namespaceNameOf(v: unknown): string | undefined;
361
394
  /** 正则字面量 → RegExp brand(source/flags/lastIndex 进 slots,供 exec/test 精确执行) */
@@ -385,10 +418,24 @@ declare function $async(thunk: () => Abs): Abs;
385
418
  declare function $await(v: Abs): Abs;
386
419
  /** async 直接 return 的 coerce */
387
420
  declare function $asyncReturn(v: Abs): Abs;
388
- /** function* 体:收集所有 yield 值为 tuple Abs;抽象分支时降 conf(P0-6) */
421
+ /** function* 体:收集所有 yield 值为 tuple Abs;抽象分支时降 conf(P0-6)
422
+ *
423
+ * Bug 58:调用生成器是原生全操作——体只在首个 next() 执行。此前 body()
424
+ * eager 执行把体内 may-throw(成员读 any)/显式 throw 折进**调用方** throws
425
+ * 域(每生成器入口假 entry-may-throw)。现以丢弃式 may-throw 帧包裹:
426
+ * soft 效果进帧后丢弃、NudoThrow/宿主异常吞掉(迭代期语义,调用期不表面)。
427
+ * yield 收集保持 eager(既有值域建模,注释口径不变)。 */
389
428
  declare function $gen(body: () => void): Abs;
390
429
  /** yield v:压入当前生成器收集器;表达式值用 unknown */
391
430
  declare function $yield(v: Abs): Abs;
431
+ /** yield* v(Bug 82):委托迭代 ≠ yield v——GetIterator 校验先行($elems
432
+ * 同分类器:非可迭代接收者 definite/may TypeError,生成器体内按 $gen
433
+ * 迭代期语义由外层帧吸收),**元素**逐个压入收集器(此前把整个可迭代值
434
+ * 压一次);表达式值 = 内层迭代器的 return 值(生成器 return / 自定义
435
+ * iterator 的 done 值,不可判)→ 保守 unknown。长度不可判的接收者
436
+ * (arr/any/…)单代表元素过近似并入 + bumpGenPathSensitive 压 conf
437
+ * (mergeArmYields 同口径,禁 exact 元组出货)。 */
438
+ declare function $yieldStar(v: unknown): Abs;
392
439
  /**
393
440
  * `??` 非 nullish 臂:从左值 Abs 剥离 nullish 部分($nullishTest 判 true
394
441
  * 的成员)。索引访问 `M[k]` 对抽象键产出 joinAbs(element, undef()),
@@ -514,6 +561,12 @@ type EvalClassAccessor = {
514
561
  type EvalClassSpec = {
515
562
  name: string;
516
563
  superName?: string;
564
+ /**
565
+ * Bug 11:`class C extends null`(合法——原型链无 super,但构造受限)。
566
+ * 隐式 ctor 等价 super(...args),原生 new C() 抛 TypeError
567
+ * (Super constructor null … is not a constructor);显式 super() 同抛($super)。
568
+ */
569
+ superNull?: boolean;
517
570
  ctor?: (thisVal: Abs, ...args: Abs[]) => Abs;
518
571
  methods?: Record<string, (thisVal: Abs, ...args: Abs[]) => Abs>;
519
572
  /** 实例方法形参展示名(AST 形参名;未调用方法槽 `shape.params` 用) */
@@ -522,6 +575,23 @@ type EvalClassSpec = {
522
575
  /** 静态方法形参展示名 */
523
576
  staticMethodParams?: Record<string, string[]>;
524
577
  statics?: Record<string, Abs>;
578
+ /**
579
+ * Bug 59:实例字段——每次 $new 以新实例为 this 按源序求值(原生
580
+ * InitializeInstanceElements)。name 为字面量键;key 为计算键的
581
+ * 每次构造求值 thunk(原生计算键逐实例求值);抽象键不可静态命名
582
+ * → 跳过(不假精确挂名)。
583
+ */
584
+ instanceFields?: Array<{
585
+ name?: string;
586
+ key?: (thisVal: Abs) => Abs;
587
+ init: (thisVal: Abs) => Abs;
588
+ }>;
589
+ /**
590
+ * Bug 60:计算键成员——synth 名 → 键 Abs(定义期求值,求值本身即
591
+ * 记录 throws)。$class 折叠字面量 string/number 键为真名重挂;
592
+ * 抽象键(any/symbol/…)不可静态列举 → 成员不挂名(不静默错名)。
593
+ */
594
+ computedKeys?: Record<string, unknown>;
525
595
  /** 实例 get/set:get 无参返回 Abs;set 收到 (thisVal, v) 返回更新后的 thisVal */
526
596
  accessors?: Record<string, EvalClassAccessor>;
527
597
  /** 静态 get/set:挂在类构造器上,不在实例原型链 */
@@ -550,9 +620,17 @@ declare function $reStateCall(re: Abs, method: string, args: Abs[]): Abs;
550
620
  /** 定义类 → 可 new 的 Abs(brand 标记;静态字段挂在 slots) */
551
621
  declare function $class(name: string, spec: Omit<EvalClassSpec, "name"> & {
552
622
  extends?: string | Abs | unknown;
623
+ hasExtends?: boolean;
553
624
  }): Abs;
554
625
  /** new C(...) → 空 brand 实例 + ctor 写字段;非类构造走 impl/$call */
555
626
  declare function $new(cls: Abs | ((...a: unknown[]) => unknown), args: Abs[]): Abs;
627
+ /**
628
+ * Bug 77:静态块在类定义期执行(原生 ClassDefinitionEvaluation 的
629
+ * InitializeStaticElements)。transpile 在 `let C = $class(...)` 绑定完成
630
+ * **之后**发射本调用——块体内类名按词法可见(原生 static 块内类绑定已
631
+ * 初始化);this 绑定类值;块内 throw 在定义点表面(NudoThrow 上浮)。
632
+ */
633
+ declare function $staticInit(cls: Abs, thunks: Array<(thisVal: Abs) => unknown>): void;
556
634
  /**
557
635
  * super(...):父类构造写入字段(this 保持子类 brand)。
558
636
  * transpile: super(a,b) → __this = $super(__this, "Child", [a,b])
@@ -567,7 +645,8 @@ declare function $thisGet(thisVal: Abs, key: string): Abs;
567
645
  declare function $thisSet(thisVal: Abs, key: string, value: Abs): Abs;
568
646
  /** 解构默认值:undefined(含 sum 成员 / 可能缺失)时用 default 并入非 undefined 部分 */
569
647
  declare function $orDefault(v: Abs, dflt: () => Abs): Abs;
570
- /** 可选链 a?.b:nullish 短路为 undefined 字面量 */
648
+ /** 可选链 a?.b:nullish 短路为 undefined 字面量。非 nullish 臂的属性读对
649
+ * 非 nullish 值原生不抛 → silent(不记 any may-throw,Bug 3) */
571
650
  declare function $optionalGet(o: Abs, key: string): Abs;
572
651
  /** 可选链 a?.m():nullish 短路为 undefined */
573
652
  declare function $optionalInvoke(thisVal: Abs, method: string, args: Abs[]): Abs;
@@ -596,4 +675,4 @@ declare class NudoUnsupportedError extends Error {
596
675
  detail?: string);
597
676
  }
598
677
 
599
- 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, $removeNullish, $rethrowIfNudoReturn, $set, $setKey, $setProto, $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, 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 };
678
+ 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, $gt, $idx, $idxSet, $importMeta, $in, $instanceof, $instanceofNonIdent, $invoke, $invokeSuper, $isBreakTo, $isForkExit, $iterCheck, $join, $le, $len, $lit, $loopBreak, $loopContinue, $loopReturn, $lt, $mod, $mul, $ne, $neLoose, $neg, $new, $newTarget, $not, $nullishTest, $obj, $objAccessor, $objRest, $optionalGet, $optionalInvoke, $orDefault, $pow, $pushLoopExit, $rawThis, $reStateCall, $regex, $removeNullish, $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
@@ -1,5 +1,6 @@
1
1
  import "./chunk-US532PZA.js";
2
2
  import {
3
+ $absVal,
3
4
  $add,
4
5
  $arguments,
5
6
  $arr,
@@ -49,6 +50,7 @@ import {
49
50
  $invokeSuper,
50
51
  $isBreakTo,
51
52
  $isForkExit,
53
+ $iterCheck,
52
54
  $join,
53
55
  $le,
54
56
  $len,
@@ -63,6 +65,7 @@ import {
63
65
  $neLoose,
64
66
  $neg,
65
67
  $new,
68
+ $newTarget,
66
69
  $not,
67
70
  $nullishTest,
68
71
  $obj,
@@ -85,6 +88,7 @@ import {
85
88
  $shl,
86
89
  $shr,
87
90
  $spread,
91
+ $staticInit,
88
92
  $staticInvoke,
89
93
  $sub,
90
94
  $super,
@@ -94,6 +98,7 @@ import {
94
98
  $throw,
95
99
  $toNumber,
96
100
  $toNumeric,
101
+ $tpl,
97
102
  $tryCurrentMark,
98
103
  $tryDetachSoftCatch,
99
104
  $tryDigestSoftCatch,
@@ -112,6 +117,7 @@ import {
112
117
  $while,
113
118
  $whileSeq,
114
119
  $yield,
120
+ $yieldStar,
115
121
  DEFAULT_MAX_LOOP_ITERS,
116
122
  MAX_EVAL_CALL_DEPTH,
117
123
  MAX_EVAL_TOTAL_CALLS,
@@ -178,8 +184,9 @@ import {
178
184
  tryRunTranspiled,
179
185
  withEvalBudgetOverride,
180
186
  withExecPhi
181
- } from "./chunk-TO2W45NU.js";
187
+ } from "./chunk-EFOHREUZ.js";
182
188
  export {
189
+ $absVal,
183
190
  $add,
184
191
  $arguments,
185
192
  $arr,
@@ -229,6 +236,7 @@ export {
229
236
  $invokeSuper,
230
237
  $isBreakTo,
231
238
  $isForkExit,
239
+ $iterCheck,
232
240
  $join,
233
241
  $le,
234
242
  $len,
@@ -243,6 +251,7 @@ export {
243
251
  $neLoose,
244
252
  $neg,
245
253
  $new,
254
+ $newTarget,
246
255
  $not,
247
256
  $nullishTest,
248
257
  $obj,
@@ -265,6 +274,7 @@ export {
265
274
  $shl,
266
275
  $shr,
267
276
  $spread,
277
+ $staticInit,
268
278
  $staticInvoke,
269
279
  $sub,
270
280
  $super,
@@ -274,6 +284,7 @@ export {
274
284
  $throw,
275
285
  $toNumber,
276
286
  $toNumeric,
287
+ $tpl,
277
288
  $tryCurrentMark,
278
289
  $tryDetachSoftCatch,
279
290
  $tryDigestSoftCatch,
@@ -292,6 +303,7 @@ export {
292
303
  $while,
293
304
  $whileSeq,
294
305
  $yield,
306
+ $yieldStar,
295
307
  DEFAULT_MAX_LOOP_ITERS,
296
308
  MAX_EVAL_CALL_DEPTH,
297
309
  MAX_EVAL_TOTAL_CALLS,
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { c as AstEnv, A as Abs, b as Phi, T as Term, O as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, Q as HofSite, U as AbsModuleExports, V as RunTranspiledOptions } from './run-BuTz_p4k.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 ImplicationOracle, a9 as LitValueResult, L as LiteralValue, aa as MAX_EVAL_CALL_DEPTH, ab as MAX_EVAL_TOTAL_CALLS, P as PrimName, ac as RUNTIME_IMPORT_RE, ad as TYPEOF_NAMES, ae as TranspiledCallResult, af as TypeofName, ag as abs, ah as absFunction, ai as absOnly, aj as absToString, ak as and, al as anyAbs, am as anyVar, an as app, ao as assumeFinite, ap as attachFnImpl, aq as bigintLit, ar as bindImports, as as bindingsOf, at as bool, au as boolLit, av as callTranspiledExport, aw as callTranspiledExportApply, ax as callTranspiledExportFull, ay as collectAbsExports, az as confJoin, aA as emptyPhi, aB as eq, aC as evalExprAbs, aD as ge, aE as geNum, aF as getEvalCallCollector, aG as getFnImpl, aH as getImplicationOracle, aI as gt, aJ as gtNum, aK as implies, aL as isAbsApplyResult, aM as isAbsVal, aN as isBigPrim, aO as isExactLit, aP as isNumPrim, aQ as isStrPrim, aR as le, aS as leNum, aT as lit, aU as litValue, aV as lt, aW as ltNum, aX as makeAbsApplyResult, aY as markPureFn, aZ as namespaceAbsOf, a_ as ne, a$ as negatePred, b0 as never, b1 as not, b2 as noteEvalCallRecord, b3 as noteEvalFallback, b4 as num, b5 as numLit, b6 as numVar, b7 as obj, b8 as or, b9 as pFalse, ba as pTrue, bb as phiAnd, bc as predEquals, bd as predToString, be as predVars, bf as primToTypeof, bg as ptypeof, bh as pureFnNameOf, bi as relationFingerprint, bj as relationFn, bk as resetEvalCallBudget, bl as runTranspiled, bm as runTranspiledOptionsMemoKey, bn as setEvalAssignCollector, bo as setEvalBindingSink, bp as setEvalCallCollector, bq as setEvalFallbackCollector, br as setImplicationOracle, bs as shapeOfTerm, bt as shapeOnlyFn, bu as shapeToString, bv as simplifyTerm, bw as str, bx as strLit, by as substPred, bz as termEquals, bA as termToString, bB as tryRunTranspiled, bC as unknown, bD as v } from './run-BuTz_p4k.js';
1
+ import { c as AstEnv, A as Abs, b as Phi, T as Term, O as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, Q as HofSite, U as AbsModuleExports, V as RunTranspiledOptions } from './run-CDaGIWH_.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 ImplicationOracle, a9 as LitValueResult, L as LiteralValue, aa as MAX_EVAL_CALL_DEPTH, ab as MAX_EVAL_TOTAL_CALLS, P as PrimName, ac as RUNTIME_IMPORT_RE, ad as TYPEOF_NAMES, ae as TranspiledCallResult, af as TypeofName, ag as abs, ah as absFunction, ai as absOnly, aj as absToString, ak as and, al as anyAbs, am as anyVar, an as app, ao as assumeFinite, ap as attachFnImpl, aq as bigintLit, ar as bindImports, as as bindingsOf, at as bool, au as boolLit, av as callTranspiledExport, aw as callTranspiledExportApply, ax as callTranspiledExportFull, ay as collectAbsExports, az as confJoin, aA as emptyPhi, aB as eq, aC as evalExprAbs, aD as ge, aE as geNum, aF as getEvalCallCollector, aG as getFnImpl, aH as getImplicationOracle, aI as gt, aJ as gtNum, aK as hostFnCtorFacet, aL as implies, aM as isAbsApplyResult, aN as isAbsVal, aO as isBigPrim, aP as isExactLit, aQ as isNumPrim, aR as isStrPrim, aS as le, aT as leNum, aU as lit, aV as litValue, aW as lt, aX as ltNum, aY as makeAbsApplyResult, aZ as markPureFn, a_ as namespaceAbsOf, a$ as ne, b0 as negatePred, b1 as never, b2 as not, b3 as noteEvalCallRecord, b4 as noteEvalFallback, b5 as num, b6 as numLit, b7 as numVar, b8 as obj, b9 as or, ba as pFalse, bb as pTrue, bc as phiAnd, bd as predEquals, be as predToString, bf as predVars, bg as primToTypeof, bh as ptypeof, bi as pureFnNameOf, bj as relationFingerprint, bk as relationFn, bl as resetEvalCallBudget, bm as runTranspiled, bn as runTranspiledOptionsMemoKey, bo as setEvalAssignCollector, bp as setEvalBindingSink, bq as setEvalCallCollector, br as setEvalFallbackCollector, bs as setImplicationOracle, bt as shapeOfTerm, bu as shapeOnlyFn, bv as shapeToString, bw as simplifyTerm, bx as str, by as strLit, bz as substPred, bA as termEquals, bB as termToString, bC as tryRunTranspiled, bD as unknown, bE as v } from './run-CDaGIWH_.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-CWlRVYgL.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 InterfaceDiag, I as InterfaceSource, K as InterfaceTierInfo, a as InterfaceTierOpts, O as NamedImport, Q as NudoField, R as NudoFnConstraint, S as NudoSidecarError, T as NudoSig, U as RefineDiag, V as RefineEntry, W as RefineResolveOpts, X as SELF, Y as actionsForIssue, Z as andC, _ as any, $ as array, a0 as boolean, a1 as checkArg, a2 as checkCall, a3 as constraintAdmitsNullish, a4 as constraintToEntryAbs, a5 as drainPromiseMicros, a6 as effectiveInterface, a7 as enterPromiseExecutorScope, a8 as evalPromiseCtor, a9 as evalPromiseMethod, aa as evalPromiseStatic, ab as execNudoModule, ac as extractDeclaredThrows, ad as extractFnBudget, ae as extractNudoImports, af as extractRefineReturnFromSource, ag as extractRefinesFromSource, ah as fn, ai as fnConstraintToEntryReqs, aj as formatCheckReport, ak as formatConstraint, al as formatDiagnostics, am as formatEffectiveInterfaceDisplay, an as formatGithubAnnotations, ao as formatGitlabCodeQuality, ap as formatInterfaceTierLine, aq as generatedExportNames, ar as getParseSourceCacheSize, as as getTerm, at as instantiateConstraint, au as interfaceDiagCount, av as interfaceSourceOf, aw as interfaceTierOf, ax as isIntFlag, ay as isNodeModulesPath, az as isNudoConstraint, aA as leavePromiseExecutorScope, aB as lenTerm, aC as litC, aD as localNamedExports, aE as notePromiseExecutorFork, aF as nullable, aG as number, aH as omit, aI as partial, aJ as pick, aK as queuePromiseMicro, aL as refineDiagCount, aM as refineToIndexedFull, aN as resetNudoModuleExecCache, aO as resetParseSourceCache, aP as resetSidecarLoadFailureCache, aQ as serializeCheckJson, aR as serializeCheckJsonMulti, aS as setInterfaceDiagCollector, aT as setRefineDiagCollector, aU as shape, aV as sidecarClosureFingerprint, aW as sidecarPathOf, aX as string, aY as takeInterfaceDiags, aZ as takeInterfaceDiagsSince, a_ as takeRefineDiags, a$ as takeRefineDiagsSince, b0 as throwConstraintToKinds, b1 as union } from './projection-budget-CWlRVYgL.js';
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-CTpsYz6K.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 InterfaceDiag, I as InterfaceSource, K as InterfaceTierInfo, a as InterfaceTierOpts, O as NamedImport, Q as NudoField, R as NudoFnConstraint, S as NudoSidecarError, T as NudoSig, U as RefineDiag, V as RefineEntry, W as RefineResolveOpts, X as SELF, Y as actionsForIssue, Z as andC, _ as any, $ as array, a0 as boolean, a1 as checkArg, a2 as checkCall, a3 as constraintAdmitsNullish, a4 as constraintToEntryAbs, a5 as drainPromiseMicros, a6 as effectiveInterface, a7 as enterPromiseExecutorScope, a8 as evalPromiseCtor, a9 as evalPromiseMethod, aa as evalPromiseStatic, ab as execNudoModule, ac as extractDeclaredThrows, ad as extractFnBudget, ae as extractNudoImports, af as extractRefineReturnFromSource, ag as extractRefinesFromSource, ah as fn, ai as fnConstraintToEntryReqs, aj as formatCheckReport, ak as formatConstraint, al as formatDiagnostics, am as formatEffectiveInterfaceDisplay, an as formatGithubAnnotations, ao as formatGitlabCodeQuality, ap as formatInterfaceTierLine, aq as generatedExportNames, ar as getParseSourceCacheSize, as as getTerm, at as instantiateConstraint, au as interfaceDiagCount, av as interfaceSourceOf, aw as interfaceTierOf, ax as isIntFlag, ay as isNodeModulesPath, az as isNudoConstraint, aA as leavePromiseExecutorScope, aB as lenTerm, aC as litC, aD as localNamedExports, aE as notePromiseExecutorFork, aF as nullable, aG as number, aH as omit, aI as partial, aJ as pick, aK as queuePromiseMicro, aL as refineDiagCount, aM as refineToIndexedFull, aN as resetNudoModuleExecCache, aO as resetParseSourceCache, aP as resetSidecarLoadFailureCache, aQ as serializeCheckJson, aR as serializeCheckJsonMulti, aS as setInterfaceDiagCollector, aT as setRefineDiagCollector, aU as shape, aV as sidecarClosureFingerprint, aW as sidecarPathOf, aX as string, aY as takeInterfaceDiags, aZ as takeInterfaceDiagsSince, a_ as takeRefineDiags, a$ as takeRefineDiagsSince, b0 as throwConstraintToKinds, b1 as union } from './projection-budget-CTpsYz6K.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
  /**
@@ -242,7 +242,7 @@ declare function mapElementFallback(cbAbs: Abs | undefined, elem: Abs, out: Abs)
242
242
  /**
243
243
  * flatMap 统一结果:展开后的元素 join 成 arr(γ)。
244
244
  * JS flatMap 永远返回 Array;双路径共用此投影,禁止一边 tuple 一边 arr。
245
- * 同 term 元素 first-wins(joinAbs 会丢 β 身份,见 design §5.1)。
245
+ * 同 lit/var term 元素 first-wins(joinAbs 会丢 β 身份,见 design §5.1)。
246
246
  */
247
247
  declare function projectFlatMapResult(arrConf: Confidence, mapped: Abs[]): Abs;
248
248
  /** 从 map/filter/reduce 回调实参里取出 Abs(Identifier 已绑定或直接 Abs) */
@@ -415,12 +415,18 @@ declare function makeArrayCtorAbs(args: Abs[]): Abs;
415
415
  declare function evalArrayStatic(name: string, args: Abs[]): Abs | undefined;
416
416
 
417
417
  /**
418
- * Date 构造 / Date.* / Date 实例方法(保守未建模)
418
+ * Date 构造 / Date.* / Date 实例方法。
419
+ * Bug 24:构造器实参强转校验——单参形式 ToPrimitive(number)→ToNumber:
420
+ * symbol/bigint 值(prim 或字面量)确定 TypeError(node 实测 new Date(1n) 抛,
421
+ * 与 bug 文本一致);Date brand 豁免(读 [[TimeValue]]);闭 obj 字面量无自有
422
+ * coercer 槽 total(ToPrimitive 恒得 "[object Object]" → Invalid Date);其余
423
+ * 抽象 may(coercer 可能产 Symbol/BigInt)。多参形式每个实参直接 ToNumber。
424
+ * Bug 62:setter 实参逐个 ToNumber 校验;getter/toString 族值域建模。
419
425
  */
420
426
 
421
427
  declare function evalDateCtor(args: Abs[]): Abs;
422
428
  declare function evalDateStatic(name: string, _args: Abs[]): Abs | undefined;
423
- declare function evalDateMethod(name: string, _recv: Abs, _args: Abs[]): Abs | undefined;
429
+ declare function evalDateMethod(name: string, recv: Abs, args: Abs[]): Abs | undefined;
424
430
 
425
431
  /**
426
432
  * RegExp 构造 / brand / 实例方法
@@ -432,10 +438,16 @@ declare function regexBrandAbsFrom(pattern: string, flags: string): Abs;
432
438
  /**
433
439
  * new RegExp(pattern, flags) 字面量真构造验证($new 与 evalRegExpCtor 共用):
434
440
  * - 无参 → /(?:)/(原生 source 归一)
435
- * - pattern 非字面量(抽象/RegExp 实例)→ undefined(调用方保守)
436
- * - symbol pattern / flags → TypeError(ToString 抛)
441
+ * - symbol pattern/flags → 确定 TypeError(ToString 抛;shape 判定——Symbol()
442
+ * 无 lit 项,原先的 lit 分支内检查是死代码,Bug 29/52)
437
443
  * - 非法 pattern / 非法 flags(含 number/null/boolean flags 的 ToString)
438
444
  * → SyntaxError;合法 → 精确 brand(source/flags 取真构造结果)
445
+ * - 抽象 pattern/flags → undefined(调用方保守)+ 档位打点(见各分支):
446
+ * obj/fn/brand/sum/any → may TypeError(自定义 coercer 可能产 Symbol);
447
+ * 抽象 prim string pattern → ToString total(非法 pattern 的 SyntaxError
448
+ * 面不计);抽象 prim string flags → may SyntaxError;抽象 prim
449
+ * number/bool/bigint flags → ToString 恒非法 flags → 确定 SyntaxError
450
+ * (node 实测 new RegExp('a', 1n) → SyntaxError)
439
451
  */
440
452
  declare function tryMakeRegexAbs(args: Abs[]): Abs | undefined;
441
453
  declare function evalRegExpMethod(name: string, recv: Abs, args: Abs[]): Abs | undefined;
@@ -491,10 +503,16 @@ declare function evalBuiltinInstanceMethod(brandName: string, method: string, re
491
503
  */
492
504
 
493
505
  /**
494
- * String.fromCharCode(...):
495
- * - 全部字面量 → 按 ToUint16 折成精确字符串(含越界/非整数/数字字符串)
496
- * - symbol 字面量 → TypeError(ToNumber 抛)
497
- * - 任一抽象实参 → 抽象 string(不假精确)
506
+ * String.fromCharCode / String.fromCodePoint:
507
+ * - fromCharCode:全部字面量 → 按 ToUint16 折成精确字符串(含越界/非整数/
508
+ * 数字字符串);symbol 字面量 → TypeError(ToNumber 抛);任一抽象实参 →
509
+ * 抽象 string(不假精确)
510
+ * - fromCodePoint(Bug 38):字面量过 ToNumber 后 IsValidCodePoint 校验
511
+ * (node v26 实测:非整数/NaN/±∞/<0/>0x10FFFF → RangeError "Invalid
512
+ * code point";null/""/false → 0 合法;"65" → 65;surrogate 0xD800 合法);
513
+ * symbol/bigint 的 ToNumber → TypeError(fromCodePoint(1n) 原生抛,区别
514
+ * 于 fromCharCode 的 ToUint16 面——bigint ToString 合法但 ToNumber 抛);
515
+ * 抽象实参 → may RangeError(+ symbol 载体 may TypeError)+ str("path")
498
516
  */
499
517
  declare function evalStringStatic(name: string, args: Abs[]): Abs | undefined;
500
518
 
@@ -680,12 +698,15 @@ declare function isMapAbs(a: Abs | undefined): boolean;
680
698
  declare function isSetAbs(a: Abs | undefined): boolean;
681
699
  /**
682
700
  * 构造器实参**确定**非法(原生 TypeError 域):
683
- * - 非可迭代字面量(number/boolean/symbol/bigint、闭对象字面量)→ Set/Map 都抛
684
- * - Map 条目必须是对象:外层 iterable 出现 lit prim 条目(含字符串实参的
685
- * 每个字符、tuple/Set 元素)→ TypeError(空串例外:零条目合法)
701
+ * - 非可迭代字面量(number/boolean/symbol/bigint、闭对象字面量)→ 四个集合构造器都抛
702
+ * - Map/WeakMap 条目必须是对象:外层 iterable 出现 lit prim 条目(含字符串实参的
703
+ * 每个字符、tuple/Set 元素)→ TypeError(空串例外:零条目合法);
704
+ * WeakMap 键还必须可弱持有——tuple 条目首元素(键)为 prim → TypeError
705
+ * (Map 键可以是 prim,仅 WeakMap 抛 "Invalid value used as weak map key")
706
+ * - WeakSet 元素必须可弱持有:prim 元素(含字符串字符)→ TypeError
686
707
  * 抽象形态不确定 → false(保守)。
687
708
  */
688
- declare function ctorArgDefinitelyInvalid(name: "Map" | "Set", iterable: Abs | undefined): boolean;
709
+ declare function ctorArgDefinitelyInvalid(name: "Map" | "Set" | "WeakMap" | "WeakSet", iterable: Abs | undefined): boolean;
689
710
  declare function makeMapAbs(iterable?: Abs): Abs;
690
711
  declare function makeSetAbs(iterable?: Abs): Abs;
691
712
  /** Map#set:fork 内写 overlay;否则原地。返回同一 Abs(JS 可变语义) */
package/dist/index.js CHANGED
@@ -91,7 +91,7 @@ import {
91
91
  takeRefineDiagsSince,
92
92
  throwConstraintToKinds,
93
93
  union
94
- } from "./chunk-XVU2O6VF.js";
94
+ } from "./chunk-76KJ3D4D.js";
95
95
  import {
96
96
  $add,
97
97
  $arguments,
@@ -329,6 +329,7 @@ import {
329
329
  gt,
330
330
  gtNum,
331
331
  hostBuiltinCtorName,
332
+ hostFnCtorFacet,
332
333
  identBoundaryRegex,
333
334
  implies,
334
335
  instantiateReturn,
@@ -511,7 +512,7 @@ import {
511
512
  v,
512
513
  withExecPhi,
513
514
  withVar
514
- } from "./chunk-TO2W45NU.js";
515
+ } from "./chunk-EFOHREUZ.js";
515
516
 
516
517
  // src/environment.ts
517
518
  function createEnvironment(parent, bindings = /* @__PURE__ */ new Map()) {
@@ -2017,6 +2018,19 @@ function scanCaseInconsistency(source, knownFns, opts) {
2017
2018
  continue;
2018
2019
  }
2019
2020
  if (typeof argLit !== "number") continue;
2021
+ if (isIntFlag(entry.constraint) && !Number.isInteger(argLit)) {
2022
+ const paramName = entry.param || paramNames[idx] || `arg${idx}`;
2023
+ out.push({
2024
+ severity: "error",
2025
+ code: "nudo:case-inconsistency",
2026
+ message: `${fnName} case "${caseName}": witness \u22AD contract`,
2027
+ actual: formatAbs(arg),
2028
+ expected: formatConstraint(entry.constraint),
2029
+ suggestion: `change the case argument, or relax the refine on ${paramName}`,
2030
+ fn: fnName,
2031
+ line
2032
+ });
2033
+ }
2020
2034
  const flatten = (p) => p.op === "and" ? p.args.flatMap(flatten) : p.op === "true" ? [] : [p];
2021
2035
  for (const p of flatten(entry.pred)) {
2022
2036
  if ((p.op === "gt" || p.op === "ge" || p.op === "lt" || p.op === "le") && p.b.op === "lit" && typeof p.b.value === "number") {
@@ -2346,8 +2360,9 @@ function checkSourceInner(filePath, source, file, phi, opts, issues, signatures,
2346
2360
  (t) => t.value && t.value.shape.k === "unknown"
2347
2361
  );
2348
2362
  const budgetExplained = truncated.has(name) || g.symbolic?.conf === "opaque" || g.symbolic?.shape?.k === "sum" && g.symbolic.shape.members.every((m) => m.shape.k === "unknown" || m.shape.k === "any");
2349
- if ((g.symbolic?.shape?.k === "unknown" || unknownParamIdx >= 0) && !budgetExplained) {
2350
- const where = g.symbolic?.shape?.k === "unknown" ? `${name} => unknown` : `${name} param ${g.params[unknownParamIdx] ?? `#${unknownParamIdx}`}: unknown`;
2363
+ const symbolicTrueUnknown = g.symbolic?.shape?.k === "unknown" && g.symbolic.term?.op !== "lit";
2364
+ if ((symbolicTrueUnknown || unknownParamIdx >= 0) && !budgetExplained) {
2365
+ const where = symbolicTrueUnknown ? `${name} => unknown` : `${name} param ${g.params[unknownParamIdx] ?? `#${unknownParamIdx}`}: unknown`;
2351
2366
  issues.push({
2352
2367
  severity: "warning",
2353
2368
  code: "nudo:unknown-inference",
@@ -3236,6 +3251,7 @@ export {
3236
3251
  gt,
3237
3252
  gtNum,
3238
3253
  hostBuiltinCtorName,
3254
+ hostFnCtorFacet,
3239
3255
  implies,
3240
3256
  instantiateConstraint,
3241
3257
  instantiateReturn,
@@ -1,7 +1,7 @@
1
- import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-CWlRVYgL.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-CWlRVYgL.js';
3
- import { A as Abs, T as Term, c as AstEnv } from './run-BuTz_p4k.js';
4
- export { $ as $tryDigestSoft, d as $tryMarkSoft, e as $tryReleaseSoft, E as ERROR_FAMILY, f as EvalFallbackStats, M as MayThrowEffect, g as absLit, h as absNumLit, i as absStrLit, j as allAbsStr, k as clearPureCallMemo, l as clearPureMemo, m as enterEvalCallBudgetSession, n as errorTypeAbs, o as exitEvalCallBudgetSession, p as filterDeclaredThrows, q as filterGateThrows, r as filterIgnoredThrows, s as flushMayThrowEffects, t as formatThrowsAbs, u as getEvalCallBudgetState, v as getEvalFallbackStats, w as getMayThrowCollector, x as isThrowsIgnored, y as mayThrowEffectsToAbs, z as orphanMayThrowEffects, B as popMayThrowFrame, D as pushMayThrowFrame, F as recordMayThrow, G as resetEvalFallbackStats, H as runWithMayThrowSession, I as setMayThrowCollector, J as throwAbsToKinds, K as throwsKindCovered, N as withEvalBudgetOverride } from './run-BuTz_p4k.js';
1
+ import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-CTpsYz6K.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-CTpsYz6K.js';
3
+ import { A as Abs, T as Term, c as AstEnv } from './run-CDaGIWH_.js';
4
+ export { $ as $tryDigestSoft, d as $tryMarkSoft, e as $tryReleaseSoft, E as ERROR_FAMILY, f as EvalFallbackStats, M as MayThrowEffect, g as absLit, h as absNumLit, i as absStrLit, j as allAbsStr, k as clearPureCallMemo, l as clearPureMemo, m as enterEvalCallBudgetSession, n as errorTypeAbs, o as exitEvalCallBudgetSession, p as filterDeclaredThrows, q as filterGateThrows, r as filterIgnoredThrows, s as flushMayThrowEffects, t as formatThrowsAbs, u as getEvalCallBudgetState, v as getEvalFallbackStats, w as getMayThrowCollector, x as isThrowsIgnored, y as mayThrowEffectsToAbs, z as orphanMayThrowEffects, B as popMayThrowFrame, D as pushMayThrowFrame, F as recordMayThrow, G as resetEvalFallbackStats, H as runWithMayThrowSession, I as setMayThrowCollector, J as throwAbsToKinds, K as throwsKindCovered, N as withEvalBudgetOverride } from './run-CDaGIWH_.js';
5
5
  import { File, Node } from '@babel/types';
6
6
 
7
7
  /**
@@ -697,7 +697,10 @@ declare function popCallLoc(): void;
697
697
  declare function recordMemberDiag(d: EvalMemberDiag): void;
698
698
  /**
699
699
  * prim 接收者上的未知成员 → 诊断。
700
- * 返回 true 表示确定缺失(number 上任意方法;string 上表外方法)。
700
+ * 返回 true 表示确定缺失(原型方法表外;Object.prototype 名经装箱恒存在,
701
+ * 不算缺失)。kind === "method" 且确定缺失时,原生调用 undefined 成员是
702
+ * definite TypeError → 记入 throws 域(Bug 70;soft,与 noteNullishMemberThrows
703
+ * 同形,catch 可吸收),nudo:no-method 展示诊断保留。
701
704
  */
702
705
  declare function notePrimMemberMissing(recv: Abs | undefined, name: string, kind: "method" | "property", loc?: [number, number]): boolean;
703
706
  /** null / undefined(term lit null/undefined;shape unknown 兜底) */
package/dist/internal.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  stableAnalyzeKeySource,
22
22
  stablePathKey,
23
23
  stablePathKeyGraph
24
- } from "./chunk-XVU2O6VF.js";
24
+ } from "./chunk-76KJ3D4D.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-TO2W45NU.js";
172
+ } from "./chunk-EFOHREUZ.js";
173
173
 
174
174
  // src/algebra/inlay.ts
175
175
  function listFunctions(source) {
@@ -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-BuTz_p4k.js';
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-CDaGIWH_.js';
3
3
 
4
4
  declare function resetParseSourceCache(): void;
5
5
  declare function getParseSourceCacheSize(): number;
@@ -189,10 +189,19 @@ type Shape = {
189
189
  optional?: boolean;
190
190
  readonly?: boolean;
191
191
  }>;
192
+ /**
193
+ * 可构造性 facet(Bug 9):true = 可 new(函数声明/表达式、类表达式值);
194
+ * false = 不可 new(箭头/方法/generator/async)。缺省 = 未知
195
+ * (mock/relation/桥接/宿主包装)→ `$new` 记 may-throw。
196
+ * 与 pathNote 同纪律:展示/非值信息,不进 leq / 指纹 / check 等价。
197
+ */
198
+ ctor?: boolean;
192
199
  } | {
193
200
  k: "brand";
194
201
  name: string;
195
202
  shape: Abs;
203
+ ctor?: true;
204
+ tv?: number;
196
205
  } | {
197
206
  k: "eff";
198
207
  eff: "promise" | "generator";
@@ -624,7 +633,16 @@ declare function absFunction(params: string[], impl: Omit<AbsFnImpl, "params">,
624
633
  readonly?: boolean;
625
634
  }>;
626
635
  conf?: Confidence;
636
+ /** Bug 9 可构造性 facet:true/false 已知,缺省未知(见 Shape k:"fn".ctor) */
637
+ ctor?: boolean;
627
638
  }): Abs;
639
+ /**
640
+ * 宿主 JS 函数的可构造性(Bug 9):generator/async/async-generator 声明、
641
+ * 箭头、内建方法(无 .prototype)不可 new;bind 产物取决于目标(未知)。
642
+ * 函数声明/宿主构造器 → 可构造。求值引擎的函数声明编译成真实宿主函数,
643
+ * `$new` / `$class(extends)` / 桥接包装按此 stamping。
644
+ */
645
+ declare function hostFnCtorFacet(v: Function): boolean | undefined;
628
646
  /** relationFn 稳定 fingerprint(同签名共享,见 §3.3 已知限制) */
629
647
  declare function relationFingerprint(paramTypes: Abs[], returnType: Abs): string;
630
648
  /**
@@ -786,4 +804,4 @@ declare function callTranspiledExport(exports: Record<string, unknown>, name: st
786
804
  */
787
805
  declare function callTranspiledExportApply(exports: Record<string, unknown> | (() => Record<string, unknown>), name: string): (args: Abs[], thisVal?: Abs) => AbsApplyResult;
788
806
 
789
- export { $tryDigestSoft as $, type Abs as A, popMayThrowFrame as B, type Confidence as C, pushMayThrowFrame as D, ERROR_FAMILY as E, recordMayThrow as F, resetEvalFallbackStats as G, runWithMayThrowSession as H, setMayThrowCollector as I, throwAbsToKinds as J, throwsKindCovered as K, type LiteralValue as L, type MayThrowEffect as M, withEvalBudgetOverride as N, type HofCollectCtx as O, type PrimName as P, type HofSite as Q, type RelSource as R, type Shape as S, type Term as T, type AbsModuleExports as U, type RunTranspiledOptions as V, $assignRecord as W, $call as X, $callNamed as Y, $recordBinding as Z, type AbsApplyNoThrow as _, type Pred as a, negatePred as a$, type AbsApplyNoThrowFn as a0, type AbsApplyResult as a1, type AbsApplyReturn as a2, type AbsFnImpl as a3, type AbsSigImpl as a4, type EvalAbsAssignRecord as a5, type EvalCallRecord as a6, type EvalFallback as a7, type ImplicationOracle as a8, type LitValueResult as a9, emptyPhi as aA, eq as aB, evalExprAbs as aC, ge as aD, geNum as aE, getEvalCallCollector as aF, getFnImpl as aG, getImplicationOracle as aH, gt as aI, gtNum as aJ, implies as aK, isAbsApplyResult as aL, isAbsVal as aM, isBigPrim as aN, isExactLit as aO, isNumPrim as aP, isStrPrim as aQ, le as aR, leNum as aS, lit as aT, litValue as aU, lt as aV, ltNum as aW, makeAbsApplyResult as aX, markPureFn as aY, namespaceAbsOf as aZ, ne as a_, MAX_EVAL_CALL_DEPTH as aa, MAX_EVAL_TOTAL_CALLS as ab, RUNTIME_IMPORT_RE as ac, TYPEOF_NAMES as ad, type TranspiledCallResult as ae, type TypeofName as af, abs as ag, absFunction as ah, absOnly as ai, absToString as aj, and as ak, anyAbs as al, anyVar as am, app as an, assumeFinite as ao, attachFnImpl as ap, bigintLit as aq, bindImports as ar, bindingsOf as as, bool as at, boolLit as au, callTranspiledExport as av, callTranspiledExportApply as aw, callTranspiledExportFull as ax, collectAbsExports as ay, confJoin as az, type Phi as b, never as b0, not as b1, noteEvalCallRecord as b2, noteEvalFallback as b3, num as b4, numLit as b5, numVar as b6, obj as b7, or as b8, pFalse as b9, termToString as bA, tryRunTranspiled as bB, unknown as bC, v as bD, routeApplyThrows as bE, pTrue as ba, phiAnd as bb, predEquals as bc, predToString as bd, predVars as be, primToTypeof as bf, ptypeof as bg, pureFnNameOf as bh, relationFingerprint as bi, relationFn as bj, resetEvalCallBudget as bk, runTranspiled as bl, runTranspiledOptionsMemoKey as bm, setEvalAssignCollector as bn, setEvalBindingSink as bo, setEvalCallCollector as bp, setEvalFallbackCollector as bq, setImplicationOracle as br, shapeOfTerm as bs, shapeOnlyFn as bt, shapeToString as bu, simplifyTerm as bv, str as bw, strLit as bx, substPred as by, termEquals as bz, type AstEnv as c, $tryMarkSoft as d, $tryReleaseSoft as e, type EvalFallbackStats as f, absLit as g, absNumLit as h, absStrLit as i, allAbsStr as j, clearPureCallMemo as k, clearPureMemo as l, enterEvalCallBudgetSession as m, errorTypeAbs as n, exitEvalCallBudgetSession as o, filterDeclaredThrows as p, filterGateThrows as q, filterIgnoredThrows as r, flushMayThrowEffects as s, formatThrowsAbs as t, getEvalCallBudgetState as u, getEvalFallbackStats as v, getMayThrowCollector as w, isThrowsIgnored as x, mayThrowEffectsToAbs as y, orphanMayThrowEffects as z };
807
+ export { $tryDigestSoft as $, type Abs as A, popMayThrowFrame as B, type Confidence as C, pushMayThrowFrame as D, ERROR_FAMILY as E, recordMayThrow as F, resetEvalFallbackStats as G, runWithMayThrowSession as H, setMayThrowCollector as I, throwAbsToKinds as J, throwsKindCovered as K, type LiteralValue as L, type MayThrowEffect as M, withEvalBudgetOverride as N, type HofCollectCtx as O, type PrimName as P, type HofSite as Q, type RelSource as R, type Shape as S, type Term as T, type AbsModuleExports as U, type RunTranspiledOptions as V, $assignRecord as W, $call as X, $callNamed as Y, $recordBinding as Z, type AbsApplyNoThrow as _, type Pred as a, ne as a$, type AbsApplyNoThrowFn as a0, type AbsApplyResult as a1, type AbsApplyReturn as a2, type AbsFnImpl as a3, type AbsSigImpl as a4, type EvalAbsAssignRecord as a5, type EvalCallRecord as a6, type EvalFallback as a7, type ImplicationOracle as a8, type LitValueResult as a9, emptyPhi as aA, eq as aB, evalExprAbs as aC, ge as aD, geNum as aE, getEvalCallCollector as aF, getFnImpl as aG, getImplicationOracle as aH, gt as aI, gtNum as aJ, hostFnCtorFacet as aK, implies as aL, isAbsApplyResult as aM, isAbsVal as aN, isBigPrim as aO, isExactLit as aP, isNumPrim as aQ, isStrPrim as aR, le as aS, leNum as aT, lit as aU, litValue as aV, lt as aW, ltNum as aX, makeAbsApplyResult as aY, markPureFn as aZ, namespaceAbsOf as a_, MAX_EVAL_CALL_DEPTH as aa, MAX_EVAL_TOTAL_CALLS as ab, RUNTIME_IMPORT_RE as ac, TYPEOF_NAMES as ad, type TranspiledCallResult as ae, type TypeofName as af, abs as ag, absFunction as ah, absOnly as ai, absToString as aj, and as ak, anyAbs as al, anyVar as am, app as an, assumeFinite as ao, attachFnImpl as ap, bigintLit as aq, bindImports as ar, bindingsOf as as, bool as at, boolLit as au, callTranspiledExport as av, callTranspiledExportApply as aw, callTranspiledExportFull as ax, collectAbsExports as ay, confJoin as az, type Phi as b, negatePred as b0, never as b1, not as b2, noteEvalCallRecord as b3, noteEvalFallback as b4, num as b5, numLit as b6, numVar as b7, obj as b8, or as b9, termEquals as bA, termToString as bB, tryRunTranspiled as bC, unknown as bD, v as bE, routeApplyThrows as bF, pFalse as ba, pTrue as bb, phiAnd as bc, predEquals as bd, predToString as be, predVars as bf, primToTypeof as bg, ptypeof as bh, pureFnNameOf as bi, relationFingerprint as bj, relationFn as bk, resetEvalCallBudget as bl, runTranspiled as bm, runTranspiledOptionsMemoKey as bn, setEvalAssignCollector as bo, setEvalBindingSink as bp, setEvalCallCollector as bq, setEvalFallbackCollector as br, setImplicationOracle as bs, shapeOfTerm as bt, shapeOnlyFn as bu, shapeToString as bv, simplifyTerm as bw, str as bx, strLit as by, substPred as bz, type AstEnv as c, $tryMarkSoft as d, $tryReleaseSoft as e, type EvalFallbackStats as f, absLit as g, absNumLit as h, absStrLit as i, allAbsStr as j, clearPureCallMemo as k, clearPureMemo as l, enterEvalCallBudgetSession as m, errorTypeAbs as n, exitEvalCallBudgetSession as o, filterDeclaredThrows as p, filterGateThrows as q, filterIgnoredThrows as r, flushMayThrowEffects as s, formatThrowsAbs as t, getEvalCallBudgetState as u, getEvalFallbackStats as v, getMayThrowCollector as w, isThrowsIgnored as x, mayThrowEffectsToAbs as y, orphanMayThrowEffects as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nudojs/core",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },