@nudojs/core 1.3.0 → 1.4.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/{check-report-BWmfy810.d.ts → check-report-Ci1dDysO.d.ts} +52 -27
- package/dist/{chunk-5YNR4Q7E.js → chunk-7QUVTEYZ.js} +817 -169
- package/dist/{chunk-CKH6GQAI.js → chunk-LFCF6BLE.js} +441 -189
- package/dist/exec.d.ts +8 -16
- package/dist/exec.js +9 -1
- package/dist/index.d.ts +119 -109
- package/dist/index.js +98 -63
- package/dist/internal.d.ts +4 -4
- package/dist/internal.js +39 -27
- package/dist/{run-Dk08Q5zl.d.ts → run-WJfj477N.d.ts} +186 -3
- package/package.json +1 -1
|
@@ -1097,7 +1097,7 @@ function isExactLit(a) {
|
|
|
1097
1097
|
return a.conf === "exact" && a.term?.op === "lit";
|
|
1098
1098
|
}
|
|
1099
1099
|
function litValue(a) {
|
|
1100
|
-
return a?.term?.op === "lit" ? a.term.value :
|
|
1100
|
+
return a?.term?.op === "lit" ? { ok: true, value: a.term.value } : { ok: false };
|
|
1101
1101
|
}
|
|
1102
1102
|
|
|
1103
1103
|
// src/strip-types.ts
|
|
@@ -1307,6 +1307,15 @@ function parseSource(source, opts) {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
|
|
1309
1309
|
// src/algebra/abs-fn.ts
|
|
1310
|
+
function makeAbsApplyResult(abs2, throws) {
|
|
1311
|
+
return { abs: abs2, throws, applyResult: true };
|
|
1312
|
+
}
|
|
1313
|
+
function isAbsApplyResult(v2) {
|
|
1314
|
+
return !!v2 && typeof v2 === "object" && v2.applyResult === true;
|
|
1315
|
+
}
|
|
1316
|
+
function absOnly(r) {
|
|
1317
|
+
return isAbsApplyResult(r) ? r.abs : r;
|
|
1318
|
+
}
|
|
1310
1319
|
var implByAbs = /* @__PURE__ */ new WeakMap();
|
|
1311
1320
|
function attachFnImpl(a, impl) {
|
|
1312
1321
|
if (a && typeof a === "object") implByAbs.set(a, impl);
|
|
@@ -1520,8 +1529,10 @@ function derivationChain(node) {
|
|
|
1520
1529
|
}
|
|
1521
1530
|
function noteDerivationAdd(a, b, result) {
|
|
1522
1531
|
if (!sessionNodes) return;
|
|
1523
|
-
const
|
|
1524
|
-
const
|
|
1532
|
+
const vbR = litValue(b);
|
|
1533
|
+
const vb = vbR.ok ? vbR.value : void 0;
|
|
1534
|
+
const vaR = litValue(a);
|
|
1535
|
+
const va = vaR.ok ? vaR.value : void 0;
|
|
1525
1536
|
let parent;
|
|
1526
1537
|
let offset;
|
|
1527
1538
|
if (typeof vb === "number" && Number.isFinite(vb)) {
|
|
@@ -1629,7 +1640,8 @@ function setSlot(slots, key, slot) {
|
|
|
1629
1640
|
});
|
|
1630
1641
|
}
|
|
1631
1642
|
function setProtoAbs(o, proto) {
|
|
1632
|
-
const
|
|
1643
|
+
const pvR = litValue(proto);
|
|
1644
|
+
const pv = pvR.ok ? pvR.value : void 0;
|
|
1633
1645
|
if (pv === null) return markNullProtoObj(o);
|
|
1634
1646
|
if (proto.term?.op === "lit" && (pv === void 0 || typeof pv !== "object")) {
|
|
1635
1647
|
return o;
|
|
@@ -1731,11 +1743,13 @@ function joinObjects(a, b) {
|
|
|
1731
1743
|
function joinValues(a, b) {
|
|
1732
1744
|
if (a.shape.k === "never") return b;
|
|
1733
1745
|
if (b.shape.k === "never") return a;
|
|
1734
|
-
const
|
|
1735
|
-
const
|
|
1736
|
-
if (
|
|
1746
|
+
const vaR = litValue(a);
|
|
1747
|
+
const vbR = litValue(b);
|
|
1748
|
+
if (vaR.ok && vbR.ok && Object.is(vaR.value, vbR.value)) return a;
|
|
1737
1749
|
if (a.shape.k === "prim" && b.shape.k === "prim" && a.shape.type === b.shape.type) {
|
|
1738
|
-
if (
|
|
1750
|
+
if (vaR.ok && vbR.ok) {
|
|
1751
|
+
const va = vaR.value;
|
|
1752
|
+
const vb = vbR.value;
|
|
1739
1753
|
const nanA = typeof va === "number" && Number.isNaN(va);
|
|
1740
1754
|
const nanB = typeof vb === "number" && Number.isNaN(vb);
|
|
1741
1755
|
if (nanA || nanB) {
|
|
@@ -1749,11 +1763,13 @@ function joinValues(a, b) {
|
|
|
1749
1763
|
}
|
|
1750
1764
|
function makeSum(a, b) {
|
|
1751
1765
|
const members = flattenSum([a, b]);
|
|
1766
|
+
if (members.length === 0) return never;
|
|
1752
1767
|
if (members.length === 1) return members[0];
|
|
1753
1768
|
if (members.length > 16) {
|
|
1754
1769
|
const first = members[0];
|
|
1755
1770
|
const samePrimLit = first.shape.k === "prim" && members.every(
|
|
1756
|
-
(m) => m.shape.k === "prim" && m.shape.type === first.shape.type && litValue(
|
|
1771
|
+
(m) => m.shape.k === "prim" && m.shape.type === first.shape.type && // litValue 哨兵对 lit(undefined) 折成 undefined,须看 term
|
|
1772
|
+
m.term?.op === "lit"
|
|
1757
1773
|
);
|
|
1758
1774
|
if (samePrimLit) {
|
|
1759
1775
|
return abs(first.shape, void 0, void 0, "path");
|
|
@@ -1786,8 +1802,7 @@ function absShapeKey(a, seen = /* @__PURE__ */ new Set()) {
|
|
|
1786
1802
|
try {
|
|
1787
1803
|
const s = a.shape;
|
|
1788
1804
|
if (s.k === "prim") {
|
|
1789
|
-
|
|
1790
|
-
if (lv !== void 0) return `prim:${s.type}:${String(lv)}`;
|
|
1805
|
+
if (a.term?.op === "lit") return `prim:${s.type}:${String(a.term.value)}`;
|
|
1791
1806
|
const t = a.term ? termToString(a.term) : "";
|
|
1792
1807
|
const p = a.pred && a.pred.op !== "true" ? predToString(a.pred) : "";
|
|
1793
1808
|
return `prim:${s.type}:${t}:${p}`;
|
|
@@ -2597,6 +2612,10 @@ function asAbs(v2) {
|
|
|
2597
2612
|
}
|
|
2598
2613
|
|
|
2599
2614
|
// src/algebra/template.ts
|
|
2615
|
+
function litStrOf(a) {
|
|
2616
|
+
const r = litValue(a);
|
|
2617
|
+
return r.ok ? String(r.value) : "";
|
|
2618
|
+
}
|
|
2600
2619
|
function viewTemplateParts(parts, describe) {
|
|
2601
2620
|
return parts.map((p) => {
|
|
2602
2621
|
const d = describe(p);
|
|
@@ -2725,7 +2744,10 @@ function isTemplateAbs(a) {
|
|
|
2725
2744
|
return a.shape.k === "prim" && a.shape.type === "string" && !!a.pred && a.pred.name?.startsWith("`") === true && Array.isArray(a.pred.meta?.templateParts);
|
|
2726
2745
|
}
|
|
2727
2746
|
function describeAbsPart(p) {
|
|
2728
|
-
if (isStrLit(p))
|
|
2747
|
+
if (isStrLit(p)) {
|
|
2748
|
+
const r = litValue(p);
|
|
2749
|
+
return { fixed: r.ok ? String(r.value) : "" };
|
|
2750
|
+
}
|
|
2729
2751
|
return { render: p.term ? termToString(p.term) : "string" };
|
|
2730
2752
|
}
|
|
2731
2753
|
function absTemplateViews(parts) {
|
|
@@ -2778,7 +2800,7 @@ function concatString(a, b) {
|
|
|
2778
2800
|
if (isStrLit(a) && isStrLit(b)) {
|
|
2779
2801
|
return abs(
|
|
2780
2802
|
{ k: "prim", type: "string" },
|
|
2781
|
-
lit(String(
|
|
2803
|
+
lit(String(litStrOf(a)) + String(litStrOf(b))),
|
|
2782
2804
|
void 0,
|
|
2783
2805
|
"exact"
|
|
2784
2806
|
);
|
|
@@ -3045,9 +3067,11 @@ function add(a, b, phi2 = pTrue) {
|
|
|
3045
3067
|
if (isSymbolAbs(a) || isSymbolAbs(b)) {
|
|
3046
3068
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
3047
3069
|
}
|
|
3048
|
-
const
|
|
3049
|
-
const
|
|
3050
|
-
if (
|
|
3070
|
+
const ra = litValue(a);
|
|
3071
|
+
const rb = litValue(b);
|
|
3072
|
+
if (ra.ok && rb.ok) {
|
|
3073
|
+
const va = ra.value;
|
|
3074
|
+
const vb = rb.value;
|
|
3051
3075
|
if (typeof va === "number" && typeof vb === "number") {
|
|
3052
3076
|
return numLit(va + vb);
|
|
3053
3077
|
}
|
|
@@ -3061,8 +3085,8 @@ function add(a, b, phi2 = pTrue) {
|
|
|
3061
3085
|
if (isStrPrim(a) || isStrPrim(b) || isTemplateLike(a) || isTemplateLike(b)) {
|
|
3062
3086
|
return concatString(a, b);
|
|
3063
3087
|
}
|
|
3064
|
-
if (coercibleLit(
|
|
3065
|
-
return numLit(Number(
|
|
3088
|
+
if (ra.ok && rb.ok && coercibleLit(ra.value) && coercibleLit(rb.value)) {
|
|
3089
|
+
return numLit(Number(ra.value) + Number(rb.value));
|
|
3066
3090
|
}
|
|
3067
3091
|
const big = foldBigintBinOp(a, b, (x, y) => x + y);
|
|
3068
3092
|
if (big) return big;
|
|
@@ -3124,17 +3148,19 @@ function add(a, b, phi2 = pTrue) {
|
|
|
3124
3148
|
return abs({ k: "unknown" }, void 0, void 0, "partial");
|
|
3125
3149
|
}
|
|
3126
3150
|
function isKnownNonBigintNumeric(a) {
|
|
3127
|
-
const
|
|
3128
|
-
if (typeof
|
|
3129
|
-
if (
|
|
3151
|
+
const r = litValue(a);
|
|
3152
|
+
if (r.ok && (typeof r.value === "number" || typeof r.value === "boolean" || r.value === null)) return true;
|
|
3153
|
+
if (r.ok && r.value === void 0) return true;
|
|
3130
3154
|
return a.shape.k === "prim" && (a.shape.type === "number" || a.shape.type === "boolean");
|
|
3131
3155
|
}
|
|
3132
3156
|
function isMaybeBigintOperand(a) {
|
|
3133
3157
|
return a.shape.k === "any" || a.shape.k === "unknown" || a.shape.k === "obj" || a.shape.k === "fn" || a.shape.k === "brand" || a.shape.k === "sum";
|
|
3134
3158
|
}
|
|
3135
3159
|
function foldBigintBinOp(a, b, op) {
|
|
3136
|
-
const
|
|
3137
|
-
const
|
|
3160
|
+
const ra = litValue(a);
|
|
3161
|
+
const rb = litValue(b);
|
|
3162
|
+
const va = ra.ok ? ra.value : void 0;
|
|
3163
|
+
const vb = rb.ok ? rb.value : void 0;
|
|
3138
3164
|
if (typeof va !== "bigint" && typeof vb !== "bigint") return void 0;
|
|
3139
3165
|
if (typeof va === "bigint" && typeof vb === "bigint") {
|
|
3140
3166
|
try {
|
|
@@ -3194,7 +3220,7 @@ function isAnyLike(a) {
|
|
|
3194
3220
|
return false;
|
|
3195
3221
|
}
|
|
3196
3222
|
function coercibleLit(v2) {
|
|
3197
|
-
return
|
|
3223
|
+
return typeof v2 === "number" || typeof v2 === "string" || typeof v2 === "boolean" || v2 === null;
|
|
3198
3224
|
}
|
|
3199
3225
|
function toNumberResult(a, b, op) {
|
|
3200
3226
|
const term = a.term && b.term ? app(op, [a.term, b.term]) : void 0;
|
|
@@ -3297,18 +3323,18 @@ function sub(a, b, phi2 = pTrue) {
|
|
|
3297
3323
|
if (isSymbolAbs(a) || isSymbolAbs(b)) {
|
|
3298
3324
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
3299
3325
|
}
|
|
3300
|
-
const
|
|
3301
|
-
const
|
|
3326
|
+
const ra = litValue(a);
|
|
3327
|
+
const rb = litValue(b);
|
|
3302
3328
|
const big = foldBigintBinOp(a, b, (x, y) => x - y);
|
|
3303
3329
|
if (big) return big;
|
|
3304
3330
|
if (isBigPrim(a) && isBigPrim(b)) {
|
|
3305
3331
|
return abs({ k: "prim", type: "bigint" }, void 0, void 0, confJoin(a.conf, b.conf));
|
|
3306
3332
|
}
|
|
3307
|
-
if (typeof
|
|
3308
|
-
return numLit(
|
|
3333
|
+
if (ra.ok && rb.ok && typeof ra.value === "number" && typeof rb.value === "number") {
|
|
3334
|
+
return numLit(ra.value - rb.value);
|
|
3309
3335
|
}
|
|
3310
|
-
if (coercibleLit(
|
|
3311
|
-
return numLit(Number(
|
|
3336
|
+
if (ra.ok && rb.ok && coercibleLit(ra.value) && coercibleLit(rb.value)) {
|
|
3337
|
+
return numLit(Number(ra.value) - Number(rb.value));
|
|
3312
3338
|
}
|
|
3313
3339
|
if (isNumericLike(a) && isNumericLike(b) && a.term && b.term) {
|
|
3314
3340
|
const term = simplifyTerm(app("-", [a.term, b.term]));
|
|
@@ -3344,18 +3370,18 @@ function mul(a, b, phi2 = pTrue) {
|
|
|
3344
3370
|
if (isSymbolAbs(a) || isSymbolAbs(b)) {
|
|
3345
3371
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
3346
3372
|
}
|
|
3347
|
-
const
|
|
3348
|
-
const
|
|
3373
|
+
const ra = litValue(a);
|
|
3374
|
+
const rb = litValue(b);
|
|
3349
3375
|
const big = foldBigintBinOp(a, b, (x, y) => x * y);
|
|
3350
3376
|
if (big) return big;
|
|
3351
3377
|
if (isBigPrim(a) && isBigPrim(b)) {
|
|
3352
3378
|
return abs({ k: "prim", type: "bigint" }, void 0, void 0, confJoin(a.conf, b.conf));
|
|
3353
3379
|
}
|
|
3354
|
-
if (typeof
|
|
3355
|
-
return numLit(
|
|
3380
|
+
if (ra.ok && rb.ok && typeof ra.value === "number" && typeof rb.value === "number") {
|
|
3381
|
+
return numLit(ra.value * rb.value);
|
|
3356
3382
|
}
|
|
3357
|
-
if (coercibleLit(
|
|
3358
|
-
return numLit(Number(
|
|
3383
|
+
if (ra.ok && rb.ok && coercibleLit(ra.value) && coercibleLit(rb.value)) {
|
|
3384
|
+
return numLit(Number(ra.value) * Number(rb.value));
|
|
3359
3385
|
}
|
|
3360
3386
|
if (isNumericLike(a) && isNumericLike(b) && a.term && b.term) {
|
|
3361
3387
|
const term = simplifyTerm(app("*", [a.term, b.term]));
|
|
@@ -3416,8 +3442,10 @@ function div(a, b, phi2 = pTrue) {
|
|
|
3416
3442
|
if (isSymbolAbs(a) || isSymbolAbs(b)) {
|
|
3417
3443
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
3418
3444
|
}
|
|
3419
|
-
const
|
|
3420
|
-
const
|
|
3445
|
+
const ra = litValue(a);
|
|
3446
|
+
const rb = litValue(b);
|
|
3447
|
+
const va = ra.ok ? ra.value : void 0;
|
|
3448
|
+
const vb = rb.ok ? rb.value : void 0;
|
|
3421
3449
|
const big = foldBigintBinOp(a, b, (x, y) => x / y);
|
|
3422
3450
|
if (big) return big;
|
|
3423
3451
|
if (isBigPrim(a) && isBigPrim(b)) {
|
|
@@ -3429,7 +3457,7 @@ function div(a, b, phi2 = pTrue) {
|
|
|
3429
3457
|
}
|
|
3430
3458
|
return numLit(va / vb);
|
|
3431
3459
|
}
|
|
3432
|
-
if (coercibleLit(
|
|
3460
|
+
if (ra.ok && rb.ok && coercibleLit(ra.value) && coercibleLit(rb.value)) {
|
|
3433
3461
|
return numLit(Number(va) / Number(vb));
|
|
3434
3462
|
}
|
|
3435
3463
|
if (isNumericLike(a) && isNumericLike(b) && a.term && b.term) {
|
|
@@ -3474,8 +3502,10 @@ function mod(a, b, phi2 = pTrue) {
|
|
|
3474
3502
|
if (isSymbolAbs(a) || isSymbolAbs(b)) {
|
|
3475
3503
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
3476
3504
|
}
|
|
3477
|
-
const
|
|
3478
|
-
const
|
|
3505
|
+
const ra = litValue(a);
|
|
3506
|
+
const rb = litValue(b);
|
|
3507
|
+
const va = ra.ok ? ra.value : void 0;
|
|
3508
|
+
const vb = rb.ok ? rb.value : void 0;
|
|
3479
3509
|
const big = foldBigintBinOp(a, b, (x, y) => x % y);
|
|
3480
3510
|
if (big) return big;
|
|
3481
3511
|
if (isBigPrim(a) && isBigPrim(b)) {
|
|
@@ -3484,7 +3514,7 @@ function mod(a, b, phi2 = pTrue) {
|
|
|
3484
3514
|
if (typeof va === "number" && typeof vb === "number") {
|
|
3485
3515
|
return numLit(va % vb);
|
|
3486
3516
|
}
|
|
3487
|
-
if (coercibleLit(
|
|
3517
|
+
if (ra.ok && rb.ok && coercibleLit(ra.value) && coercibleLit(rb.value)) {
|
|
3488
3518
|
return numLit(Number(va) % Number(vb));
|
|
3489
3519
|
}
|
|
3490
3520
|
if (isNumericLike(a) && isNumericLike(b) && a.term && b.term) {
|
|
@@ -3519,16 +3549,19 @@ function mod(a, b, phi2 = pTrue) {
|
|
|
3519
3549
|
return abs({ k: "unknown" }, void 0, void 0, "partial");
|
|
3520
3550
|
}
|
|
3521
3551
|
function cmp(op, a, b, phi2 = pTrue) {
|
|
3552
|
+
if (op !== "eq" && op !== "ne" && (isSymbolAbs(a) || isSymbolAbs(b))) {
|
|
3553
|
+
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
3554
|
+
}
|
|
3522
3555
|
const ta = a.term;
|
|
3523
3556
|
const tb = b.term;
|
|
3524
3557
|
if (ta?.op === "lit" && tb?.op === "lit") {
|
|
3525
3558
|
const result = compareLits(op, ta.value, tb.value);
|
|
3526
3559
|
if (result !== void 0) return boolLit(result);
|
|
3527
3560
|
} else {
|
|
3528
|
-
const
|
|
3529
|
-
const
|
|
3530
|
-
if (
|
|
3531
|
-
const result = compareLits(op,
|
|
3561
|
+
const ra = litValue(a);
|
|
3562
|
+
const rb = litValue(b);
|
|
3563
|
+
if (ra.ok && rb.ok) {
|
|
3564
|
+
const result = compareLits(op, ra.value, rb.value);
|
|
3532
3565
|
if (result !== void 0) return boolLit(result);
|
|
3533
3566
|
}
|
|
3534
3567
|
}
|
|
@@ -3975,7 +4008,8 @@ function evalObjectMethod(name, args) {
|
|
|
3975
4008
|
if (a0 === void 0 || a0.term?.op === "lit" && a0.term.value === void 0) {
|
|
3976
4009
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
3977
4010
|
}
|
|
3978
|
-
const
|
|
4011
|
+
const protoVR = litValue(a0);
|
|
4012
|
+
const protoV = protoVR.ok ? protoVR.value : void 0;
|
|
3979
4013
|
if (protoV === null) return markNullProtoObj(abs({ k: "obj", slots: {} }, void 0, void 0, "exact"));
|
|
3980
4014
|
if (typeof protoV === "object") {
|
|
3981
4015
|
return abs({ k: "obj", slots: {} }, void 0, void 0, "path");
|
|
@@ -4096,7 +4130,8 @@ function evalObjectMethod(name, args) {
|
|
|
4096
4130
|
if (a0.term?.op === "lit" && (a0.term.value === null || a0.term.value === void 0)) {
|
|
4097
4131
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
4098
4132
|
}
|
|
4099
|
-
const
|
|
4133
|
+
const keyR = args[1] ? litValue(args[1]) : void 0;
|
|
4134
|
+
const key = keyR?.ok ? keyR.value : void 0;
|
|
4100
4135
|
if (typeof key !== "string") return boolPrim();
|
|
4101
4136
|
if (a0.shape.k === "obj") {
|
|
4102
4137
|
const shape = a0.shape;
|
|
@@ -4122,7 +4157,8 @@ function evalObjectMethod(name, args) {
|
|
|
4122
4157
|
if (!t0 || !p0) {
|
|
4123
4158
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
4124
4159
|
}
|
|
4125
|
-
const
|
|
4160
|
+
const pvR = litValue(p0);
|
|
4161
|
+
const pv = pvR.ok ? pvR.value : void 0;
|
|
4126
4162
|
if (p0.term?.op === "lit" && (pv === void 0 || pv !== null && typeof pv !== "object")) {
|
|
4127
4163
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
4128
4164
|
}
|
|
@@ -4268,7 +4304,8 @@ function evalObjectMethod(name, args) {
|
|
|
4268
4304
|
return boolLit(extStateOf(t) === void 0);
|
|
4269
4305
|
}
|
|
4270
4306
|
case "defineProperty": {
|
|
4271
|
-
const
|
|
4307
|
+
const kvR = args[1] ? litValue(args[1]) : void 0;
|
|
4308
|
+
const kv = kvR?.ok ? kvR.value : void 0;
|
|
4272
4309
|
if (!a0 || typeof kv !== "string" && typeof kv !== "number") return a0;
|
|
4273
4310
|
if (a0.term?.op === "lit") throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
4274
4311
|
const key = String(kv);
|
|
@@ -4278,9 +4315,8 @@ function evalObjectMethod(name, args) {
|
|
|
4278
4315
|
const field = (k) => {
|
|
4279
4316
|
const s = dslots[k]?.value;
|
|
4280
4317
|
if (!s) return { present: false, v: void 0 };
|
|
4281
|
-
const
|
|
4282
|
-
if (
|
|
4283
|
-
if (s.term?.op === "lit" && s.term.value === void 0) return { present: true, v: void 0 };
|
|
4318
|
+
const lvR = litValue(s);
|
|
4319
|
+
if (lvR.ok) return { present: true, v: lvR.value };
|
|
4284
4320
|
return { present: true, v: "fn-or-abstract" };
|
|
4285
4321
|
};
|
|
4286
4322
|
const getF = field("get");
|
|
@@ -4292,7 +4328,9 @@ function evalObjectMethod(name, args) {
|
|
|
4292
4328
|
if (accessorPresent && valueF.present && valueF.v !== void 0) return unknown;
|
|
4293
4329
|
const dv = (k) => {
|
|
4294
4330
|
const s = dslots[k]?.value;
|
|
4295
|
-
|
|
4331
|
+
if (!s) return void 0;
|
|
4332
|
+
const r = litValue(s);
|
|
4333
|
+
return r.ok ? r.value : void 0;
|
|
4296
4334
|
};
|
|
4297
4335
|
const value = dv("value");
|
|
4298
4336
|
const toBool = (k) => {
|
|
@@ -4497,7 +4535,8 @@ function radixLitArg(a) {
|
|
|
4497
4535
|
}
|
|
4498
4536
|
function evalNumberStatic(name, args) {
|
|
4499
4537
|
const a0Arg = args[0];
|
|
4500
|
-
const
|
|
4538
|
+
const a0R = a0Arg ? litValue(a0Arg) : void 0;
|
|
4539
|
+
const a0 = a0R?.ok ? a0R.value : void 0;
|
|
4501
4540
|
const foldStrictNumberPred = (pred) => {
|
|
4502
4541
|
if (!a0Arg) return boolLit(false);
|
|
4503
4542
|
if (a0Arg.term?.op !== "lit") return void 0;
|
|
@@ -4759,7 +4798,8 @@ function elementsFrom(iterable) {
|
|
|
4759
4798
|
if (iterable.shape.k === "sum") {
|
|
4760
4799
|
return iterable.shape.members.flatMap(elementsFrom);
|
|
4761
4800
|
}
|
|
4762
|
-
const
|
|
4801
|
+
const svR = litValue(iterable);
|
|
4802
|
+
const sv = svR.ok && typeof svR.value === "string" ? svR.value : void 0;
|
|
4763
4803
|
if (typeof sv === "string") {
|
|
4764
4804
|
return [...sv].map((c) => strLit(c));
|
|
4765
4805
|
}
|
|
@@ -4773,7 +4813,8 @@ function ctorArgDefinitelyInvalid(name, iterable) {
|
|
|
4773
4813
|
if (iterable.term?.op === "lit" && iterable.term.value === void 0) return false;
|
|
4774
4814
|
const nonIterableLit = (a) => {
|
|
4775
4815
|
if (a.shape.k === "prim") {
|
|
4776
|
-
const
|
|
4816
|
+
const vR = litValue(a);
|
|
4817
|
+
const v2 = vR.ok ? vR.value : void 0;
|
|
4777
4818
|
if (typeof v2 === "string") return false;
|
|
4778
4819
|
return true;
|
|
4779
4820
|
}
|
|
@@ -4783,7 +4824,8 @@ function ctorArgDefinitelyInvalid(name, iterable) {
|
|
|
4783
4824
|
if (nonIterableLit(iterable)) return true;
|
|
4784
4825
|
if (name !== "Map") return false;
|
|
4785
4826
|
const primEntry = (a) => a.shape.k === "prim";
|
|
4786
|
-
const
|
|
4827
|
+
const svR = litValue(iterable);
|
|
4828
|
+
const sv = svR.ok && typeof svR.value === "string" ? svR.value : void 0;
|
|
4787
4829
|
if (typeof sv === "string") return sv.length > 0;
|
|
4788
4830
|
if (iterable.shape.k === "tuple") return iterable.shape.elements.some(primEntry);
|
|
4789
4831
|
if (isSetAbs(iterable)) return setElementsAbs(iterable).some(primEntry);
|
|
@@ -5179,7 +5221,8 @@ function makeSymbolAbs(descArg) {
|
|
|
5179
5221
|
var isSymbolAbs2 = isSymbolAbs;
|
|
5180
5222
|
function symbolDescriptiveString(a) {
|
|
5181
5223
|
const d = symbolDescriptionAbs(a);
|
|
5182
|
-
const
|
|
5224
|
+
const dvR = d ? litValue(d) : void 0;
|
|
5225
|
+
const dv = dvR?.ok ? dvR.value : void 0;
|
|
5183
5226
|
if (typeof dv === "string") return dv.length > 0 ? `Symbol(${dv})` : "Symbol()";
|
|
5184
5227
|
return "Symbol()";
|
|
5185
5228
|
}
|
|
@@ -5223,7 +5266,8 @@ function makeArrayCtorAbs(args) {
|
|
|
5223
5266
|
if (a0.term?.op !== "lit") {
|
|
5224
5267
|
return abs({ k: "arr", element: unknown }, void 0, void 0, "partial");
|
|
5225
5268
|
}
|
|
5226
|
-
const
|
|
5269
|
+
const nR = litValue(a0);
|
|
5270
|
+
const n = nR.ok ? nR.value : void 0;
|
|
5227
5271
|
if (typeof n === "number") {
|
|
5228
5272
|
if (!Number.isInteger(n) || n < 0 || n > 4294967295) {
|
|
5229
5273
|
throw new NudoThrow(errorTypeAbs("RangeError"));
|
|
@@ -5301,8 +5345,9 @@ function evalArrayStatic(name, args) {
|
|
|
5301
5345
|
return abs({ k: "arr", element: el }, void 0, void 0, "path");
|
|
5302
5346
|
}
|
|
5303
5347
|
if (k === "prim" && a0.shape.type === "string") {
|
|
5304
|
-
const
|
|
5305
|
-
|
|
5348
|
+
const svR = litValue(a0);
|
|
5349
|
+
const sv = svR.ok && typeof svR.value === "string" ? svR.value : void 0;
|
|
5350
|
+
if (sv !== void 0 && hasMapFn && sv.length > 0) {
|
|
5306
5351
|
const cps = [...sv];
|
|
5307
5352
|
let el = mapOne(strLit(cps[0]), numLit(0));
|
|
5308
5353
|
for (let i = 1; i < cps.length; i++) el = joinAbs(el, mapOne(strLit(cps[i]), numLit(i)));
|
|
@@ -5318,7 +5363,8 @@ function evalArrayStatic(name, args) {
|
|
|
5318
5363
|
if (k === "obj") {
|
|
5319
5364
|
const slots = a0.shape.slots ?? {};
|
|
5320
5365
|
const lenSlot = slots["length"]?.value;
|
|
5321
|
-
const
|
|
5366
|
+
const nR = lenSlot ? litValue(lenSlot) : void 0;
|
|
5367
|
+
const n = nR?.ok ? nR.value : void 0;
|
|
5322
5368
|
if (typeof n === "number" && Number.isInteger(n) && n >= 0 && n <= 4096) {
|
|
5323
5369
|
if (n === 0) return abs({ k: "arr", element: unknown }, void 0, void 0, "path");
|
|
5324
5370
|
let el = mapOne(undefAbs(), numLit(0));
|
|
@@ -5457,7 +5503,8 @@ function tryMakeRegexAbs(args) {
|
|
|
5457
5503
|
if (typeof pv === "symbol") throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
5458
5504
|
const fAbs = args[1];
|
|
5459
5505
|
if (fAbs && fAbs.term?.op !== "lit") return void 0;
|
|
5460
|
-
const
|
|
5506
|
+
const fvR = fAbs ? litValue(fAbs) : void 0;
|
|
5507
|
+
const fv = fvR?.ok ? fvR.value : void 0;
|
|
5461
5508
|
if (typeof fv === "symbol") throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
5462
5509
|
const flags = fv === void 0 ? "" : String(fv);
|
|
5463
5510
|
try {
|
|
@@ -5472,9 +5519,12 @@ function evalRegExpMethod(name, recv, args) {
|
|
|
5472
5519
|
if (name === "test" || name === "exec") {
|
|
5473
5520
|
const inner = recv.shape.k === "brand" && recv.shape.name === "RegExp" ? recv.shape.shape : void 0;
|
|
5474
5521
|
const slots = inner && inner.shape.k === "obj" ? inner.shape.slots : void 0;
|
|
5475
|
-
const
|
|
5476
|
-
const
|
|
5477
|
-
const
|
|
5522
|
+
const patR = slots ? litValue(slots["source"]?.value) : void 0;
|
|
5523
|
+
const pat = patR?.ok ? patR.value : void 0;
|
|
5524
|
+
const flagsVR = slots ? litValue(slots["flags"]?.value) : void 0;
|
|
5525
|
+
const flagsV = flagsVR?.ok ? flagsVR.value : void 0;
|
|
5526
|
+
const subjectR = args[0] ? litValue(args[0]) : void 0;
|
|
5527
|
+
const subject = subjectR?.ok ? subjectR.value : void 0;
|
|
5478
5528
|
if (typeof pat === "string" && typeof subject === "string") {
|
|
5479
5529
|
try {
|
|
5480
5530
|
const re = new RegExp(pat, typeof flagsV === "string" ? flagsV : "");
|
|
@@ -5955,7 +6005,8 @@ function evalBuiltinNew(className, args) {
|
|
|
5955
6005
|
"path"
|
|
5956
6006
|
);
|
|
5957
6007
|
case "String": {
|
|
5958
|
-
const
|
|
6008
|
+
const a0R = args[0] ? litValue(args[0]) : void 0;
|
|
6009
|
+
const a0 = a0R?.ok && typeof a0R.value === "string" ? a0R.value : void 0;
|
|
5959
6010
|
if (typeof a0 === "string") {
|
|
5960
6011
|
const slots = {
|
|
5961
6012
|
length: { value: numLit(a0.length) }
|
|
@@ -6070,7 +6121,8 @@ function toBigIntAbs(args) {
|
|
|
6070
6121
|
);
|
|
6071
6122
|
}
|
|
6072
6123
|
function evalGlobalFn(name, args) {
|
|
6073
|
-
const
|
|
6124
|
+
const a0R = args[0] ? litValue(args[0]) : void 0;
|
|
6125
|
+
const a0 = a0R?.ok ? a0R.value : void 0;
|
|
6074
6126
|
const a0Lit = litTermOf(args[0]);
|
|
6075
6127
|
switch (name) {
|
|
6076
6128
|
case "eval":
|
|
@@ -6246,7 +6298,8 @@ function hasOwnDecision(recv, key) {
|
|
|
6246
6298
|
if (key === "length") return boolLit(true);
|
|
6247
6299
|
const idx = canonicalArrayIndex(key);
|
|
6248
6300
|
if (idx !== void 0) {
|
|
6249
|
-
const
|
|
6301
|
+
const litR = litValue(recv);
|
|
6302
|
+
const lit3 = litR.ok && typeof litR.value === "string" ? litR.value : void 0;
|
|
6250
6303
|
if (typeof lit3 === "string") return boolLit(idx < lit3.length);
|
|
6251
6304
|
return boolPrimB();
|
|
6252
6305
|
}
|
|
@@ -6262,7 +6315,8 @@ function hasOwnDecision(recv, key) {
|
|
|
6262
6315
|
}
|
|
6263
6316
|
function propertyIsEnumerableDecision(recv, key) {
|
|
6264
6317
|
const own = hasOwnDecision(recv, key);
|
|
6265
|
-
const
|
|
6318
|
+
const ownR = litValue(own);
|
|
6319
|
+
const ownV = ownR.ok ? ownR.value : void 0;
|
|
6266
6320
|
if (ownV === false) return boolLit(false);
|
|
6267
6321
|
if (key === "length") {
|
|
6268
6322
|
const s = recv.shape;
|
|
@@ -6324,7 +6378,8 @@ function typeTagOf(recv) {
|
|
|
6324
6378
|
if (inner.shape.k === "obj") {
|
|
6325
6379
|
const tag = getSlot(inner.shape.slots, "@@toStringTag");
|
|
6326
6380
|
if (tag) {
|
|
6327
|
-
const
|
|
6381
|
+
const vR = litValue(tag.value);
|
|
6382
|
+
const v2 = vR.ok ? vR.value : void 0;
|
|
6328
6383
|
if (typeof v2 === "string") return v2;
|
|
6329
6384
|
}
|
|
6330
6385
|
}
|
|
@@ -6336,7 +6391,8 @@ function typeTagOf(recv) {
|
|
|
6336
6391
|
if (s.k === "obj") {
|
|
6337
6392
|
const tag = getSlot(s.slots, "@@toStringTag");
|
|
6338
6393
|
if (tag) {
|
|
6339
|
-
const
|
|
6394
|
+
const vR = litValue(tag.value);
|
|
6395
|
+
const v2 = vR.ok ? vR.value : void 0;
|
|
6340
6396
|
if (typeof v2 === "string") return v2;
|
|
6341
6397
|
}
|
|
6342
6398
|
return "Object";
|
|
@@ -6411,7 +6467,8 @@ function coercibleNumberLit(v2) {
|
|
|
6411
6467
|
return typeof v2 === "number" || typeof v2 === "string" || typeof v2 === "boolean" || v2 === null;
|
|
6412
6468
|
}
|
|
6413
6469
|
function isKnownNonBigintNumeric2(a) {
|
|
6414
|
-
const
|
|
6470
|
+
const vaR = litValue(a);
|
|
6471
|
+
const va = vaR.ok ? vaR.value : void 0;
|
|
6415
6472
|
if (typeof va === "number" || typeof va === "boolean" || va === null) return true;
|
|
6416
6473
|
if (a.term?.op === "lit" && a.term.value === void 0) return true;
|
|
6417
6474
|
return a.shape.k === "prim" && (a.shape.type === "number" || a.shape.type === "boolean");
|
|
@@ -6423,8 +6480,10 @@ function foldNumericBinOp(a, b, numOp, bigOp) {
|
|
|
6423
6480
|
if (isSymbolAbs(a) || isSymbolAbs(b)) {
|
|
6424
6481
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
6425
6482
|
}
|
|
6426
|
-
const
|
|
6427
|
-
const
|
|
6483
|
+
const ra = litValue(a);
|
|
6484
|
+
const rb = litValue(b);
|
|
6485
|
+
const va = ra.ok ? ra.value : void 0;
|
|
6486
|
+
const vb = rb.ok ? rb.value : void 0;
|
|
6428
6487
|
if (!bigOp && (typeof va === "bigint" || typeof vb === "bigint" || isBigPrim(a) || isBigPrim(b))) {
|
|
6429
6488
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
6430
6489
|
}
|
|
@@ -6458,10 +6517,10 @@ function foldNumericBinOp(a, b, numOp, bigOp) {
|
|
|
6458
6517
|
}
|
|
6459
6518
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
6460
6519
|
}
|
|
6461
|
-
if (coercibleNumberLit(
|
|
6520
|
+
if (ra.ok && rb.ok && coercibleNumberLit(ra.value) && coercibleNumberLit(rb.value)) {
|
|
6462
6521
|
return abs(
|
|
6463
6522
|
{ k: "prim", type: "number" },
|
|
6464
|
-
lit(numOp(Number(
|
|
6523
|
+
lit(numOp(Number(ra.value), Number(rb.value))),
|
|
6465
6524
|
pTrue,
|
|
6466
6525
|
"exact"
|
|
6467
6526
|
);
|
|
@@ -6472,7 +6531,8 @@ function foldNumericUnOp(a, numOp, bigOp) {
|
|
|
6472
6531
|
if (isSymbolAbs(a)) {
|
|
6473
6532
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
6474
6533
|
}
|
|
6475
|
-
const
|
|
6534
|
+
const r = litValue(a);
|
|
6535
|
+
const v2 = r.ok ? r.value : void 0;
|
|
6476
6536
|
if (typeof v2 === "bigint") {
|
|
6477
6537
|
if (!bigOp) throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
6478
6538
|
try {
|
|
@@ -6482,8 +6542,8 @@ function foldNumericUnOp(a, numOp, bigOp) {
|
|
|
6482
6542
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
6483
6543
|
}
|
|
6484
6544
|
}
|
|
6485
|
-
if (coercibleNumberLit(
|
|
6486
|
-
return abs({ k: "prim", type: "number" }, lit(numOp(Number(
|
|
6545
|
+
if (r.ok && coercibleNumberLit(r.value)) {
|
|
6546
|
+
return abs({ k: "prim", type: "number" }, lit(numOp(Number(r.value))), pTrue, "exact");
|
|
6487
6547
|
}
|
|
6488
6548
|
return void 0;
|
|
6489
6549
|
}
|
|
@@ -6533,7 +6593,8 @@ function powAbs(a, b) {
|
|
|
6533
6593
|
return foldNumericBinOp(a, b, (x, y) => x ** y, (x, y) => x ** y) ?? bitwiseResultShape(a, b);
|
|
6534
6594
|
}
|
|
6535
6595
|
function toNumericAbs(a) {
|
|
6536
|
-
const
|
|
6596
|
+
const vR = litValue(a);
|
|
6597
|
+
const v2 = vR.ok ? vR.value : void 0;
|
|
6537
6598
|
if (typeof v2 === "bigint") return bigintLit(v2);
|
|
6538
6599
|
if (isBigPrim(a)) return a;
|
|
6539
6600
|
if (a.term?.op === "lit" && a.term.value === void 0) {
|
|
@@ -6562,8 +6623,10 @@ function updateSubAbs(a) {
|
|
|
6562
6623
|
return subNumeric(n, one);
|
|
6563
6624
|
}
|
|
6564
6625
|
function addNumeric(a, b) {
|
|
6565
|
-
const
|
|
6566
|
-
const
|
|
6626
|
+
const ra = litValue(a);
|
|
6627
|
+
const rb = litValue(b);
|
|
6628
|
+
const va = ra.ok ? ra.value : void 0;
|
|
6629
|
+
const vb = rb.ok ? rb.value : void 0;
|
|
6567
6630
|
if (typeof va === "bigint" && typeof vb === "bigint") return bigintLit(va + vb);
|
|
6568
6631
|
if (typeof va === "number" && typeof vb === "number") return numLit(va + vb);
|
|
6569
6632
|
const big = a.shape.k === "prim" && a.shape.type === "bigint" || typeof va === "bigint";
|
|
@@ -6575,8 +6638,10 @@ function addNumeric(a, b) {
|
|
|
6575
6638
|
);
|
|
6576
6639
|
}
|
|
6577
6640
|
function subNumeric(a, b) {
|
|
6578
|
-
const
|
|
6579
|
-
const
|
|
6641
|
+
const ra = litValue(a);
|
|
6642
|
+
const rb = litValue(b);
|
|
6643
|
+
const va = ra.ok ? ra.value : void 0;
|
|
6644
|
+
const vb = rb.ok ? rb.value : void 0;
|
|
6580
6645
|
if (typeof va === "bigint" && typeof vb === "bigint") return bigintLit(va - vb);
|
|
6581
6646
|
if (typeof va === "number" && typeof vb === "number") return numLit(va - vb);
|
|
6582
6647
|
const big = a.shape.k === "prim" && a.shape.type === "bigint" || typeof va === "bigint";
|
|
@@ -6591,12 +6656,13 @@ function toNumberAbs(a) {
|
|
|
6591
6656
|
if (isSymbolAbs(a)) {
|
|
6592
6657
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
6593
6658
|
}
|
|
6594
|
-
const
|
|
6659
|
+
const r = litValue(a);
|
|
6660
|
+
const v2 = r.ok ? r.value : void 0;
|
|
6595
6661
|
if (typeof v2 === "bigint" || isBigPrim(a)) {
|
|
6596
6662
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
6597
6663
|
}
|
|
6598
|
-
if (coercibleNumberLit(
|
|
6599
|
-
return abs({ k: "prim", type: "number" }, lit(Number(
|
|
6664
|
+
if (r.ok && coercibleNumberLit(r.value)) {
|
|
6665
|
+
return abs({ k: "prim", type: "number" }, lit(Number(r.value)), pTrue, "exact");
|
|
6600
6666
|
}
|
|
6601
6667
|
if (a.shape.k === "prim") {
|
|
6602
6668
|
if (a.shape.type === "number") return a;
|
|
@@ -6613,7 +6679,8 @@ function typeofAbs(a) {
|
|
|
6613
6679
|
if (!a || typeof a !== "object" || !("shape" in a)) {
|
|
6614
6680
|
return abs({ k: "prim", type: "string" }, void 0, void 0, "partial");
|
|
6615
6681
|
}
|
|
6616
|
-
const
|
|
6682
|
+
const vR = litValue(a);
|
|
6683
|
+
const v2 = vR.ok ? vR.value : void 0;
|
|
6617
6684
|
if (v2 === null) return strLit("object");
|
|
6618
6685
|
if (a.term?.op === "lit" && a.term.value === void 0) {
|
|
6619
6686
|
return strLit("undefined");
|
|
@@ -6663,7 +6730,8 @@ function negAbs(a, _phi = pTrue) {
|
|
|
6663
6730
|
if (isSymbolAbs(a)) {
|
|
6664
6731
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
6665
6732
|
}
|
|
6666
|
-
const
|
|
6733
|
+
const vR = litValue(a);
|
|
6734
|
+
const v2 = vR.ok ? vR.value : void 0;
|
|
6667
6735
|
if (typeof v2 === "number") return numLitAbs(-v2);
|
|
6668
6736
|
if (typeof v2 === "bigint") return bigintLit(-v2);
|
|
6669
6737
|
if (a.term?.op === "lit") {
|
|
@@ -6797,11 +6865,11 @@ function strictEqAbs(a, b) {
|
|
|
6797
6865
|
if (ia !== void 0 && ib !== void 0) return ia === ib;
|
|
6798
6866
|
return void 0;
|
|
6799
6867
|
}
|
|
6800
|
-
const
|
|
6801
|
-
const
|
|
6802
|
-
if (
|
|
6803
|
-
const aNullish =
|
|
6804
|
-
const evalNullish =
|
|
6868
|
+
const vaR = litValue(a);
|
|
6869
|
+
const vbR = litValue(b);
|
|
6870
|
+
if (vaR.ok && vbR.ok) return vaR.value === vbR.value;
|
|
6871
|
+
const aNullish = vaR.ok && (vaR.value === null || vaR.value === void 0);
|
|
6872
|
+
const evalNullish = vbR.ok && (vbR.value === null || vbR.value === void 0);
|
|
6805
6873
|
if (evalNullish && definitelyNotNullishShape(a.shape)) return false;
|
|
6806
6874
|
if (aNullish && definitelyNotNullishShape(b.shape)) return false;
|
|
6807
6875
|
if (a.term && b.term && a.term.op === "var" && b.term.op === "var" && a.term.id === b.term.id) {
|
|
@@ -6912,7 +6980,8 @@ function toUint32Limit(v2) {
|
|
|
6912
6980
|
}
|
|
6913
6981
|
function callAbsMethod(recv, name, args) {
|
|
6914
6982
|
if (!isStrRecv(recv)) return void 0;
|
|
6915
|
-
const
|
|
6983
|
+
const a0R = args[0] ? litValue(args[0]) : void 0;
|
|
6984
|
+
const a0 = a0R?.ok ? a0R.value : void 0;
|
|
6916
6985
|
const a0Str = toStringArg(args[0]);
|
|
6917
6986
|
const lit3 = recv.term?.op === "lit" && typeof recv.term.value === "string" ? recv.term.value : void 0;
|
|
6918
6987
|
if (isTemplateLike(recv)) {
|
|
@@ -6952,7 +7021,8 @@ function callAbsMethod(recv, name, args) {
|
|
|
6952
7021
|
case "endsWith":
|
|
6953
7022
|
case "includes": {
|
|
6954
7023
|
const a1Abs = args[1];
|
|
6955
|
-
const
|
|
7024
|
+
const a1R = a1Abs ? litValue(a1Abs) : void 0;
|
|
7025
|
+
const a1 = a1R?.ok ? a1R.value : void 0;
|
|
6956
7026
|
const a1Unknown = a1Abs !== void 0 && a1Abs.term?.op !== "lit";
|
|
6957
7027
|
if (a1Unknown) return boolPrim5();
|
|
6958
7028
|
if (lit3 !== void 0 && a0Str !== void 0) {
|
|
@@ -6972,7 +7042,8 @@ function callAbsMethod(recv, name, args) {
|
|
|
6972
7042
|
case "substring":
|
|
6973
7043
|
if (lit3 !== void 0) {
|
|
6974
7044
|
if (!isFoldableIndexArg(args[0]) || !isFoldableIndexArg(args[1])) return strPrim("path");
|
|
6975
|
-
const
|
|
7045
|
+
const a1R = args[1] ? litValue(args[1]) : void 0;
|
|
7046
|
+
const a1 = a1R?.ok ? a1R.value : void 0;
|
|
6976
7047
|
if (name === "slice") {
|
|
6977
7048
|
return strLit(lit3.slice(a0, a1));
|
|
6978
7049
|
}
|
|
@@ -7014,7 +7085,8 @@ function callAbsMethod(recv, name, args) {
|
|
|
7014
7085
|
const search = toStringArg(args[0]);
|
|
7015
7086
|
if (search === void 0) return numPrim5("path");
|
|
7016
7087
|
if (!isFoldableIndexArg(args[1])) return numPrim5("path");
|
|
7017
|
-
const
|
|
7088
|
+
const fromR = args[1] ? litValue(args[1]) : void 0;
|
|
7089
|
+
const from = fromR?.ok ? fromR.value : void 0;
|
|
7018
7090
|
return numLit(
|
|
7019
7091
|
name === "indexOf" ? lit3.indexOf(search, from) : lit3.lastIndexOf(search, from)
|
|
7020
7092
|
);
|
|
@@ -7027,7 +7099,8 @@ function callAbsMethod(recv, name, args) {
|
|
|
7027
7099
|
case "split": {
|
|
7028
7100
|
if (lit3 !== void 0) {
|
|
7029
7101
|
const limAbs = args[1];
|
|
7030
|
-
const
|
|
7102
|
+
const limR = limAbs ? litValue(limAbs) : void 0;
|
|
7103
|
+
const lim = limR?.ok ? limR.value : void 0;
|
|
7031
7104
|
if (limAbs !== void 0 && limAbs.term?.op !== "lit") return strArr("path");
|
|
7032
7105
|
if (isUndefinedArg(args[0])) {
|
|
7033
7106
|
const one = abs({ k: "tuple", elements: [strLit(lit3)] }, void 0, void 0, "exact");
|
|
@@ -7064,8 +7137,10 @@ function callAbsMethod(recv, name, args) {
|
|
|
7064
7137
|
} else if (patAbs.shape.k === "brand" && patAbs.shape.name === "RegExp") {
|
|
7065
7138
|
const inner = patAbs.shape.shape;
|
|
7066
7139
|
const slots = inner.shape.k === "obj" ? inner.shape.slots : void 0;
|
|
7067
|
-
const
|
|
7068
|
-
const
|
|
7140
|
+
const srcR = slots ? litValue(slots["source"]?.value) : void 0;
|
|
7141
|
+
const src = srcR?.ok ? srcR.value : void 0;
|
|
7142
|
+
const flagsR = slots ? litValue(slots["flags"]?.value) : void 0;
|
|
7143
|
+
const flags = flagsR?.ok ? flagsR.value : void 0;
|
|
7069
7144
|
if (typeof src === "string" && (flags === void 0 || typeof flags === "string")) {
|
|
7070
7145
|
try {
|
|
7071
7146
|
patRe = new RegExp(src, flags ?? "");
|
|
@@ -7099,12 +7174,11 @@ function callAbsMethod(recv, name, args) {
|
|
|
7099
7174
|
typeof whole === "string" ? strLit(whole) : unknown
|
|
7100
7175
|
];
|
|
7101
7176
|
const r = applyCallbackAbs(repAbs, callArgs, callbackEnv(), pTrue, defaultLeakBudget);
|
|
7102
|
-
|
|
7103
|
-
if (lv === void 0) {
|
|
7177
|
+
if (r.term?.op !== "lit") {
|
|
7104
7178
|
anyUnknown = true;
|
|
7105
7179
|
return "";
|
|
7106
7180
|
}
|
|
7107
|
-
return String(
|
|
7181
|
+
return String(r.term.value);
|
|
7108
7182
|
};
|
|
7109
7183
|
try {
|
|
7110
7184
|
const out = name === "replaceAll" ? lit3.replaceAll(pat, replWrapper) : lit3.replace(pat, replWrapper);
|
|
@@ -7125,8 +7199,10 @@ function callAbsMethod(recv, name, args) {
|
|
|
7125
7199
|
const a1Abs = args[1];
|
|
7126
7200
|
if (a0Abs !== void 0 && a0Abs.term?.op !== "lit") return strPrim("path");
|
|
7127
7201
|
if (a1Abs !== void 0 && a1Abs.term?.op !== "lit") return strPrim("path");
|
|
7128
|
-
const
|
|
7129
|
-
const
|
|
7202
|
+
const a0R2 = a0Abs === void 0 ? void 0 : litValue(a0Abs);
|
|
7203
|
+
const a02 = a0R2?.ok ? a0R2.value : void 0;
|
|
7204
|
+
const a1R = a1Abs === void 0 ? void 0 : litValue(a1Abs);
|
|
7205
|
+
const a1 = a1Abs === void 0 ? " " : a1R?.ok ? a1R.value : void 0;
|
|
7130
7206
|
try {
|
|
7131
7207
|
const impl = String.prototype;
|
|
7132
7208
|
return strLit(impl[name].call(lit3, a02, a1));
|
|
@@ -7300,7 +7376,8 @@ var BUILTIN_CTOR_NAMES = /* @__PURE__ */ new Set([
|
|
|
7300
7376
|
"DataView"
|
|
7301
7377
|
]);
|
|
7302
7378
|
function instanceOf(left, rightClassName, env) {
|
|
7303
|
-
|
|
7379
|
+
const leftLit = litValue(left);
|
|
7380
|
+
if ((leftLit.ok ? leftLit.value : void 0) === null || isNullishLitAbs(left)) {
|
|
7304
7381
|
return { shape: { k: "prim", type: "boolean" }, conf: "partial" };
|
|
7305
7382
|
}
|
|
7306
7383
|
const t = (v2) => ({
|
|
@@ -7597,9 +7674,9 @@ function leqShape(src, tgt, phi2, env, depth) {
|
|
|
7597
7674
|
if (srcSlot.optional && !slot.optional) {
|
|
7598
7675
|
return fail(`slot ${key}: optional \u22AD required`);
|
|
7599
7676
|
}
|
|
7600
|
-
const
|
|
7601
|
-
const
|
|
7602
|
-
if (
|
|
7677
|
+
const ssvR = litValue(srcSlot.value);
|
|
7678
|
+
const stvR = litValue(slot.value);
|
|
7679
|
+
if (ssvR.ok && stvR.ok && primOf(srcSlot.value) !== void 0 && primOf(srcSlot.value) === primOf(slot.value)) {
|
|
7603
7680
|
continue;
|
|
7604
7681
|
}
|
|
7605
7682
|
const r = leqWithPred(srcSlot.value, slot.value, phi2, env, depth + 1);
|
|
@@ -7676,7 +7753,8 @@ function leqShape(src, tgt, phi2, env, depth) {
|
|
|
7676
7753
|
}
|
|
7677
7754
|
function primOf(a) {
|
|
7678
7755
|
if (a.shape.k === "prim") return a.shape.type;
|
|
7679
|
-
const
|
|
7756
|
+
const lvR = litValue(a);
|
|
7757
|
+
const lv = lvR.ok ? lvR.value : void 0;
|
|
7680
7758
|
if (typeof lv === "number") return "number";
|
|
7681
7759
|
if (typeof lv === "string") return "string";
|
|
7682
7760
|
if (typeof lv === "boolean") return "boolean";
|
|
@@ -7724,11 +7802,12 @@ function formatShape(a) {
|
|
|
7724
7802
|
return "unknown";
|
|
7725
7803
|
}
|
|
7726
7804
|
case "prim": {
|
|
7727
|
-
const
|
|
7805
|
+
const lvR = litValue(a);
|
|
7806
|
+
const lv = lvR.ok ? lvR.value : void 0;
|
|
7728
7807
|
if (typeof lv === "number" && !Number.isFinite(lv)) return String(lv);
|
|
7729
7808
|
if (typeof lv === "number" && Object.is(lv, -0)) return "-0";
|
|
7730
7809
|
if (typeof lv === "bigint") return `${String(lv)}n`;
|
|
7731
|
-
if (
|
|
7810
|
+
if (lvR.ok) return JSON.stringify(lv);
|
|
7732
7811
|
return s.type;
|
|
7733
7812
|
}
|
|
7734
7813
|
case "obj": {
|
|
@@ -11435,14 +11514,22 @@ function asAbsVal(v2) {
|
|
|
11435
11514
|
return $lit(v2);
|
|
11436
11515
|
}
|
|
11437
11516
|
function callAtFunctionBoundary(body) {
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11517
|
+
let forwarded = [];
|
|
11518
|
+
try {
|
|
11519
|
+
return runWithLoopExits(() => {
|
|
11520
|
+
try {
|
|
11521
|
+
const r = body();
|
|
11522
|
+
forwarded = takeThrowExits();
|
|
11523
|
+
return r;
|
|
11524
|
+
} catch (e) {
|
|
11525
|
+
forwarded = takeThrowExits();
|
|
11526
|
+
if (isNudoReturn(e)) return e.absValue;
|
|
11527
|
+
throw e;
|
|
11528
|
+
}
|
|
11529
|
+
});
|
|
11530
|
+
} finally {
|
|
11531
|
+
for (const x of forwarded) pushThrowExit(x);
|
|
11532
|
+
}
|
|
11446
11533
|
}
|
|
11447
11534
|
function $fnVal(params, impl, opts) {
|
|
11448
11535
|
return absFunction(params, {
|
|
@@ -11602,6 +11689,14 @@ function $tryTakeSince(mark) {
|
|
|
11602
11689
|
if (!store) return [];
|
|
11603
11690
|
return store.splice(Math.min(mark, store.length));
|
|
11604
11691
|
}
|
|
11692
|
+
function peekThrowExitsSince(mark) {
|
|
11693
|
+
const store = throwExitsAls.getStore();
|
|
11694
|
+
if (!store) return [];
|
|
11695
|
+
return store.slice(Math.min(mark, store.length));
|
|
11696
|
+
}
|
|
11697
|
+
function throwExitsMark() {
|
|
11698
|
+
return throwExitsAls.getStore()?.length ?? 0;
|
|
11699
|
+
}
|
|
11605
11700
|
function $tryDigestSoftCatch() {
|
|
11606
11701
|
const soft = softFrameActiveAls.getStore();
|
|
11607
11702
|
if (!soft || soft.length === 0 || !soft[soft.length - 1]) return;
|
|
@@ -12181,7 +12276,8 @@ function isArrMutator(name) {
|
|
|
12181
12276
|
}
|
|
12182
12277
|
function toIOI(v2) {
|
|
12183
12278
|
if (v2 === void 0) return void 0;
|
|
12184
|
-
const
|
|
12279
|
+
const lvR = litValue(v2);
|
|
12280
|
+
const lv = lvR.ok ? lvR.value : void 0;
|
|
12185
12281
|
if (lv === void 0) {
|
|
12186
12282
|
return v2.term?.op === "lit" ? void 0 : null;
|
|
12187
12283
|
}
|
|
@@ -12485,7 +12581,8 @@ function $idx(a, i) {
|
|
|
12485
12581
|
return a.shape.element;
|
|
12486
12582
|
}
|
|
12487
12583
|
if (a.shape.k === "sum") {
|
|
12488
|
-
|
|
12584
|
+
const parts = a.shape.members.map((m) => $idx(m, i));
|
|
12585
|
+
return parts.length ? parts.reduce((x, y) => joinAbs(x, y)) : unknown;
|
|
12489
12586
|
}
|
|
12490
12587
|
if (a.shape.k === "obj" || a.shape.k === "brand" && a.shape.shape.shape.k === "obj") {
|
|
12491
12588
|
const objShape = a.shape.k === "obj" ? a.shape : a.shape.shape.shape;
|
|
@@ -12503,7 +12600,8 @@ function $idx(a, i) {
|
|
|
12503
12600
|
}
|
|
12504
12601
|
return joinSlotsWithUndef();
|
|
12505
12602
|
}
|
|
12506
|
-
const
|
|
12603
|
+
const svR = litValue(a);
|
|
12604
|
+
const sv = svR.ok && typeof svR.value === "string" ? svR.value : void 0;
|
|
12507
12605
|
if (typeof sv === "string") {
|
|
12508
12606
|
if (i.term?.op !== "lit") return unknown;
|
|
12509
12607
|
const idx2 = canonicalArrayIndex(i.term.value);
|
|
@@ -12608,12 +12706,13 @@ function $len(a) {
|
|
|
12608
12706
|
if (a.shape.k === "sum") {
|
|
12609
12707
|
const lens = a.shape.members.map((m) => $len(m));
|
|
12610
12708
|
const lits = lens.map(litValue);
|
|
12611
|
-
if (lits.length > 0 && lits.every((v2) => v2
|
|
12709
|
+
if (lits.length > 0 && lits.every((v2) => v2.ok && lits[0].ok && Object.is(v2.value, lits[0].value))) {
|
|
12612
12710
|
return lens[0];
|
|
12613
12711
|
}
|
|
12614
12712
|
return abs({ k: "prim", type: "number" }, void 0, void 0, "path");
|
|
12615
12713
|
}
|
|
12616
|
-
const
|
|
12714
|
+
const svR = litValue(a);
|
|
12715
|
+
const sv = svR.ok && typeof svR.value === "string" ? svR.value : void 0;
|
|
12617
12716
|
if (typeof sv === "string") {
|
|
12618
12717
|
return abs(
|
|
12619
12718
|
{ k: "prim", type: "number" },
|
|
@@ -12679,7 +12778,8 @@ function $spread(a, b) {
|
|
|
12679
12778
|
function $objRest(o, keys) {
|
|
12680
12779
|
o = asAbsVal(o);
|
|
12681
12780
|
if (o.shape.k === "sum") {
|
|
12682
|
-
|
|
12781
|
+
const parts = o.shape.members.map((m) => $objRest(m, keys));
|
|
12782
|
+
return parts.length ? parts.reduce((a, b) => joinAbs(a, b)) : unknown;
|
|
12683
12783
|
}
|
|
12684
12784
|
if (!isObj(o)) {
|
|
12685
12785
|
if (o.shape.k === "any") {
|
|
@@ -12703,7 +12803,8 @@ function $objRest(o, keys) {
|
|
|
12703
12803
|
function $arrRest(a, start) {
|
|
12704
12804
|
a = asAbsVal(a);
|
|
12705
12805
|
if (a.shape.k === "sum") {
|
|
12706
|
-
|
|
12806
|
+
const parts = a.shape.members.map((m) => $arrRest(m, start));
|
|
12807
|
+
return parts.length ? parts.reduce((x, y) => joinAbs(x, y)) : unknown;
|
|
12707
12808
|
}
|
|
12708
12809
|
if (a.shape.k === "tuple") {
|
|
12709
12810
|
return tupleOrWiden(a.shape.elements.slice(start), a.conf);
|
|
@@ -12715,11 +12816,13 @@ function $arrRest(a, start) {
|
|
|
12715
12816
|
function $concat(a, b) {
|
|
12716
12817
|
a = asAbsVal(a);
|
|
12717
12818
|
b = asAbsVal(b);
|
|
12718
|
-
const
|
|
12819
|
+
const avR = litValue(a);
|
|
12820
|
+
const av = avR.ok ? avR.value : void 0;
|
|
12719
12821
|
if (typeof av === "string") {
|
|
12720
12822
|
return $concat($arr([...av].map((c) => $lit(c))), b);
|
|
12721
12823
|
}
|
|
12722
|
-
const
|
|
12824
|
+
const bvR = litValue(b);
|
|
12825
|
+
const bv = bvR.ok ? bvR.value : void 0;
|
|
12723
12826
|
if (typeof bv === "string") {
|
|
12724
12827
|
return $concat(a, $arr([...bv].map((c) => $lit(c))));
|
|
12725
12828
|
}
|
|
@@ -12767,7 +12870,9 @@ function $concat(a, b) {
|
|
|
12767
12870
|
return tupleOrWiden([...ae, ...bs.elements], confJoin(a.conf, b.conf));
|
|
12768
12871
|
}
|
|
12769
12872
|
const sideEl = (x, expanded) => {
|
|
12770
|
-
if (expanded)
|
|
12873
|
+
if (expanded) {
|
|
12874
|
+
return expanded.length ? expanded.reduce((u, y) => joinAbs(u, y)) : abs({ k: "never" }, void 0, void 0, "exact");
|
|
12875
|
+
}
|
|
12771
12876
|
if (x?.shape?.k === "any") return anyMemberResult();
|
|
12772
12877
|
if (x?.shape?.k === "tuple") {
|
|
12773
12878
|
const els = x.shape.elements;
|
|
@@ -12789,7 +12894,8 @@ function $elems(a) {
|
|
|
12789
12894
|
if (isMapAbs(a)) return mapEntriesAbs(a);
|
|
12790
12895
|
const mi = matchIterElements(a);
|
|
12791
12896
|
if (mi) return mi;
|
|
12792
|
-
const
|
|
12897
|
+
const svR = litValue(a);
|
|
12898
|
+
const sv = svR.ok ? svR.value : void 0;
|
|
12793
12899
|
if (typeof sv === "string") return [...sv].map((c) => $lit(c));
|
|
12794
12900
|
return [unknown];
|
|
12795
12901
|
}
|
|
@@ -12797,7 +12903,7 @@ function $forInKeys(o) {
|
|
|
12797
12903
|
const shape = o.shape;
|
|
12798
12904
|
if (shape.k === "sum") {
|
|
12799
12905
|
const members = shape.members.map((m) => $forInKeys(m));
|
|
12800
|
-
return members.reduce((a, b) => joinAbs(a, b));
|
|
12906
|
+
return members.length ? members.reduce((a, b) => joinAbs(a, b)) : unknown;
|
|
12801
12907
|
}
|
|
12802
12908
|
const isArrayIndexKey = (k) => {
|
|
12803
12909
|
const n = Number(k);
|
|
@@ -12820,7 +12926,8 @@ function $forInKeys(o) {
|
|
|
12820
12926
|
if (shape.k === "arr") {
|
|
12821
12927
|
return abs({ k: "arr", element: $lit("0") }, void 0, void 0, "partial");
|
|
12822
12928
|
}
|
|
12823
|
-
const
|
|
12929
|
+
const svR = litValue(o);
|
|
12930
|
+
const sv = svR.ok && typeof svR.value === "string" ? svR.value : void 0;
|
|
12824
12931
|
if (typeof sv === "string") {
|
|
12825
12932
|
return $arr(Array.from({ length: sv.length }, (_, i) => $lit(String(i))));
|
|
12826
12933
|
}
|
|
@@ -12841,7 +12948,8 @@ function $forOf(iterable, body, maxIters = DEFAULT_MAX_LOOP_ITERS, opts) {
|
|
|
12841
12948
|
};
|
|
12842
12949
|
const shape = iterable.shape;
|
|
12843
12950
|
const items = $elems(iterable);
|
|
12844
|
-
const
|
|
12951
|
+
const svR = litValue(iterable);
|
|
12952
|
+
const sv = svR.ok ? svR.value : void 0;
|
|
12845
12953
|
const knownLen = shape.k === "tuple" ? shape.elements.length : typeof sv === "string" ? [...sv].length : collectionExactLen(iterable);
|
|
12846
12954
|
const unbounded = knownLen === void 0;
|
|
12847
12955
|
if (unbounded) snapExit();
|
|
@@ -13034,7 +13142,8 @@ function $get(o, key, opts) {
|
|
|
13034
13142
|
}
|
|
13035
13143
|
if (o.shape.k === "prim" && o.shape.type === "string") {
|
|
13036
13144
|
const idx = canonicalArrayIndex(key);
|
|
13037
|
-
const
|
|
13145
|
+
const svR = litValue(o);
|
|
13146
|
+
const sv = svR.ok && typeof svR.value === "string" ? svR.value : void 0;
|
|
13038
13147
|
if (idx !== void 0) {
|
|
13039
13148
|
if (typeof sv === "string") return idx < sv.length ? $lit(sv[idx]) : undef();
|
|
13040
13149
|
return abs({ k: "prim", type: "string" }, void 0, void 0, "path");
|
|
@@ -13078,7 +13187,7 @@ function $get(o, key, opts) {
|
|
|
13078
13187
|
}
|
|
13079
13188
|
if (o.shape.k === "sum") {
|
|
13080
13189
|
const parts = o.shape.members.map((m) => $get(m, key, opts));
|
|
13081
|
-
return parts.reduce((a, b) => joinAbs(a, b));
|
|
13190
|
+
return parts.length ? parts.reduce((a, b) => joinAbs(a, b)) : unknown;
|
|
13082
13191
|
}
|
|
13083
13192
|
if (key === "constructor") {
|
|
13084
13193
|
const cn = ctorNameOfRecv(o);
|
|
@@ -13168,7 +13277,8 @@ function $set(o, key, value) {
|
|
|
13168
13277
|
}
|
|
13169
13278
|
if (o.shape.k === "tuple" && key === "length") {
|
|
13170
13279
|
if (extStateOf(o) === "frozen") throwStrictWrite();
|
|
13171
|
-
const
|
|
13280
|
+
const vR = litValue(value);
|
|
13281
|
+
const v2 = vR.ok ? vR.value : void 0;
|
|
13172
13282
|
if (typeof v2 === "number") {
|
|
13173
13283
|
if (!Number.isInteger(v2) || v2 < 0 || v2 > 4294967295) {
|
|
13174
13284
|
throw new NudoThrow(errorTypeAbs("RangeError"));
|
|
@@ -13199,7 +13309,8 @@ function $set(o, key, value) {
|
|
|
13199
13309
|
return o;
|
|
13200
13310
|
}
|
|
13201
13311
|
if (o.shape.k === "arr" && key === "length") {
|
|
13202
|
-
const
|
|
13312
|
+
const vR = litValue(value);
|
|
13313
|
+
const v2 = vR.ok ? vR.value : void 0;
|
|
13203
13314
|
if (typeof v2 === "number" && (!Number.isInteger(v2) || v2 < 0 || v2 > 4294967295)) {
|
|
13204
13315
|
throw new NudoThrow(errorTypeAbs("RangeError"));
|
|
13205
13316
|
}
|
|
@@ -13498,9 +13609,9 @@ function $for(init, test, step, body, maxIters = DEFAULT_MAX_LOOP_ITERS, opts) {
|
|
|
13498
13609
|
snapExt();
|
|
13499
13610
|
}
|
|
13500
13611
|
if (i > 0) {
|
|
13501
|
-
const
|
|
13502
|
-
const
|
|
13503
|
-
const stuck =
|
|
13612
|
+
const nvR = litValue(next);
|
|
13613
|
+
const svR = litValue(state);
|
|
13614
|
+
const stuck = nvR.ok && svR.ok && nvR.value === svR.value || (!nvR.ok || nvR.value === void 0) && (!svR.ok || svR.value === void 0) && leqAbs(next, state).ok;
|
|
13504
13615
|
if (stuck) {
|
|
13505
13616
|
state = next;
|
|
13506
13617
|
snapCounter();
|
|
@@ -13529,9 +13640,9 @@ function $while(init, test, step, maxIters = DEFAULT_MAX_LOOP_ITERS) {
|
|
|
13529
13640
|
}
|
|
13530
13641
|
const next = step(state);
|
|
13531
13642
|
if (i > 0) {
|
|
13532
|
-
const
|
|
13533
|
-
const
|
|
13534
|
-
const stuck =
|
|
13643
|
+
const nvR = litValue(next);
|
|
13644
|
+
const svR = litValue(state);
|
|
13645
|
+
const stuck = nvR.ok && svR.ok && nvR.value === svR.value || (!nvR.ok || nvR.value === void 0) && (!svR.ok || svR.value === void 0) && leqAbs(next, state).ok;
|
|
13535
13646
|
if (stuck) {
|
|
13536
13647
|
return exitJoin ? joinAbs(exitJoin, next) : next;
|
|
13537
13648
|
}
|
|
@@ -13576,11 +13687,11 @@ function $whileSeq(test, body, maxIters = DEFAULT_MAX_LOOP_ITERS, opts) {
|
|
|
13576
13687
|
applyExitJoin();
|
|
13577
13688
|
}
|
|
13578
13689
|
function $switch(disc, cases, dflt) {
|
|
13579
|
-
const
|
|
13580
|
-
if (
|
|
13690
|
+
const dvR = litValue(disc);
|
|
13691
|
+
if (dvR.ok) {
|
|
13581
13692
|
for (const c of cases) {
|
|
13582
|
-
const
|
|
13583
|
-
if (
|
|
13693
|
+
const tvR = litValue(c.test);
|
|
13694
|
+
if (tvR.ok && tvR.value === dvR.value) return asAbsVal(c.run());
|
|
13584
13695
|
}
|
|
13585
13696
|
return dflt ? asAbsVal(dflt()) : undef();
|
|
13586
13697
|
}
|
|
@@ -13769,6 +13880,7 @@ __export(calls_exports, {
|
|
|
13769
13880
|
MAX_EVAL_CALL_DEPTH: () => MAX_EVAL_CALL_DEPTH,
|
|
13770
13881
|
MAX_EVAL_TOTAL_CALLS: () => MAX_EVAL_TOTAL_CALLS,
|
|
13771
13882
|
blockHostSideEffect: () => blockHostSideEffect,
|
|
13883
|
+
clearPureCallMemo: () => clearPureCallMemo,
|
|
13772
13884
|
enterEvalCallBudgetSession: () => enterEvalCallBudgetSession,
|
|
13773
13885
|
exitEvalCallBudgetSession: () => exitEvalCallBudgetSession,
|
|
13774
13886
|
getEvalCallBudgetState: () => getEvalCallBudgetState,
|
|
@@ -13781,7 +13893,71 @@ __export(calls_exports, {
|
|
|
13781
13893
|
setEvalCallCollector: () => setEvalCallCollector,
|
|
13782
13894
|
withEvalBudgetOverride: () => withEvalBudgetOverride
|
|
13783
13895
|
});
|
|
13896
|
+
|
|
13897
|
+
// src/algebra/lru-map.ts
|
|
13898
|
+
var BoundedLruMap = class {
|
|
13899
|
+
map = /* @__PURE__ */ new Map();
|
|
13900
|
+
max;
|
|
13901
|
+
constructor(max) {
|
|
13902
|
+
this.max = max;
|
|
13903
|
+
}
|
|
13904
|
+
get size() {
|
|
13905
|
+
return this.map.size;
|
|
13906
|
+
}
|
|
13907
|
+
getMax() {
|
|
13908
|
+
return this.max;
|
|
13909
|
+
}
|
|
13910
|
+
setMax(max) {
|
|
13911
|
+
this.max = max;
|
|
13912
|
+
this.trim();
|
|
13913
|
+
}
|
|
13914
|
+
has(key) {
|
|
13915
|
+
return this.map.has(key);
|
|
13916
|
+
}
|
|
13917
|
+
get(key) {
|
|
13918
|
+
const hit = this.map.get(key);
|
|
13919
|
+
if (hit === void 0) return void 0;
|
|
13920
|
+
this.map.delete(key);
|
|
13921
|
+
this.map.set(key, hit);
|
|
13922
|
+
return hit;
|
|
13923
|
+
}
|
|
13924
|
+
set(key, value) {
|
|
13925
|
+
if (this.max <= 0) return;
|
|
13926
|
+
while (this.map.size >= this.max && !this.map.has(key)) {
|
|
13927
|
+
const oldest = this.map.keys().next().value;
|
|
13928
|
+
if (oldest === void 0) break;
|
|
13929
|
+
this.map.delete(oldest);
|
|
13930
|
+
}
|
|
13931
|
+
this.map.delete(key);
|
|
13932
|
+
this.map.set(key, value);
|
|
13933
|
+
}
|
|
13934
|
+
delete(key) {
|
|
13935
|
+
return this.map.delete(key);
|
|
13936
|
+
}
|
|
13937
|
+
clear() {
|
|
13938
|
+
this.map.clear();
|
|
13939
|
+
}
|
|
13940
|
+
trim() {
|
|
13941
|
+
while (this.map.size > this.max) {
|
|
13942
|
+
const oldest = this.map.keys().next().value;
|
|
13943
|
+
if (oldest === void 0) break;
|
|
13944
|
+
this.map.delete(oldest);
|
|
13945
|
+
}
|
|
13946
|
+
}
|
|
13947
|
+
};
|
|
13948
|
+
|
|
13949
|
+
// src/algebra/exec/calls.ts
|
|
13950
|
+
var PURE_CALL_MEMO_MAX = 256;
|
|
13784
13951
|
var pureCallMemo = /* @__PURE__ */ new WeakMap();
|
|
13952
|
+
function clearPureCallMemo() {
|
|
13953
|
+
pureCallMemo = /* @__PURE__ */ new WeakMap();
|
|
13954
|
+
}
|
|
13955
|
+
function joinThrowsSince(mark) {
|
|
13956
|
+
const items = peekThrowExitsSince(mark);
|
|
13957
|
+
if (items.length === 0) return never;
|
|
13958
|
+
if (items.length === 1) return items[0];
|
|
13959
|
+
return items.reduce((a, b) => joinAbs(a, b));
|
|
13960
|
+
}
|
|
13785
13961
|
var evalCallCollector = null;
|
|
13786
13962
|
var evalAssignCollector = null;
|
|
13787
13963
|
function setEvalAssignCollector(collector2) {
|
|
@@ -13906,6 +14082,8 @@ function resetEvalCallBudget() {
|
|
|
13906
14082
|
evalCallDepthLimit = MAX_EVAL_CALL_DEPTH;
|
|
13907
14083
|
evalTotalCallsLimit = MAX_EVAL_TOTAL_CALLS;
|
|
13908
14084
|
resetEvalForkBudget();
|
|
14085
|
+
clearPureMemo();
|
|
14086
|
+
clearPureCallMemo();
|
|
13909
14087
|
}
|
|
13910
14088
|
function withEvalBudgetOverride(budget, run) {
|
|
13911
14089
|
const prevDepth = evalCallDepthLimit;
|
|
@@ -13971,10 +14149,11 @@ function $callNamed(name, fn, args, loc, argLocs) {
|
|
|
13971
14149
|
const pk = pureName && fnObj ? callBudgetKey("pure", "", args) : void 0;
|
|
13972
14150
|
if (fnObj && pk !== void 0) {
|
|
13973
14151
|
const hit = pureCallMemo.get(fnObj)?.get(pk);
|
|
13974
|
-
if (hit !== void 0) return hit;
|
|
14152
|
+
if (hit !== void 0) return routeApplyThrows(hit.abs, hit.throws);
|
|
13975
14153
|
}
|
|
13976
14154
|
let result = unknown;
|
|
13977
14155
|
let threw = false;
|
|
14156
|
+
const throwMark = throwExitsMark();
|
|
13978
14157
|
if (argLocs) {
|
|
13979
14158
|
for (let i = 0; i < args.length; i++) {
|
|
13980
14159
|
const al = argLocs[i];
|
|
@@ -14034,10 +14213,10 @@ function $callNamed(name, fn, args, loc, argLocs) {
|
|
|
14034
14213
|
if (fnObj && pk !== void 0 && !threw) {
|
|
14035
14214
|
let m = pureCallMemo.get(fnObj);
|
|
14036
14215
|
if (!m) {
|
|
14037
|
-
m =
|
|
14216
|
+
m = new BoundedLruMap(PURE_CALL_MEMO_MAX);
|
|
14038
14217
|
pureCallMemo.set(fnObj, m);
|
|
14039
14218
|
}
|
|
14040
|
-
m.set(pk, result);
|
|
14219
|
+
m.set(pk, makeAbsApplyResult(result, joinThrowsSince(throwMark)));
|
|
14041
14220
|
}
|
|
14042
14221
|
if (evalCallCollector) {
|
|
14043
14222
|
try {
|
|
@@ -14064,11 +14243,14 @@ function regexParts(re) {
|
|
|
14064
14243
|
const patAbs = slots["source"]?.value;
|
|
14065
14244
|
const flagsAbs = slots["flags"]?.value;
|
|
14066
14245
|
const lastAbs = slots["lastIndex"]?.value;
|
|
14067
|
-
const
|
|
14246
|
+
const patR = patAbs ? litValue(patAbs) : void 0;
|
|
14247
|
+
const pat = patR?.ok ? patR.value : void 0;
|
|
14068
14248
|
if (typeof pat !== "string") return void 0;
|
|
14069
|
-
const
|
|
14249
|
+
const flagsR = flagsAbs ? litValue(flagsAbs) : void 0;
|
|
14250
|
+
const flagsV = flagsR?.ok ? flagsR.value : void 0;
|
|
14070
14251
|
const flags = typeof flagsV === "string" ? flagsV : "";
|
|
14071
|
-
const
|
|
14252
|
+
const lvR = lastAbs ? litValue(lastAbs) : void 0;
|
|
14253
|
+
const lv = lvR?.ok ? lvR.value : void 0;
|
|
14072
14254
|
const lastIndex = typeof lv === "number" ? lv : 0;
|
|
14073
14255
|
return { pat, flags, lastIndex };
|
|
14074
14256
|
}
|
|
@@ -14098,7 +14280,8 @@ function execRegexBrand(re, method, args) {
|
|
|
14098
14280
|
const parts = regexParts(re);
|
|
14099
14281
|
if (!parts) return void 0;
|
|
14100
14282
|
if (method === "toString") return strLit(`/${parts.pat}/${parts.flags}`);
|
|
14101
|
-
const
|
|
14283
|
+
const subjectR = args[0] ? litValue(args[0]) : void 0;
|
|
14284
|
+
const subject = subjectR?.ok ? subjectR.value : void 0;
|
|
14102
14285
|
if (typeof subject !== "string") {
|
|
14103
14286
|
if (method === "test") {
|
|
14104
14287
|
return abs({ k: "prim", type: "boolean" }, void 0, void 0, "partial");
|
|
@@ -14117,7 +14300,8 @@ function execRegexBrand(re, method, args) {
|
|
|
14117
14300
|
function $reStateCall(re, method, args) {
|
|
14118
14301
|
const parts = regexParts(re);
|
|
14119
14302
|
if (!parts || method !== "test" && method !== "exec") return re;
|
|
14120
|
-
const
|
|
14303
|
+
const subjectR = args[0] ? litValue(args[0]) : void 0;
|
|
14304
|
+
const subject = subjectR?.ok ? subjectR.value : void 0;
|
|
14121
14305
|
if (typeof subject !== "string") return re;
|
|
14122
14306
|
try {
|
|
14123
14307
|
const { lastIndex } = regexExecWithState(re, method, subject);
|
|
@@ -14141,10 +14325,13 @@ function stringRegexMethod(recv, method, args) {
|
|
|
14141
14325
|
const inner = reBrand?.shape.shape;
|
|
14142
14326
|
const patAbs = inner && inner.shape.k === "obj" ? inner.shape.slots["source"]?.value : void 0;
|
|
14143
14327
|
const flagsAbs = inner && inner.shape.k === "obj" ? inner.shape.slots["flags"]?.value : void 0;
|
|
14144
|
-
const
|
|
14145
|
-
const
|
|
14328
|
+
const patR = patAbs ? litValue(patAbs) : void 0;
|
|
14329
|
+
const pat = patR?.ok ? patR.value : void 0;
|
|
14330
|
+
const svR = litValue(recv);
|
|
14331
|
+
const sv = svR.ok && typeof svR.value === "string" ? svR.value : void 0;
|
|
14146
14332
|
if (typeof pat !== "string" || typeof sv !== "string") return void 0;
|
|
14147
|
-
const
|
|
14333
|
+
const flagsR = flagsAbs ? litValue(flagsAbs) : void 0;
|
|
14334
|
+
const flagsV = flagsR?.ok ? flagsR.value : void 0;
|
|
14148
14335
|
const flags = typeof flagsV === "string" ? flagsV : "";
|
|
14149
14336
|
let reReal;
|
|
14150
14337
|
try {
|
|
@@ -14302,7 +14489,8 @@ function $new(cls, args) {
|
|
|
14302
14489
|
return evalPromiseCtor(args);
|
|
14303
14490
|
}
|
|
14304
14491
|
if (clsName === "String") {
|
|
14305
|
-
const
|
|
14492
|
+
const a0R = args[0] ? litValue(args[0]) : void 0;
|
|
14493
|
+
const a0 = a0R?.ok ? a0R.value : void 0;
|
|
14306
14494
|
if (typeof a0 === "string") {
|
|
14307
14495
|
const slots = {
|
|
14308
14496
|
length: { value: numLit(a0.length) }
|
|
@@ -14618,13 +14806,15 @@ function $invoke(thisVal, method, args, loc) {
|
|
|
14618
14806
|
}
|
|
14619
14807
|
}
|
|
14620
14808
|
if (thisVal.shape.k === "prim" && thisVal.shape.type === "bigint") {
|
|
14621
|
-
const
|
|
14809
|
+
const bvR = litValue(thisVal);
|
|
14810
|
+
const bv = bvR.ok ? bvR.value : void 0;
|
|
14622
14811
|
if (typeof bv === "bigint") {
|
|
14623
14812
|
if (method === "valueOf") return thisVal;
|
|
14624
14813
|
if (method === "toString") {
|
|
14625
14814
|
const argAbs = args[0];
|
|
14626
14815
|
if (argAbs !== void 0 && argAbs.term?.op !== "lit") return unknown;
|
|
14627
|
-
const
|
|
14816
|
+
const avR = argAbs === void 0 ? void 0 : litValue(argAbs);
|
|
14817
|
+
const av = avR?.ok ? avR.value : void 0;
|
|
14628
14818
|
try {
|
|
14629
14819
|
return strLit(bv.toString(av));
|
|
14630
14820
|
} catch (e) {
|
|
@@ -14639,13 +14829,15 @@ function $invoke(thisVal, method, args, loc) {
|
|
|
14639
14829
|
if (thisVal.shape.k === "prim" && thisVal.shape.type === "number") {
|
|
14640
14830
|
if (method === "valueOf") return thisVal;
|
|
14641
14831
|
if (method === "toString" || method === "toLocaleString") {
|
|
14642
|
-
const
|
|
14832
|
+
const nvR = litValue(thisVal);
|
|
14833
|
+
const nv = nvR.ok ? nvR.value : void 0;
|
|
14643
14834
|
if (typeof nv !== "number") return abs({ k: "prim", type: "string" }, void 0, void 0, "path");
|
|
14644
14835
|
const argAbs = args[0];
|
|
14645
14836
|
if (argAbs !== void 0 && argAbs.term?.op !== "lit") {
|
|
14646
14837
|
return abs({ k: "prim", type: "string" }, void 0, void 0, "path");
|
|
14647
14838
|
}
|
|
14648
|
-
const
|
|
14839
|
+
const avR = argAbs === void 0 ? void 0 : litValue(argAbs);
|
|
14840
|
+
const av = avR?.ok ? avR.value : void 0;
|
|
14649
14841
|
try {
|
|
14650
14842
|
const impl2 = Number.prototype;
|
|
14651
14843
|
return strLit(impl2[method === "toLocaleString" ? "toString" : method].call(nv, av));
|
|
@@ -14656,13 +14848,15 @@ function $invoke(thisVal, method, args, loc) {
|
|
|
14656
14848
|
}
|
|
14657
14849
|
}
|
|
14658
14850
|
if (method === "toFixed" || method === "toExponential" || method === "toPrecision") {
|
|
14659
|
-
const
|
|
14851
|
+
const nvR = litValue(thisVal);
|
|
14852
|
+
const nv = nvR.ok ? nvR.value : void 0;
|
|
14660
14853
|
if (typeof nv !== "number") return abs({ k: "prim", type: "string" }, void 0, void 0, "path");
|
|
14661
14854
|
const argAbs = args[0];
|
|
14662
14855
|
if (argAbs !== void 0 && argAbs.term?.op !== "lit") {
|
|
14663
14856
|
return abs({ k: "prim", type: "string" }, void 0, void 0, "path");
|
|
14664
14857
|
}
|
|
14665
|
-
const
|
|
14858
|
+
const avR = argAbs === void 0 ? void 0 : litValue(argAbs);
|
|
14859
|
+
const av = avR?.ok ? avR.value : void 0;
|
|
14666
14860
|
try {
|
|
14667
14861
|
const impl2 = Number.prototype;
|
|
14668
14862
|
return strLit(impl2[method].call(nv, av));
|
|
@@ -14676,7 +14870,8 @@ function $invoke(thisVal, method, args, loc) {
|
|
|
14676
14870
|
if (thisVal.shape.k === "prim" && thisVal.shape.type === "boolean") {
|
|
14677
14871
|
if (method === "valueOf") return thisVal;
|
|
14678
14872
|
if (method === "toString" || method === "toLocaleString") {
|
|
14679
|
-
const
|
|
14873
|
+
const bvR = litValue(thisVal);
|
|
14874
|
+
const bv = bvR.ok ? bvR.value : void 0;
|
|
14680
14875
|
if (typeof bv === "boolean") return strLit(String(bv));
|
|
14681
14876
|
return abs({ k: "prim", type: "string" }, void 0, void 0, "path");
|
|
14682
14877
|
}
|
|
@@ -14763,7 +14958,8 @@ function invokeArrMethod(arr, method, args) {
|
|
|
14763
14958
|
const unknownIdx = () => abs({ k: "prim", type: "number" }, void 0, void 0, "path");
|
|
14764
14959
|
const callbackTruth = (r) => {
|
|
14765
14960
|
if (r.term?.op !== "lit") return void 0;
|
|
14766
|
-
const
|
|
14961
|
+
const vR = litValue(r);
|
|
14962
|
+
const v2 = vR.ok ? vR.value : void 0;
|
|
14767
14963
|
if (v2 === void 0 || v2 === null || v2 === false || v2 === "" || v2 === 0n) return false;
|
|
14768
14964
|
if (typeof v2 === "number" && (v2 === 0 || Number.isNaN(v2))) return false;
|
|
14769
14965
|
return true;
|
|
@@ -15116,7 +15312,8 @@ function $orDefault(v2, dflt) {
|
|
|
15116
15312
|
function isDefinitelyUndefinedAbs(v2) {
|
|
15117
15313
|
if (!v2) return false;
|
|
15118
15314
|
if (v2.term?.op === "lit" && v2.term.value === void 0) return true;
|
|
15119
|
-
|
|
15315
|
+
const r = litValue(v2);
|
|
15316
|
+
if (v2.shape.k === "unknown" && r.ok && r.value === void 0) return true;
|
|
15120
15317
|
return false;
|
|
15121
15318
|
}
|
|
15122
15319
|
function isNullishAbs2(v2) {
|
|
@@ -15272,6 +15469,7 @@ function lookupExport(env, name) {
|
|
|
15272
15469
|
function collectAbsExports(file, env, modules) {
|
|
15273
15470
|
const named = {};
|
|
15274
15471
|
let defaultExport;
|
|
15472
|
+
const explicitNames = /* @__PURE__ */ new Set();
|
|
15275
15473
|
for (const stmt of file.program.body) {
|
|
15276
15474
|
if (stmt.type === "ExportNamedDeclaration") {
|
|
15277
15475
|
if (stmt.source && modules) {
|
|
@@ -15281,6 +15479,7 @@ function collectAbsExports(file, env, modules) {
|
|
|
15281
15479
|
if (spec.type === "ExportNamespaceSpecifier") {
|
|
15282
15480
|
const exported2 = spec.exported.type === "Identifier" ? spec.exported.name : spec.exported.value;
|
|
15283
15481
|
named[exported2] = namespaceAbsOf(mod2);
|
|
15482
|
+
explicitNames.add(exported2);
|
|
15284
15483
|
continue;
|
|
15285
15484
|
}
|
|
15286
15485
|
if (spec.type !== "ExportSpecifier") continue;
|
|
@@ -15289,7 +15488,10 @@ function collectAbsExports(file, env, modules) {
|
|
|
15289
15488
|
const v2 = local === "default" ? mod2.default : mod2.named[local];
|
|
15290
15489
|
const slot = v2 ?? unknown;
|
|
15291
15490
|
if (exported === "default") defaultExport = slot;
|
|
15292
|
-
else
|
|
15491
|
+
else {
|
|
15492
|
+
named[exported] = slot;
|
|
15493
|
+
explicitNames.add(exported);
|
|
15494
|
+
}
|
|
15293
15495
|
}
|
|
15294
15496
|
}
|
|
15295
15497
|
continue;
|
|
@@ -15298,12 +15500,15 @@ function collectAbsExports(file, env, modules) {
|
|
|
15298
15500
|
if (decl) {
|
|
15299
15501
|
if (decl.type === "FunctionDeclaration" && decl.id) {
|
|
15300
15502
|
named[decl.id.name] = lookupExport(env, decl.id.name) ?? unknown;
|
|
15503
|
+
explicitNames.add(decl.id.name);
|
|
15301
15504
|
} else if (decl.type === "ClassDeclaration" && decl.id) {
|
|
15302
15505
|
named[decl.id.name] = lookupExport(env, decl.id.name) ?? unknown;
|
|
15506
|
+
explicitNames.add(decl.id.name);
|
|
15303
15507
|
} else if (decl.type === "VariableDeclaration") {
|
|
15304
15508
|
for (const d of decl.declarations) {
|
|
15305
15509
|
if (d.id.type === "Identifier") {
|
|
15306
15510
|
named[d.id.name] = lookupExport(env, d.id.name) ?? unknown;
|
|
15511
|
+
explicitNames.add(d.id.name);
|
|
15307
15512
|
}
|
|
15308
15513
|
}
|
|
15309
15514
|
}
|
|
@@ -15312,6 +15517,7 @@ function collectAbsExports(file, env, modules) {
|
|
|
15312
15517
|
if (spec.type === "ExportNamespaceSpecifier") {
|
|
15313
15518
|
const exported2 = spec.exported.type === "Identifier" ? spec.exported.name : spec.exported.value;
|
|
15314
15519
|
named[exported2] ??= unknown;
|
|
15520
|
+
explicitNames.add(exported2);
|
|
15315
15521
|
continue;
|
|
15316
15522
|
}
|
|
15317
15523
|
if (spec.type !== "ExportSpecifier") continue;
|
|
@@ -15319,12 +15525,17 @@ function collectAbsExports(file, env, modules) {
|
|
|
15319
15525
|
const exported = spec.exported.type === "Identifier" ? spec.exported.name : spec.exported.value;
|
|
15320
15526
|
const v2 = lookupExport(env, local) ?? unknown;
|
|
15321
15527
|
if (exported === "default") defaultExport = v2;
|
|
15322
|
-
else
|
|
15528
|
+
else {
|
|
15529
|
+
named[exported] = v2;
|
|
15530
|
+
explicitNames.add(exported);
|
|
15531
|
+
}
|
|
15323
15532
|
}
|
|
15324
15533
|
} else if (stmt.type === "ExportAllDeclaration" && stmt.source && modules) {
|
|
15325
15534
|
const mod2 = modules[stmt.source.value];
|
|
15326
15535
|
if (mod2?.named) {
|
|
15327
|
-
for (const [k, v2] of Object.entries(mod2.named))
|
|
15536
|
+
for (const [k, v2] of Object.entries(mod2.named)) {
|
|
15537
|
+
if (!explicitNames.has(k)) named[k] = v2;
|
|
15538
|
+
}
|
|
15328
15539
|
}
|
|
15329
15540
|
} else if (stmt.type === "ExportDefaultDeclaration") {
|
|
15330
15541
|
const d = stmt.declaration;
|
|
@@ -15594,6 +15805,7 @@ ${js}`;
|
|
|
15594
15805
|
const { names, js: stripped } = stripStaticExportDecls(js);
|
|
15595
15806
|
js = stripped;
|
|
15596
15807
|
const dynExports = {};
|
|
15808
|
+
const explicitExportNames = new Set(names);
|
|
15597
15809
|
const bindings = /* @__PURE__ */ new Map();
|
|
15598
15810
|
const argNames = [
|
|
15599
15811
|
...runtimeArgNames(),
|
|
@@ -15627,6 +15839,7 @@ ${js}`;
|
|
|
15627
15839
|
if (n === "__nudoExport") {
|
|
15628
15840
|
return (name, value) => {
|
|
15629
15841
|
dynExports[name] = value;
|
|
15842
|
+
explicitExportNames.add(name);
|
|
15630
15843
|
};
|
|
15631
15844
|
}
|
|
15632
15845
|
if (n === "__nudoExportStar") {
|
|
@@ -15634,7 +15847,7 @@ ${js}`;
|
|
|
15634
15847
|
const mod2 = modules?.[spec];
|
|
15635
15848
|
if (mod2 && "named" in mod2) {
|
|
15636
15849
|
for (const [k, v2] of Object.entries(mod2.named)) {
|
|
15637
|
-
dynExports[k] = v2;
|
|
15850
|
+
if (!explicitExportNames.has(k)) dynExports[k] = v2;
|
|
15638
15851
|
}
|
|
15639
15852
|
}
|
|
15640
15853
|
};
|
|
@@ -15820,6 +16033,13 @@ function joinControlExits(normal) {
|
|
|
15820
16033
|
function callTranspiledExport(exports, name, args) {
|
|
15821
16034
|
return callTranspiledExportFull(exports, name, args).result;
|
|
15822
16035
|
}
|
|
16036
|
+
function callTranspiledExportApply(exports, name) {
|
|
16037
|
+
const resolve = typeof exports === "function" ? exports : () => exports;
|
|
16038
|
+
return (args) => {
|
|
16039
|
+
const full = callTranspiledExportFull(resolve(), name, args);
|
|
16040
|
+
return makeAbsApplyResult(full.result, full.throws);
|
|
16041
|
+
};
|
|
16042
|
+
}
|
|
15823
16043
|
|
|
15824
16044
|
// src/algebra/exec/body-fn.ts
|
|
15825
16045
|
var RUNTIME_IMPORT_RE2 = /^import\s*\{[^}]+\}\s*from\s*"[^"]+";\s*$/m;
|
|
@@ -15951,10 +16171,30 @@ function compiledBodyOf(impl) {
|
|
|
15951
16171
|
}
|
|
15952
16172
|
|
|
15953
16173
|
// src/algebra/exec/call.ts
|
|
16174
|
+
var PURE_MEMO_MAX = 256;
|
|
15954
16175
|
var pureMemo = /* @__PURE__ */ new WeakMap();
|
|
16176
|
+
function clearPureMemo() {
|
|
16177
|
+
pureMemo = /* @__PURE__ */ new WeakMap();
|
|
16178
|
+
}
|
|
15955
16179
|
function pureMemoKey(args) {
|
|
15956
16180
|
return callBudgetKey("pure", "", args);
|
|
15957
16181
|
}
|
|
16182
|
+
function routeApplyThrows(r, throws) {
|
|
16183
|
+
if (throws && throws.shape.k !== "never") {
|
|
16184
|
+
if (r.shape.k === "never") throw new NudoThrow(throws);
|
|
16185
|
+
pushThrowExit(throws);
|
|
16186
|
+
}
|
|
16187
|
+
return r;
|
|
16188
|
+
}
|
|
16189
|
+
function normalizeApplyReturn(raw) {
|
|
16190
|
+
return isAbsApplyResult(raw) ? raw : makeAbsApplyResult(raw, never);
|
|
16191
|
+
}
|
|
16192
|
+
function joinThrowsSince2(mark) {
|
|
16193
|
+
const items = peekThrowExitsSince(mark);
|
|
16194
|
+
if (items.length === 0) return never;
|
|
16195
|
+
if (items.length === 1) return items[0];
|
|
16196
|
+
return items.reduce((a, b) => joinAbs(a, b));
|
|
16197
|
+
}
|
|
15958
16198
|
function $call(fn, args, thisVal) {
|
|
15959
16199
|
if (fn?.shape?.k === "sum") {
|
|
15960
16200
|
const results = fn.shape.members.map((m) => $call(m, args, thisVal));
|
|
@@ -15966,7 +16206,7 @@ function $call(fn, args, thisVal) {
|
|
|
15966
16206
|
const pk = pureName && fnObj ? pureMemoKey(args) : void 0;
|
|
15967
16207
|
if (fnObj && pk !== void 0) {
|
|
15968
16208
|
const hit = pureMemo.get(fnObj)?.get(pk);
|
|
15969
|
-
if (hit !== void 0) return hit;
|
|
16209
|
+
if (hit !== void 0) return routeApplyThrows(hit.abs, hit.throws);
|
|
15970
16210
|
}
|
|
15971
16211
|
const impl = getFnImpl(fn);
|
|
15972
16212
|
if (!impl?.body && !impl?.apply) {
|
|
@@ -15979,16 +16219,16 @@ function $call(fn, args, thisVal) {
|
|
|
15979
16219
|
if (!enterCall(key, label)) return truncatedAbs();
|
|
15980
16220
|
try {
|
|
15981
16221
|
try {
|
|
15982
|
-
const
|
|
16222
|
+
const full = normalizeApplyReturn(impl.apply(args, thisVal));
|
|
15983
16223
|
if (fnObj && pk !== void 0) {
|
|
15984
16224
|
let m = pureMemo.get(fnObj);
|
|
15985
16225
|
if (!m) {
|
|
15986
|
-
m =
|
|
16226
|
+
m = new BoundedLruMap(PURE_MEMO_MAX);
|
|
15987
16227
|
pureMemo.set(fnObj, m);
|
|
15988
16228
|
}
|
|
15989
|
-
m.set(pk,
|
|
16229
|
+
m.set(pk, full);
|
|
15990
16230
|
}
|
|
15991
|
-
return
|
|
16231
|
+
return routeApplyThrows(full.abs, full.throws);
|
|
15992
16232
|
} catch (e) {
|
|
15993
16233
|
if (e && typeof e === "object" && e.name === "NudoReturn") {
|
|
15994
16234
|
return e.absValue;
|
|
@@ -16005,14 +16245,15 @@ function $call(fn, args, thisVal) {
|
|
|
16005
16245
|
const label = fn.shape.name ?? "anonymous";
|
|
16006
16246
|
if (!enterCall(key, label)) return truncatedAbs();
|
|
16007
16247
|
try {
|
|
16248
|
+
const throwMark = throwExitsMark();
|
|
16008
16249
|
const r = compiled(args);
|
|
16009
16250
|
if (fnObj && pk !== void 0) {
|
|
16010
16251
|
let m = pureMemo.get(fnObj);
|
|
16011
16252
|
if (!m) {
|
|
16012
|
-
m =
|
|
16253
|
+
m = new BoundedLruMap(PURE_MEMO_MAX);
|
|
16013
16254
|
pureMemo.set(fnObj, m);
|
|
16014
16255
|
}
|
|
16015
|
-
m.set(pk, r);
|
|
16256
|
+
m.set(pk, makeAbsApplyResult(r, joinThrowsSince2(throwMark)));
|
|
16016
16257
|
}
|
|
16017
16258
|
return r;
|
|
16018
16259
|
} finally {
|
|
@@ -16094,7 +16335,8 @@ function findStaticClassAccessor(startName, key) {
|
|
|
16094
16335
|
}
|
|
16095
16336
|
function $in2(key, o) {
|
|
16096
16337
|
if (o.shape.k === "sum") {
|
|
16097
|
-
|
|
16338
|
+
const parts = o.shape.members.map((m) => $in2(key, m));
|
|
16339
|
+
return parts.length ? parts.reduce((a, b) => joinAbs(a, b)) : unknown;
|
|
16098
16340
|
}
|
|
16099
16341
|
if (o.shape.k === "prim" || o.shape.k === "never" || isNullishLitAbs(o)) {
|
|
16100
16342
|
return unknown;
|
|
@@ -16222,8 +16464,8 @@ function $instanceof2(left, rightName, rightVal) {
|
|
|
16222
16464
|
return bool();
|
|
16223
16465
|
}
|
|
16224
16466
|
const r = $call(slot.value, [rv, left]);
|
|
16225
|
-
const
|
|
16226
|
-
if (
|
|
16467
|
+
const bvR = litValue(r);
|
|
16468
|
+
if (bvR.ok) return boolLit(Boolean(bvR.value));
|
|
16227
16469
|
return bool();
|
|
16228
16470
|
}
|
|
16229
16471
|
}
|
|
@@ -16272,7 +16514,8 @@ function $instanceof2(left, rightName, rightVal) {
|
|
|
16272
16514
|
let decided;
|
|
16273
16515
|
let undecided = false;
|
|
16274
16516
|
for (const p of parts) {
|
|
16275
|
-
const
|
|
16517
|
+
const pvR = litValue(p);
|
|
16518
|
+
const pv = pvR.ok ? pvR.value : void 0;
|
|
16276
16519
|
if (typeof pv !== "boolean") {
|
|
16277
16520
|
undecided = true;
|
|
16278
16521
|
continue;
|
|
@@ -16301,10 +16544,12 @@ function $delRes(o, _key) {
|
|
|
16301
16544
|
return unknown;
|
|
16302
16545
|
}
|
|
16303
16546
|
if (o.shape.k === "sum") {
|
|
16304
|
-
|
|
16547
|
+
const parts = o.shape.members.map((m) => $delRes(m, _key));
|
|
16548
|
+
return parts.length ? parts.reduce((a, b) => joinAbs(a, b)) : unknown;
|
|
16305
16549
|
}
|
|
16306
16550
|
const st = extStateOf(o);
|
|
16307
|
-
const
|
|
16551
|
+
const kvR = litValue(_key);
|
|
16552
|
+
const kv = kvR.ok ? kvR.value : void 0;
|
|
16308
16553
|
const flags = kv !== void 0 ? getPropFlags(o)?.get(String(kv)) : void 0;
|
|
16309
16554
|
if (st === "frozen" || st === "sealed") throwStrictWrite();
|
|
16310
16555
|
if (flags?.configurable === false) throwStrictWrite();
|
|
@@ -16436,6 +16681,9 @@ export {
|
|
|
16436
16681
|
resetParseSourceCache,
|
|
16437
16682
|
getParseSourceCacheSize,
|
|
16438
16683
|
parseSource,
|
|
16684
|
+
makeAbsApplyResult,
|
|
16685
|
+
isAbsApplyResult,
|
|
16686
|
+
absOnly,
|
|
16439
16687
|
attachFnImpl,
|
|
16440
16688
|
getFnImpl,
|
|
16441
16689
|
markPureFn,
|
|
@@ -16884,8 +17132,12 @@ export {
|
|
|
16884
17132
|
tryRunTranspiled,
|
|
16885
17133
|
callTranspiledExportFull,
|
|
16886
17134
|
callTranspiledExport,
|
|
17135
|
+
callTranspiledExportApply,
|
|
16887
17136
|
freeIdentifiers,
|
|
17137
|
+
clearPureMemo,
|
|
17138
|
+
routeApplyThrows,
|
|
16888
17139
|
$call,
|
|
17140
|
+
clearPureCallMemo,
|
|
16889
17141
|
setEvalAssignCollector,
|
|
16890
17142
|
$assignRecord,
|
|
16891
17143
|
setEvalBindingSink,
|