@nudojs/core 1.1.2 → 1.1.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/{chunk-UC3LBZYR.js → chunk-SQSO4NKT.js} +325 -158
- package/dist/{chunk-EFFPFUSD.js → chunk-XOHKHJHE.js} +1 -1
- package/dist/exec.d.ts +1 -1
- package/dist/exec.js +1 -1
- package/dist/{index-B7Lb8FU6.d.ts → index-D4rnOHre.d.ts} +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.js +2 -2
- package/dist/internal.js +2 -2
- package/package.json +1 -1
|
@@ -16,7 +16,12 @@ var app = (fn, args) => ({ op: "app", fn, args });
|
|
|
16
16
|
function termEquals(a, b) {
|
|
17
17
|
if (a === b) return true;
|
|
18
18
|
if (a.op !== b.op) return false;
|
|
19
|
-
if (a.op === "lit" && b.op === "lit")
|
|
19
|
+
if (a.op === "lit" && b.op === "lit") {
|
|
20
|
+
if (typeof a.value === "number" && typeof b.value === "number" && Number.isNaN(a.value) && Number.isNaN(b.value)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return a.value === b.value;
|
|
24
|
+
}
|
|
20
25
|
if (a.op === "var" && b.op === "var") return a.id === b.id;
|
|
21
26
|
if (a.op === "app" && b.op === "app") {
|
|
22
27
|
return a.fn === b.fn && a.args.length === b.args.length && a.args.every((x, i) => termEquals(x, b.args[i]));
|
|
@@ -55,18 +60,10 @@ function simplifyTerm(t) {
|
|
|
55
60
|
const folded = foldLiterals(fn, xs);
|
|
56
61
|
if (folded !== void 0) return lit(folded);
|
|
57
62
|
}
|
|
58
|
-
if (fn === "+" && args.length === 2) {
|
|
59
|
-
const [a, b] = args;
|
|
60
|
-
if (a.op === "lit" && a.value === 0) return b;
|
|
61
|
-
if (b.op === "lit" && b.value === 0) return a;
|
|
62
|
-
}
|
|
63
63
|
if (fn === "*" && args.length === 2) {
|
|
64
64
|
const [a, b] = args;
|
|
65
65
|
if (a.op === "lit" && a.value === 1) return b;
|
|
66
66
|
if (b.op === "lit" && b.value === 1) return a;
|
|
67
|
-
if (a.op === "lit" && a.value === 0 || b.op === "lit" && b.value === 0) {
|
|
68
|
-
return lit(0);
|
|
69
|
-
}
|
|
70
67
|
}
|
|
71
68
|
if (fn === "-" && args.length === 2) {
|
|
72
69
|
const [a, b] = args;
|
|
@@ -2796,7 +2793,7 @@ function coercibleLit(v2) {
|
|
|
2796
2793
|
return v2 !== void 0 && (typeof v2 === "number" || typeof v2 === "string" || typeof v2 === "boolean" || v2 === null);
|
|
2797
2794
|
}
|
|
2798
2795
|
function toNumberResult(a, b, op) {
|
|
2799
|
-
const term = a.term && b.term ?
|
|
2796
|
+
const term = a.term && b.term ? app(op, [a.term, b.term]) : void 0;
|
|
2800
2797
|
return abs(
|
|
2801
2798
|
{ k: "prim", type: "number" },
|
|
2802
2799
|
term,
|
|
@@ -2963,9 +2960,6 @@ function mul(a, b, phi2 = pTrue) {
|
|
|
2963
2960
|
}
|
|
2964
2961
|
if (isNumericLike(a) && isNumericLike(b) && a.term && b.term) {
|
|
2965
2962
|
const term = simplifyTerm(app("*", [a.term, b.term]));
|
|
2966
|
-
if (b.term.op === "lit" && b.term.value === 0 || a.term.op === "lit" && a.term.value === 0) {
|
|
2967
|
-
return numLit(0);
|
|
2968
|
-
}
|
|
2969
2963
|
let k;
|
|
2970
2964
|
let base;
|
|
2971
2965
|
if (b.term.op === "lit" && typeof b.term.value === "number") {
|
|
@@ -3077,9 +3071,6 @@ function mod(a, b, phi2 = pTrue) {
|
|
|
3077
3071
|
return abs({ k: "prim", type: "bigint" }, void 0, void 0, confJoin(a.conf, b.conf));
|
|
3078
3072
|
}
|
|
3079
3073
|
if (typeof va === "number" && typeof vb === "number") {
|
|
3080
|
-
if (vb === 0) {
|
|
3081
|
-
return abs(num().shape, void 0, void 0, "path");
|
|
3082
|
-
}
|
|
3083
3074
|
return numLit(va % vb);
|
|
3084
3075
|
}
|
|
3085
3076
|
if (coercibleLit(va) && coercibleLit(vb)) {
|
|
@@ -3087,14 +3078,24 @@ function mod(a, b, phi2 = pTrue) {
|
|
|
3087
3078
|
}
|
|
3088
3079
|
if (isNumericLike(a) && isNumericLike(b) && a.term && b.term) {
|
|
3089
3080
|
const term = simplifyTerm(app("%", [a.term, b.term]));
|
|
3090
|
-
if (b.term.op === "lit"
|
|
3081
|
+
if (b.term.op === "lit") {
|
|
3082
|
+
const bv = b.term.value;
|
|
3083
|
+
if (typeof bv === "number" && (bv === 0 || Number.isNaN(bv))) {
|
|
3084
|
+
return numLit(NaN);
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3087
|
+
if (b.term.op === "lit" && typeof b.term.value === "number" && Number.isFinite(b.term.value) && b.term.value !== 0) {
|
|
3091
3088
|
const k = Math.abs(b.term.value);
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3089
|
+
const ab = numericBounds(a, phi2);
|
|
3090
|
+
const finiteDividend = ab?.lo !== void 0 && ab?.hi !== void 0 && Number.isFinite(ab.lo.value) && Number.isFinite(ab.hi.value);
|
|
3091
|
+
if (finiteDividend) {
|
|
3092
|
+
return abs(
|
|
3093
|
+
num().shape,
|
|
3094
|
+
term,
|
|
3095
|
+
and(gt(term, lit(-k)), lt(term, lit(k))),
|
|
3096
|
+
confJoin(confJoin(a.conf, b.conf), "path")
|
|
3097
|
+
);
|
|
3098
|
+
}
|
|
3098
3099
|
}
|
|
3099
3100
|
return abs(num().shape, term, void 0, confJoin(confJoin(a.conf, b.conf), "path"));
|
|
3100
3101
|
}
|
|
@@ -3107,11 +3108,18 @@ function mod(a, b, phi2 = pTrue) {
|
|
|
3107
3108
|
return abs({ k: "unknown" }, void 0, void 0, "partial");
|
|
3108
3109
|
}
|
|
3109
3110
|
function cmp(op, a, b, phi2 = pTrue) {
|
|
3110
|
-
const
|
|
3111
|
-
const
|
|
3112
|
-
if (
|
|
3113
|
-
const result = compareLits(op,
|
|
3111
|
+
const ta = a.term;
|
|
3112
|
+
const tb = b.term;
|
|
3113
|
+
if (ta?.op === "lit" && tb?.op === "lit") {
|
|
3114
|
+
const result = compareLits(op, ta.value, tb.value);
|
|
3114
3115
|
if (result !== void 0) return boolLit(result);
|
|
3116
|
+
} else {
|
|
3117
|
+
const va = litValue(a);
|
|
3118
|
+
const vb = litValue(b);
|
|
3119
|
+
if (va !== void 0 && vb !== void 0) {
|
|
3120
|
+
const result = compareLits(op, va, vb);
|
|
3121
|
+
if (result !== void 0) return boolLit(result);
|
|
3122
|
+
}
|
|
3115
3123
|
}
|
|
3116
3124
|
if (a.term && b.term) {
|
|
3117
3125
|
const pred = op === "lt" ? lt(a.term, b.term) : op === "le" ? le(a.term, b.term) : op === "gt" ? gt(a.term, b.term) : op === "ge" ? ge(a.term, b.term) : op === "eq" ? { op: "eq", a: a.term, b: b.term } : { op: "ne", a: a.term, b: b.term };
|
|
@@ -3298,54 +3306,36 @@ function isPrimLike(a) {
|
|
|
3298
3306
|
}
|
|
3299
3307
|
|
|
3300
3308
|
// src/algebra/builtins/math.ts
|
|
3309
|
+
function coerceMathArg(a) {
|
|
3310
|
+
if (!a || a.term?.op !== "lit") return void 0;
|
|
3311
|
+
const v2 = a.term.value;
|
|
3312
|
+
if (typeof v2 === "number") return v2;
|
|
3313
|
+
if (typeof v2 === "string") return Number(v2);
|
|
3314
|
+
if (typeof v2 === "boolean") return v2 ? 1 : 0;
|
|
3315
|
+
if (v2 === null) return 0;
|
|
3316
|
+
if (v2 === void 0) return void 0;
|
|
3317
|
+
return "throw";
|
|
3318
|
+
}
|
|
3319
|
+
function mathMethod(name) {
|
|
3320
|
+
if (!Object.hasOwn(Math, name)) return void 0;
|
|
3321
|
+
const impl = Math[name];
|
|
3322
|
+
return typeof impl === "function" ? impl : void 0;
|
|
3323
|
+
}
|
|
3301
3324
|
function evalMathMethod(name, args) {
|
|
3302
|
-
|
|
3303
|
-
const
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
return numPrim();
|
|
3317
|
-
case "random":
|
|
3318
|
-
return numPrim("path");
|
|
3319
|
-
case "sqrt":
|
|
3320
|
-
if (typeof a0 === "number") return numLit(Math.sqrt(a0));
|
|
3321
|
-
return numPrim();
|
|
3322
|
-
case "min": {
|
|
3323
|
-
const lits = args.map(litValue);
|
|
3324
|
-
if (lits.length > 0 && lits.every((x) => typeof x === "number")) {
|
|
3325
|
-
return numLit(Math.min(...lits));
|
|
3326
|
-
}
|
|
3327
|
-
return numPrim();
|
|
3328
|
-
}
|
|
3329
|
-
case "max": {
|
|
3330
|
-
const lits = args.map(litValue);
|
|
3331
|
-
if (lits.length > 0 && lits.every((x) => typeof x === "number")) {
|
|
3332
|
-
return numLit(Math.max(...lits));
|
|
3333
|
-
}
|
|
3334
|
-
return numPrim();
|
|
3335
|
-
}
|
|
3336
|
-
case "pow":
|
|
3337
|
-
if (typeof a0 === "number" && typeof a1 === "number") return numLit(Math.pow(a0, a1));
|
|
3338
|
-
return numPrim();
|
|
3339
|
-
case "sign":
|
|
3340
|
-
if (typeof a0 === "number") return numLit(Math.sign(a0));
|
|
3341
|
-
return numPrim();
|
|
3342
|
-
case "atan2":
|
|
3343
|
-
if (typeof a0 === "number" && typeof a1 === "number") {
|
|
3344
|
-
return numLit(Math.atan2(a0, a1));
|
|
3345
|
-
}
|
|
3346
|
-
return numPrim();
|
|
3347
|
-
default:
|
|
3348
|
-
return void 0;
|
|
3325
|
+
if (name === "random") return numPrim("path");
|
|
3326
|
+
const impl = mathMethod(name);
|
|
3327
|
+
if (!impl) return void 0;
|
|
3328
|
+
const nums = [];
|
|
3329
|
+
for (const a of args) {
|
|
3330
|
+
const n = coerceMathArg(a);
|
|
3331
|
+
if (n === void 0) return numPrim();
|
|
3332
|
+
if (n === "throw") throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
3333
|
+
nums.push(n);
|
|
3334
|
+
}
|
|
3335
|
+
try {
|
|
3336
|
+
return numLit(impl(...nums));
|
|
3337
|
+
} catch {
|
|
3338
|
+
return numPrim();
|
|
3349
3339
|
}
|
|
3350
3340
|
}
|
|
3351
3341
|
|
|
@@ -3964,6 +3954,11 @@ function jsonValueToAbs(v2) {
|
|
|
3964
3954
|
}
|
|
3965
3955
|
return abs({ k: "obj", slots }, void 0, void 0, "exact");
|
|
3966
3956
|
}
|
|
3957
|
+
function isNonJsonTopLevel(a) {
|
|
3958
|
+
if (a.shape.k === "fn") return true;
|
|
3959
|
+
if (a.shape.k === "prim" && a.shape.type === "symbol") return true;
|
|
3960
|
+
return false;
|
|
3961
|
+
}
|
|
3967
3962
|
function evalJsonMethod(name, args) {
|
|
3968
3963
|
if (name === "parse") {
|
|
3969
3964
|
const a0Abs = args[0];
|
|
@@ -3986,7 +3981,10 @@ function evalJsonMethod(name, args) {
|
|
|
3986
3981
|
const a0Abs = args[0];
|
|
3987
3982
|
if (!a0Abs) return undefAbs();
|
|
3988
3983
|
const v2 = absToJsonNative(a0Abs, /* @__PURE__ */ new Set());
|
|
3989
|
-
if (v2 === NOT_LITERAL)
|
|
3984
|
+
if (v2 === NOT_LITERAL) {
|
|
3985
|
+
if (isNonJsonTopLevel(a0Abs)) return undefAbs();
|
|
3986
|
+
return str2("partial");
|
|
3987
|
+
}
|
|
3990
3988
|
const replacerArg = args[1];
|
|
3991
3989
|
let replacer;
|
|
3992
3990
|
if (replacerArg) {
|
|
@@ -4028,34 +4026,60 @@ function evalJsonMethod(name, args) {
|
|
|
4028
4026
|
function foldParseInt(s, radix) {
|
|
4029
4027
|
const str6 = String(s);
|
|
4030
4028
|
if (radix === void 0) return numLit(parseInt(str6));
|
|
4031
|
-
const r = radix | 0;
|
|
4029
|
+
const r = Number(radix) | 0;
|
|
4032
4030
|
if (r === 0) return numLit(parseInt(str6));
|
|
4033
4031
|
if (r < 2 || r > 36) return numLit(NaN);
|
|
4034
4032
|
return numLit(parseInt(str6, r));
|
|
4035
4033
|
}
|
|
4034
|
+
function foldParseFloat(s) {
|
|
4035
|
+
return numLit(parseFloat(String(s)));
|
|
4036
|
+
}
|
|
4037
|
+
function toStringLitArg(a) {
|
|
4038
|
+
if (!a) return { lit: true, v: void 0 };
|
|
4039
|
+
if (a.term?.op !== "lit") return { lit: false };
|
|
4040
|
+
const v2 = a.term.value;
|
|
4041
|
+
if (typeof v2 === "symbol") throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
4042
|
+
return { lit: true, v: v2 };
|
|
4043
|
+
}
|
|
4044
|
+
function radixLitArg(a) {
|
|
4045
|
+
if (!a) return { ok: true, v: void 0 };
|
|
4046
|
+
if (a.term?.op !== "lit") return { ok: false };
|
|
4047
|
+
const v2 = a.term.value;
|
|
4048
|
+
if (typeof v2 === "symbol") throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
4049
|
+
if (v2 === void 0) return { ok: true, v: void 0 };
|
|
4050
|
+
if (typeof v2 === "number" || typeof v2 === "string" || typeof v2 === "boolean" || v2 === null) {
|
|
4051
|
+
return { ok: true, v: v2 };
|
|
4052
|
+
}
|
|
4053
|
+
return { ok: false };
|
|
4054
|
+
}
|
|
4036
4055
|
function evalNumberStatic(name, args) {
|
|
4037
|
-
const
|
|
4056
|
+
const a0Arg = args[0];
|
|
4057
|
+
const a0 = a0Arg ? litValue(a0Arg) : void 0;
|
|
4058
|
+
const foldStrictNumberPred = (pred) => {
|
|
4059
|
+
if (!a0Arg) return boolLit(false);
|
|
4060
|
+
if (a0Arg.term?.op !== "lit") return void 0;
|
|
4061
|
+
const v2 = a0Arg.term.value;
|
|
4062
|
+
return boolLit(typeof v2 === "number" && pred(v2));
|
|
4063
|
+
};
|
|
4038
4064
|
switch (name) {
|
|
4039
4065
|
case "isInteger":
|
|
4040
|
-
|
|
4041
|
-
return boolPrim();
|
|
4066
|
+
return foldStrictNumberPred(Number.isInteger) ?? boolPrim();
|
|
4042
4067
|
case "isNaN":
|
|
4043
|
-
|
|
4044
|
-
return boolPrim();
|
|
4068
|
+
return foldStrictNumberPred(Number.isNaN) ?? boolPrim();
|
|
4045
4069
|
case "isFinite":
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
if (
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4070
|
+
return foldStrictNumberPred(Number.isFinite) ?? boolPrim();
|
|
4071
|
+
case "parseInt": {
|
|
4072
|
+
const s = toStringLitArg(a0Arg);
|
|
4073
|
+
if (!s.lit) return numPrim();
|
|
4074
|
+
const radix = radixLitArg(args[1]);
|
|
4075
|
+
if (!radix.ok) return numPrim();
|
|
4076
|
+
return foldParseInt(s.v, radix.v);
|
|
4077
|
+
}
|
|
4078
|
+
case "parseFloat": {
|
|
4079
|
+
const s = toStringLitArg(a0Arg);
|
|
4080
|
+
if (!s.lit) return numPrim();
|
|
4081
|
+
return foldParseFloat(s.v);
|
|
4082
|
+
}
|
|
4059
4083
|
case "MAX_SAFE_INTEGER":
|
|
4060
4084
|
return numLit(Number.MAX_SAFE_INTEGER);
|
|
4061
4085
|
default:
|
|
@@ -4893,29 +4917,59 @@ function arrayMethodAbs(name) {
|
|
|
4893
4917
|
}
|
|
4894
4918
|
|
|
4895
4919
|
// src/algebra/builtins/global.ts
|
|
4920
|
+
function litTermOf(a) {
|
|
4921
|
+
return a?.term?.op === "lit" ? a.term : void 0;
|
|
4922
|
+
}
|
|
4896
4923
|
function evalGlobalFn(name, args) {
|
|
4897
4924
|
const a0 = args[0] ? litValue(args[0]) : void 0;
|
|
4925
|
+
const a0Lit = litTermOf(args[0]);
|
|
4898
4926
|
switch (name) {
|
|
4899
4927
|
case "eval":
|
|
4900
4928
|
return unknown;
|
|
4901
4929
|
case "Array":
|
|
4902
4930
|
return makeArrayCtorAbs(args);
|
|
4903
|
-
case "parseInt":
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4931
|
+
case "parseInt": {
|
|
4932
|
+
const sVal = a0Lit ? a0Lit.value : void 0;
|
|
4933
|
+
if (a0Lit && typeof sVal === "symbol") throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
4934
|
+
if (!a0Lit && args[0] && args[0].term?.op !== "lit") return numPrim();
|
|
4935
|
+
const rAbs = args[1];
|
|
4936
|
+
let radix;
|
|
4937
|
+
if (!rAbs) {
|
|
4938
|
+
radix = void 0;
|
|
4939
|
+
} else if (rAbs.term?.op !== "lit") {
|
|
4908
4940
|
return numPrim();
|
|
4941
|
+
} else if (typeof rAbs.term.value === "symbol") {
|
|
4942
|
+
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
4943
|
+
} else {
|
|
4944
|
+
const rv = rAbs.term.value;
|
|
4945
|
+
radix = rv === void 0 ? void 0 : rv;
|
|
4946
|
+
if (rv !== void 0 && typeof rv !== "number" && typeof rv !== "string" && typeof rv !== "boolean" && rv !== null) {
|
|
4947
|
+
return numPrim();
|
|
4948
|
+
}
|
|
4949
|
+
}
|
|
4950
|
+
return foldParseInt(sVal, radix);
|
|
4951
|
+
}
|
|
4952
|
+
case "parseFloat": {
|
|
4953
|
+
if (!a0Lit && args[0] && args[0].term?.op !== "lit") return numPrim();
|
|
4954
|
+
if (a0Lit && typeof a0Lit.value === "symbol") throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
4955
|
+
return foldParseFloat(a0Lit ? a0Lit.value : void 0);
|
|
4956
|
+
}
|
|
4957
|
+
case "isNaN": {
|
|
4958
|
+
if (args[0] && isSymbolAbs2(args[0])) throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
4959
|
+
if (!args[0] || args[0].term?.op === "lit" && args[0].term.value === void 0) {
|
|
4960
|
+
return boolLit(true);
|
|
4909
4961
|
}
|
|
4910
|
-
return numPrim();
|
|
4911
|
-
case "parseFloat":
|
|
4912
|
-
if (typeof a0 === "string" || typeof a0 === "number") return numLit(parseFloat(String(a0)));
|
|
4913
|
-
return numPrim();
|
|
4914
|
-
case "isNaN":
|
|
4915
4962
|
if (typeof a0 === "number") return boolLit(Number.isNaN(a0));
|
|
4963
|
+
if (typeof a0 === "boolean" || a0 === null) return boolLit(false);
|
|
4964
|
+
if (typeof a0 === "string") return boolLit(Number.isNaN(Number(a0)));
|
|
4965
|
+
if (typeof a0 === "bigint") throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
4916
4966
|
return boolPrim();
|
|
4967
|
+
}
|
|
4917
4968
|
case "isFinite": {
|
|
4918
|
-
if (
|
|
4969
|
+
if (args[0] && isSymbolAbs2(args[0])) throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
4970
|
+
if (!args[0] || args[0].term?.op === "lit" && args[0].term.value === void 0) {
|
|
4971
|
+
return boolLit(false);
|
|
4972
|
+
}
|
|
4919
4973
|
if (typeof a0 === "number") return boolLit(Number.isFinite(a0));
|
|
4920
4974
|
if (typeof a0 === "boolean") return boolLit(true);
|
|
4921
4975
|
if (typeof a0 === "string") return boolLit(Number.isFinite(Number(a0)));
|
|
@@ -4924,18 +4978,24 @@ function evalGlobalFn(name, args) {
|
|
|
4924
4978
|
}
|
|
4925
4979
|
case "Number":
|
|
4926
4980
|
if (args[0] && isSymbolAbs2(args[0])) throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
4981
|
+
if (!args[0]) return numLit(0);
|
|
4982
|
+
if (a0Lit && a0Lit.value === void 0) return numLit(NaN);
|
|
4927
4983
|
if (typeof a0 === "number") return numLit(a0);
|
|
4928
4984
|
if (typeof a0 === "string") return numLit(Number(a0));
|
|
4929
4985
|
if (typeof a0 === "boolean") return numLit(a0 ? 1 : 0);
|
|
4986
|
+
if (a0 === null) return numLit(0);
|
|
4987
|
+
if (typeof a0 === "bigint") return numLit(Number(a0));
|
|
4930
4988
|
return numPrim();
|
|
4931
4989
|
case "String":
|
|
4932
4990
|
if (args[0] && isSymbolAbs2(args[0])) return stringOfSymbol(args[0]);
|
|
4933
|
-
if (
|
|
4991
|
+
if (!args[0]) return strLit("");
|
|
4992
|
+
if (a0Lit) return strLit(String(a0Lit.value));
|
|
4934
4993
|
return str2();
|
|
4935
4994
|
case "Symbol":
|
|
4936
4995
|
return makeSymbolAbs(args[0]);
|
|
4937
4996
|
case "Boolean":
|
|
4938
|
-
if (
|
|
4997
|
+
if (!args[0]) return boolLit(false);
|
|
4998
|
+
if (a0Lit) return boolLit(Boolean(a0Lit.value));
|
|
4939
4999
|
return boolPrim();
|
|
4940
5000
|
case "Object": {
|
|
4941
5001
|
const arg = args[0];
|
|
@@ -5816,6 +5876,12 @@ function negAbs(a, _phi = pTrue) {
|
|
|
5816
5876
|
const v2 = litValue(a);
|
|
5817
5877
|
if (typeof v2 === "number") return numLitAbs(-v2);
|
|
5818
5878
|
if (typeof v2 === "bigint") return bigintLit(-v2);
|
|
5879
|
+
if (a.term?.op === "lit") {
|
|
5880
|
+
const tv = a.term.value;
|
|
5881
|
+
if (typeof tv === "string" || typeof tv === "boolean" || tv === null) {
|
|
5882
|
+
return numLitAbs(-Number(tv));
|
|
5883
|
+
}
|
|
5884
|
+
}
|
|
5819
5885
|
if (a.shape.k === "prim" && a.shape.type === "number") {
|
|
5820
5886
|
if (!a.term) {
|
|
5821
5887
|
return abs(num().shape, void 0, void 0, confJoin(a.conf, "widened"));
|
|
@@ -5882,7 +5948,7 @@ function isDefinitelyTruthyShape(s) {
|
|
|
5882
5948
|
case "eff":
|
|
5883
5949
|
return true;
|
|
5884
5950
|
case "prim":
|
|
5885
|
-
return s.type === "symbol"
|
|
5951
|
+
return s.type === "symbol";
|
|
5886
5952
|
default:
|
|
5887
5953
|
return false;
|
|
5888
5954
|
}
|
|
@@ -5949,7 +6015,12 @@ function strictEqAbs(a, b) {
|
|
|
5949
6015
|
if (bNullish && definitelyNotNullishShape(a.shape)) return false;
|
|
5950
6016
|
if (aNullish && definitelyNotNullishShape(b.shape)) return false;
|
|
5951
6017
|
if (a.term && b.term && a.term.op === "var" && b.term.op === "var" && a.term.id === b.term.id) {
|
|
5952
|
-
|
|
6018
|
+
const k = a.shape.k;
|
|
6019
|
+
if (k === "obj" || k === "arr" || k === "tuple" || k === "fn" || k === "brand" || k === "eff") {
|
|
6020
|
+
return true;
|
|
6021
|
+
}
|
|
6022
|
+
if (k === "prim" && a.shape.type !== "number") return true;
|
|
6023
|
+
return void 0;
|
|
5953
6024
|
}
|
|
5954
6025
|
return void 0;
|
|
5955
6026
|
}
|
|
@@ -6013,9 +6084,26 @@ function callbackEnv() {
|
|
|
6013
6084
|
function isStrRecv(recv) {
|
|
6014
6085
|
return isTemplateLike(recv) || recv.shape.k === "prim" && recv.shape.type === "string" || recv.term?.op === "lit" && typeof recv.term.value === "string";
|
|
6015
6086
|
}
|
|
6087
|
+
function isFoldableIndexArg(x) {
|
|
6088
|
+
if (x === void 0) return true;
|
|
6089
|
+
if (x.term?.op !== "lit") return false;
|
|
6090
|
+
const v2 = x.term.value;
|
|
6091
|
+
return v2 === void 0 || typeof v2 === "number" || typeof v2 === "string" || typeof v2 === "boolean" || v2 === null;
|
|
6092
|
+
}
|
|
6093
|
+
function toStringArg(x) {
|
|
6094
|
+
if (x === void 0) return "undefined";
|
|
6095
|
+
if (x.term?.op !== "lit") return void 0;
|
|
6096
|
+
const v2 = x.term.value;
|
|
6097
|
+
if (typeof v2 === "symbol") return void 0;
|
|
6098
|
+
return String(v2);
|
|
6099
|
+
}
|
|
6100
|
+
function isUndefinedArg(x) {
|
|
6101
|
+
return x === void 0 || x.term?.op === "lit" && x.term.value === void 0;
|
|
6102
|
+
}
|
|
6016
6103
|
function callAbsMethod(recv, name, args) {
|
|
6017
6104
|
if (!isStrRecv(recv)) return void 0;
|
|
6018
6105
|
const a0 = args[0] ? litValue(args[0]) : void 0;
|
|
6106
|
+
const a0Str = toStringArg(args[0]);
|
|
6019
6107
|
const lit3 = recv.term?.op === "lit" && typeof recv.term.value === "string" ? recv.term.value : void 0;
|
|
6020
6108
|
if (isTemplateLike(recv)) {
|
|
6021
6109
|
const views = absTemplateViews(templatePartsOf(recv));
|
|
@@ -6024,20 +6112,20 @@ function callAbsMethod(recv, name, args) {
|
|
|
6024
6112
|
switch (name) {
|
|
6025
6113
|
case "startsWith": {
|
|
6026
6114
|
if (args[1] && litValue(args[1]) !== void 0) return boolPrim5();
|
|
6027
|
-
if (
|
|
6028
|
-
const d = decideStartsWith(prefix,
|
|
6115
|
+
if (a0Str === void 0) return boolPrim5();
|
|
6116
|
+
const d = decideStartsWith(prefix, a0Str);
|
|
6029
6117
|
return d === "unknown" ? boolPrim5() : boolLit(d);
|
|
6030
6118
|
}
|
|
6031
6119
|
case "endsWith": {
|
|
6032
6120
|
if (args[1] && litValue(args[1]) !== void 0) return boolPrim5();
|
|
6033
|
-
if (
|
|
6034
|
-
const d = decideEndsWith(suffix,
|
|
6121
|
+
if (a0Str === void 0) return boolPrim5();
|
|
6122
|
+
const d = decideEndsWith(suffix, a0Str);
|
|
6035
6123
|
return d === "unknown" ? boolPrim5() : boolLit(d);
|
|
6036
6124
|
}
|
|
6037
6125
|
case "includes": {
|
|
6038
6126
|
if (args[1] && litValue(args[1]) !== void 0) return boolPrim5();
|
|
6039
|
-
if (
|
|
6040
|
-
const d = decideIncludes(allFixedTextOfViews(views),
|
|
6127
|
+
if (a0Str === void 0) return boolPrim5();
|
|
6128
|
+
const d = decideIncludes(allFixedTextOfViews(views), a0Str);
|
|
6041
6129
|
return d === "unknown" ? boolPrim5() : boolLit(d);
|
|
6042
6130
|
}
|
|
6043
6131
|
case "toUpperCase":
|
|
@@ -6063,10 +6151,10 @@ function callAbsMethod(recv, name, args) {
|
|
|
6063
6151
|
const a1 = a1Abs ? litValue(a1Abs) : void 0;
|
|
6064
6152
|
const a1Unknown = a1Abs !== void 0 && a1Abs.term?.op !== "lit";
|
|
6065
6153
|
if (a1Unknown) return boolPrim5();
|
|
6066
|
-
if (lit3 !== void 0 &&
|
|
6067
|
-
if (name === "startsWith") return boolLit(lit3.startsWith(
|
|
6068
|
-
if (name === "endsWith") return boolLit(lit3.endsWith(
|
|
6069
|
-
return boolLit(lit3.includes(
|
|
6154
|
+
if (lit3 !== void 0 && a0Str !== void 0) {
|
|
6155
|
+
if (name === "startsWith") return boolLit(lit3.startsWith(a0Str, a1));
|
|
6156
|
+
if (name === "endsWith") return boolLit(lit3.endsWith(a0Str, a1));
|
|
6157
|
+
return boolLit(lit3.includes(a0Str, a1));
|
|
6070
6158
|
}
|
|
6071
6159
|
return boolPrim5();
|
|
6072
6160
|
}
|
|
@@ -6079,8 +6167,7 @@ function callAbsMethod(recv, name, args) {
|
|
|
6079
6167
|
case "slice":
|
|
6080
6168
|
case "substring":
|
|
6081
6169
|
if (lit3 !== void 0) {
|
|
6082
|
-
|
|
6083
|
-
if (!numOrMissing(args[0]) || !numOrMissing(args[1])) return strPrim("path");
|
|
6170
|
+
if (!isFoldableIndexArg(args[0]) || !isFoldableIndexArg(args[1])) return strPrim("path");
|
|
6084
6171
|
const a1 = args[1] ? litValue(args[1]) : void 0;
|
|
6085
6172
|
if (name === "slice") {
|
|
6086
6173
|
return strLit(lit3.slice(a0, a1));
|
|
@@ -6088,8 +6175,11 @@ function callAbsMethod(recv, name, args) {
|
|
|
6088
6175
|
return strLit(lit3.substring(Number(a0 ?? 0), Number(a1 ?? lit3.length)));
|
|
6089
6176
|
}
|
|
6090
6177
|
return strPrim("path");
|
|
6091
|
-
case "charAt":
|
|
6092
|
-
|
|
6178
|
+
case "charAt": {
|
|
6179
|
+
if (lit3 === void 0) return strPrim("path");
|
|
6180
|
+
if (!isFoldableIndexArg(args[0])) return strPrim("path");
|
|
6181
|
+
return strLit(lit3.charAt(Number(a0 ?? 0)));
|
|
6182
|
+
}
|
|
6093
6183
|
case "toString":
|
|
6094
6184
|
case "valueOf":
|
|
6095
6185
|
return lit3 !== void 0 ? strLit(lit3) : strPrim("path");
|
|
@@ -6105,17 +6195,36 @@ function callAbsMethod(recv, name, args) {
|
|
|
6105
6195
|
return strPrim("path");
|
|
6106
6196
|
}
|
|
6107
6197
|
case "indexOf":
|
|
6108
|
-
case "lastIndexOf":
|
|
6109
|
-
|
|
6110
|
-
|
|
6198
|
+
case "lastIndexOf": {
|
|
6199
|
+
if (lit3 === void 0) return numPrim5("path");
|
|
6200
|
+
const search = toStringArg(args[0]);
|
|
6201
|
+
if (search === void 0) return numPrim5("path");
|
|
6202
|
+
if (!isFoldableIndexArg(args[1])) return numPrim5("path");
|
|
6203
|
+
const from = args[1] ? litValue(args[1]) : void 0;
|
|
6204
|
+
return numLit(
|
|
6205
|
+
name === "indexOf" ? lit3.indexOf(search, from) : lit3.lastIndexOf(search, from)
|
|
6206
|
+
);
|
|
6207
|
+
}
|
|
6208
|
+
case "charCodeAt": {
|
|
6209
|
+
if (lit3 === void 0) return numPrim5("path");
|
|
6210
|
+
if (!isFoldableIndexArg(args[0])) return numPrim5("path");
|
|
6211
|
+
return numLit(lit3.charCodeAt(Number(a0 ?? 0)));
|
|
6212
|
+
}
|
|
6111
6213
|
case "split": {
|
|
6112
6214
|
if (lit3 !== void 0) {
|
|
6113
|
-
const
|
|
6114
|
-
const
|
|
6115
|
-
|
|
6116
|
-
if (
|
|
6215
|
+
const limAbs = args[1];
|
|
6216
|
+
const lim = limAbs ? litValue(limAbs) : void 0;
|
|
6217
|
+
if (limAbs !== void 0 && limAbs.term?.op !== "lit") return strArr("path");
|
|
6218
|
+
if (isUndefinedArg(args[0])) {
|
|
6219
|
+
const one = abs({ k: "tuple", elements: [strLit(lit3)] }, void 0, void 0, "exact");
|
|
6220
|
+
if (lim === void 0) return one;
|
|
6221
|
+
const n = Number(lim);
|
|
6222
|
+
if (!(n > 0)) return abs({ k: "tuple", elements: [] }, void 0, void 0, "exact");
|
|
6223
|
+
return one;
|
|
6224
|
+
}
|
|
6225
|
+
const sep = toStringArg(args[0]);
|
|
6117
6226
|
if (sep !== void 0) {
|
|
6118
|
-
const parts = lit3.split(sep,
|
|
6227
|
+
const parts = lit3.split(sep, lim).map((s) => strLit(s));
|
|
6119
6228
|
return abs({ k: "tuple", elements: parts }, void 0, void 0, "exact");
|
|
6120
6229
|
}
|
|
6121
6230
|
return strArr("path");
|
|
@@ -6127,12 +6236,16 @@ function callAbsMethod(recv, name, args) {
|
|
|
6127
6236
|
if (lit3 !== void 0) {
|
|
6128
6237
|
const patAbs = args[0];
|
|
6129
6238
|
const repAbs = args[1];
|
|
6130
|
-
|
|
6239
|
+
{
|
|
6131
6240
|
let patSrc;
|
|
6132
6241
|
let patRe;
|
|
6133
|
-
const pv = patAbs
|
|
6134
|
-
if (
|
|
6242
|
+
const pv = patAbs?.term?.op === "lit" ? patAbs.term.value : void 0;
|
|
6243
|
+
if (patAbs === void 0) {
|
|
6244
|
+
patSrc = "undefined";
|
|
6245
|
+
} else if (typeof pv === "string") {
|
|
6135
6246
|
patSrc = pv;
|
|
6247
|
+
} else if (patAbs.term?.op === "lit" && typeof pv !== "symbol") {
|
|
6248
|
+
patSrc = String(pv);
|
|
6136
6249
|
} else if (patAbs.shape.k === "brand" && patAbs.shape.name === "RegExp") {
|
|
6137
6250
|
const inner = patAbs.shape.shape;
|
|
6138
6251
|
const slots = inner.shape.k === "obj" ? inner.shape.slots : void 0;
|
|
@@ -6151,11 +6264,12 @@ function callAbsMethod(recv, name, args) {
|
|
|
6151
6264
|
throw new NudoThrow(errorTypeAbs("TypeError"));
|
|
6152
6265
|
}
|
|
6153
6266
|
const pat = patSrc ?? patRe;
|
|
6154
|
-
const
|
|
6155
|
-
|
|
6267
|
+
const rvLit = repAbs?.term?.op === "lit" ? repAbs.term.value : void 0;
|
|
6268
|
+
const rv = repAbs === void 0 ? "undefined" : typeof rvLit === "string" ? rvLit : repAbs.term?.op === "lit" && typeof rvLit !== "symbol" ? String(rvLit) : void 0;
|
|
6269
|
+
if (rv !== void 0) {
|
|
6156
6270
|
return strLit(name === "replaceAll" ? lit3.replaceAll(pat, rv) : lit3.replace(pat, rv));
|
|
6157
6271
|
}
|
|
6158
|
-
if (repAbs.shape.k === "fn") {
|
|
6272
|
+
if (repAbs && repAbs.shape.k === "fn") {
|
|
6159
6273
|
let anyUnknown = false;
|
|
6160
6274
|
const replWrapper = (...caps) => {
|
|
6161
6275
|
const last = caps[caps.length - 1];
|
|
@@ -6545,8 +6659,9 @@ function leqWithPred(src, tgt, phi2, env, depth) {
|
|
|
6545
6659
|
if (src.shape.k === "any") return ok();
|
|
6546
6660
|
const sv = litValue(src);
|
|
6547
6661
|
const tv = litValue(tgt);
|
|
6662
|
+
const sameLit = sv === tv || typeof sv === "number" && typeof tv === "number" && Number.isNaN(sv) && Number.isNaN(tv);
|
|
6548
6663
|
if (sv !== void 0 && tv !== void 0) {
|
|
6549
|
-
if (
|
|
6664
|
+
if (sameLit) return ok();
|
|
6550
6665
|
if (tgt.shape.k === "prim") {
|
|
6551
6666
|
return fail(`lit ${String(sv)} \u22AD lit ${String(tv)}`);
|
|
6552
6667
|
}
|
|
@@ -7153,7 +7268,7 @@ function litTruth(a) {
|
|
|
7153
7268
|
case "eff":
|
|
7154
7269
|
return true;
|
|
7155
7270
|
case "prim":
|
|
7156
|
-
return a.shape.type === "symbol"
|
|
7271
|
+
return a.shape.type === "symbol" ? true : void 0;
|
|
7157
7272
|
case "never":
|
|
7158
7273
|
return false;
|
|
7159
7274
|
default:
|
|
@@ -8257,7 +8372,7 @@ function emitArrMutatorRebinds(expr, opts, pad) {
|
|
|
8257
8372
|
if (node.type === "CallExpression" && node.callee?.type === "MemberExpression" && node.callee.computed !== true && node.callee.property?.type === "Identifier" && ARR_MUTATOR_NAMES.has(node.callee.property.name)) {
|
|
8258
8373
|
const methodName = node.callee.property.name;
|
|
8259
8374
|
const argSrcs = (node.arguments ?? []).map(
|
|
8260
|
-
(a) => a.type === "SpreadElement" ? "$
|
|
8375
|
+
(a) => a.type === "SpreadElement" ? "$unknown()" : isExpression(a) ? emitTranspileExpression(a, opts) : "$unknown()"
|
|
8261
8376
|
).join(", ");
|
|
8262
8377
|
const objNode = node.callee.object;
|
|
8263
8378
|
if (objNode.type === "Identifier") {
|
|
@@ -8279,7 +8394,7 @@ function emitArrMutatorRebinds(expr, opts, pad) {
|
|
|
8279
8394
|
}
|
|
8280
8395
|
if (node.type === "CallExpression" && node.callee?.type === "MemberExpression" && node.callee.computed !== true && node.callee.object?.type === "Identifier" && node.callee.object.name === "Object" && node.callee.property?.type === "Identifier" && node.callee.property.name === "defineProperty" && node.arguments?.[0] && node.arguments[0].type === "Identifier") {
|
|
8281
8396
|
const argSrcs = node.arguments.map(
|
|
8282
|
-
(a) => a.type === "SpreadElement" ? "$
|
|
8397
|
+
(a) => a.type === "SpreadElement" ? "$unknown()" : emitTranspileExpression(a, opts)
|
|
8283
8398
|
).join(", ");
|
|
8284
8399
|
const targetName = node.arguments[0].name;
|
|
8285
8400
|
lines.push(
|
|
@@ -8917,7 +9032,7 @@ ${pad}export default ${name};`;
|
|
|
8917
9032
|
const methodName = expr.callee.property.name;
|
|
8918
9033
|
if (["push", "unshift", "splice", "pop", "shift", "reverse", "sort"].includes(methodName)) {
|
|
8919
9034
|
const argSrcs = expr.arguments.map(
|
|
8920
|
-
(a) => a.type === "SpreadElement" ? "$
|
|
9035
|
+
(a) => a.type === "SpreadElement" ? "$unknown()" : emitTranspileExpression(a, opts)
|
|
8921
9036
|
).join(", ");
|
|
8922
9037
|
const objNode = expr.callee.object;
|
|
8923
9038
|
if (objNode.type === "Identifier") {
|
|
@@ -9803,7 +9918,7 @@ function transpileExpression(expr, opts = {}) {
|
|
|
9803
9918
|
case "NewExpression": {
|
|
9804
9919
|
const callee = expr.callee;
|
|
9805
9920
|
const cname = callee.type === "Identifier" ? callee.name : isExpression(callee) ? transpileExpression(callee, opts) : "$lit(undefined)";
|
|
9806
|
-
const args = expr.arguments.map((a) => a.type === "SpreadElement" ? "$
|
|
9921
|
+
const args = expr.arguments.map((a) => a.type === "SpreadElement" ? "$unknown()" : transpileExpression(a, opts)).join(", ");
|
|
9807
9922
|
return `$new(${cname}, [${args}])`;
|
|
9808
9923
|
}
|
|
9809
9924
|
case "LogicalExpression": {
|
|
@@ -10239,11 +10354,11 @@ ${mBodyInner}
|
|
|
10239
10354
|
const optionalCall = exprAny.type === "OptionalCallExpression" || exprAny.optional === true;
|
|
10240
10355
|
const callee = expr.callee;
|
|
10241
10356
|
if (callee.type === "Super" && opts.thisParam && opts.className) {
|
|
10242
|
-
const args2 = expr.arguments.map((a) => a.type === "SpreadElement" ? "$
|
|
10357
|
+
const args2 = expr.arguments.map((a) => a.type === "SpreadElement" ? "$unknown()" : transpileExpression(a, opts)).join(", ");
|
|
10243
10358
|
return `${opts.thisParam} = $super(${opts.thisParam}, ${JSON.stringify(opts.className)}, [${args2}])`;
|
|
10244
10359
|
}
|
|
10245
10360
|
if (callee.type === "MemberExpression" && !callee.computed && callee.object.type === "Super" && callee.property.type === "Identifier" && opts.thisParam && opts.className) {
|
|
10246
|
-
const args2 = expr.arguments.map((a) => a.type === "SpreadElement" ? "$
|
|
10361
|
+
const args2 = expr.arguments.map((a) => a.type === "SpreadElement" ? "$unknown()" : transpileExpression(a, opts)).join(", ");
|
|
10247
10362
|
return `$invokeSuper(${opts.thisParam}, ${JSON.stringify(opts.className)}, ${JSON.stringify(callee.property.name)}, [${args2}])`;
|
|
10248
10363
|
}
|
|
10249
10364
|
if (callee.type === "MemberExpression" && !callee.computed && callee.object.type === "Identifier" && callee.object.name === "require" && callee.property.type === "Identifier" && callee.property.name === "resolve") {
|
|
@@ -10258,7 +10373,7 @@ ${mBodyInner}
|
|
|
10258
10373
|
}
|
|
10259
10374
|
if ((callee.type === "MemberExpression" || callee.type === "OptionalMemberExpression") && !callee.computed && callee.property.type === "Identifier") {
|
|
10260
10375
|
const recv = transpileExpression(callee.object, opts);
|
|
10261
|
-
const args2 = expr.arguments.map((a) => a.type === "SpreadElement" ? "$
|
|
10376
|
+
const args2 = expr.arguments.map((a) => a.type === "SpreadElement" ? "$unknown()" : transpileExpression(a, opts)).join(", ");
|
|
10262
10377
|
const name = JSON.stringify(callee.property.name);
|
|
10263
10378
|
const opt = optionalCall || callee.optional === true;
|
|
10264
10379
|
const loc = expr.loc;
|
|
@@ -10274,7 +10389,7 @@ ${mBodyInner}
|
|
|
10274
10389
|
const argLocSrcs = [];
|
|
10275
10390
|
for (const a of expr.arguments) {
|
|
10276
10391
|
if (a.type === "SpreadElement") {
|
|
10277
|
-
argSrcs.push("$
|
|
10392
|
+
argSrcs.push("$unknown()");
|
|
10278
10393
|
argLocSrcs.push("null");
|
|
10279
10394
|
} else {
|
|
10280
10395
|
argSrcs.push(transpileExpression(a, opts));
|
|
@@ -11327,16 +11442,21 @@ function $arrMutContainer(arr, method, args) {
|
|
|
11327
11442
|
function $idx(a, i) {
|
|
11328
11443
|
if (a?.shape?.k === "any") return anyMemberResult();
|
|
11329
11444
|
const iv = litValue(i);
|
|
11445
|
+
const idx = iv !== void 0 ? canonicalArrayIndex(iv) : void 0;
|
|
11330
11446
|
if (a.shape.k === "tuple") {
|
|
11331
11447
|
const els = a.shape.elements;
|
|
11332
|
-
if (
|
|
11333
|
-
|
|
11448
|
+
if (iv !== void 0 && idx === void 0) return undef();
|
|
11449
|
+
if (idx !== void 0) {
|
|
11450
|
+
if (idx < els.length) return els[idx];
|
|
11334
11451
|
return undef();
|
|
11335
11452
|
}
|
|
11336
11453
|
if (els.length === 0) return undef();
|
|
11337
11454
|
return els.reduce((x, y) => joinAbs(x, y));
|
|
11338
11455
|
}
|
|
11339
|
-
if (a.shape.k === "arr")
|
|
11456
|
+
if (a.shape.k === "arr") {
|
|
11457
|
+
if (iv !== void 0 && idx === void 0) return undef();
|
|
11458
|
+
return a.shape.element;
|
|
11459
|
+
}
|
|
11340
11460
|
if (a.shape.k === "sum") {
|
|
11341
11461
|
return a.shape.members.map((m) => $idx(m, i)).reduce((x, y) => joinAbs(x, y));
|
|
11342
11462
|
}
|
|
@@ -11725,6 +11845,46 @@ function namespaceNameOf(v2) {
|
|
|
11725
11845
|
function $regex(pattern, flags = "") {
|
|
11726
11846
|
return regexBrandAbsFrom(pattern, flags);
|
|
11727
11847
|
}
|
|
11848
|
+
var ARRAY_PROTO_METHOD_NAMES = /* @__PURE__ */ new Set([
|
|
11849
|
+
"at",
|
|
11850
|
+
"concat",
|
|
11851
|
+
"copyWithin",
|
|
11852
|
+
"entries",
|
|
11853
|
+
"every",
|
|
11854
|
+
"fill",
|
|
11855
|
+
"filter",
|
|
11856
|
+
"find",
|
|
11857
|
+
"findIndex",
|
|
11858
|
+
"findLast",
|
|
11859
|
+
"findLastIndex",
|
|
11860
|
+
"flat",
|
|
11861
|
+
"flatMap",
|
|
11862
|
+
"forEach",
|
|
11863
|
+
"includes",
|
|
11864
|
+
"indexOf",
|
|
11865
|
+
"join",
|
|
11866
|
+
"keys",
|
|
11867
|
+
"lastIndexOf",
|
|
11868
|
+
"map",
|
|
11869
|
+
"pop",
|
|
11870
|
+
"push",
|
|
11871
|
+
"reduce",
|
|
11872
|
+
"reduceRight",
|
|
11873
|
+
"reverse",
|
|
11874
|
+
"shift",
|
|
11875
|
+
"slice",
|
|
11876
|
+
"some",
|
|
11877
|
+
"sort",
|
|
11878
|
+
"splice",
|
|
11879
|
+
"toLocaleString",
|
|
11880
|
+
"toString",
|
|
11881
|
+
"unshift",
|
|
11882
|
+
"values",
|
|
11883
|
+
"@@iterator"
|
|
11884
|
+
]);
|
|
11885
|
+
function isPossiblyProtoMemberKey(key) {
|
|
11886
|
+
return OBJECT_PROTO_METHOD_NAMES.has(key) || ARRAY_PROTO_METHOD_NAMES.has(key) || key === "constructor" || key.startsWith("@@");
|
|
11887
|
+
}
|
|
11728
11888
|
function $get(o, key, opts) {
|
|
11729
11889
|
if (!o || typeof o !== "object" || !("shape" in o)) {
|
|
11730
11890
|
if (o === Object.prototype) {
|
|
@@ -11816,10 +11976,19 @@ function $get(o, key, opts) {
|
|
|
11816
11976
|
if ((o.shape.k === "tuple" || o.shape.k === "arr") && key === "length") {
|
|
11817
11977
|
return $len(o);
|
|
11818
11978
|
}
|
|
11819
|
-
if (
|
|
11979
|
+
if (o.shape.k === "tuple") {
|
|
11980
|
+
const idx = canonicalArrayIndex(key);
|
|
11981
|
+
const els = o.shape.elements;
|
|
11982
|
+
if (idx !== void 0) return idx < els.length ? els[idx] : undef();
|
|
11983
|
+
if (!isPossiblyProtoMemberKey(key)) return undef();
|
|
11984
|
+
}
|
|
11985
|
+
if ((o.shape.k === "tuple" || o.shape.k === "arr" || o.shape.k === "prim") && (OBJECT_PROTO_METHOD_NAMES.has(key) || o.shape.k !== "prim" && ARRAY_PROTO_METHOD_NAMES.has(key)) && !(o.shape.k === "prim" && o.shape.type === "string" && key === "toString")) {
|
|
11820
11986
|
if ((o.shape.k === "tuple" || o.shape.k === "arr") && (key === "toString" || key === "toLocaleString" || key === "join")) {
|
|
11821
11987
|
return arrayMethodAbs(key === "join" ? "join" : key);
|
|
11822
11988
|
}
|
|
11989
|
+
if (o.shape.k !== "prim" && (ARRAY_PROTO_METHOD_NAMES.has(key) || key === "@@iterator")) {
|
|
11990
|
+
return { shape: { k: "fn", params: [] }, conf: "path" };
|
|
11991
|
+
}
|
|
11823
11992
|
return objectProtoMethodAbs(key);
|
|
11824
11993
|
}
|
|
11825
11994
|
if (noteNullishMemberThrows(o, key, "property")) {
|
|
@@ -13262,13 +13431,11 @@ function $invoke(thisVal, method, args, loc) {
|
|
|
13262
13431
|
}
|
|
13263
13432
|
const brandName = thisVal.shape.k === "brand" ? thisVal.shape.name : void 0;
|
|
13264
13433
|
if (brandName) {
|
|
13265
|
-
|
|
13266
|
-
|
|
13267
|
-
|
|
13268
|
-
|
|
13269
|
-
|
|
13270
|
-
if (r !== void 0) return r;
|
|
13271
|
-
}
|
|
13434
|
+
const viaBuiltin = evalBuiltinInstanceMethod(brandName, method, thisVal, args);
|
|
13435
|
+
if (viaBuiltin !== void 0) return viaBuiltin;
|
|
13436
|
+
if ((brandName === "Map" || brandName === "Set") && method === "forEach") {
|
|
13437
|
+
const r = $collectionForEach(thisVal, args[0]);
|
|
13438
|
+
if (r !== void 0) return r;
|
|
13272
13439
|
}
|
|
13273
13440
|
const m = findMethod(brandName, method);
|
|
13274
13441
|
if (m) {
|
package/dist/exec.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { $ as $add, a as $arguments, b as $arr, c as $arrMutContainer, d as $arrRest, e as $arrWithHoles, f as $assignRecord, g as $async, h as $asyncReturn, i as $await, j as $bitand, k as $bitnot, l as $bitor, m as $bitxor, n as $call, o as $callNamed, p as $catchVal, q as $class, r as $classExpr, s as $collectionForEach, t as $concat, u as $copy, v as $del, w as $delRes, x as $div, y as $dynamicImport, z as $elems, B as $eq, C as $eqLoose, D as $fnVal, E as $for, F as $forInKeys, G as $forIter, H as $forOf, I as $fork, J as $ge, K as $gen, L as $get, M as $gt, N as $idx, O as $idxSet, P as $importMeta, Q as $in, S as $instanceof, T as $instanceofNonIdent, U as $invoke, V as $invokeSuper, W as $isBreakTo, X as $isForkExit, Y as $join, Z as $le, _ as $len, a0 as $lit, a1 as $loopBreak, a2 as $loopContinue, a3 as $loopReturn, a4 as $lt, a5 as $mod, a6 as $mul, a7 as $ne, a8 as $neLoose, a9 as $neg, aa as $new, ab as $not, ac as $nullishTest, ad as $obj, ae as $objAccessor, af as $objRest, ag as $optionalGet, ah as $optionalInvoke, ai as $orDefault, aj as $pow, ak as $pushLoopExit, al as $rawThis, am as $reStateCall, an as $recordBinding, ao as $regex, ap as $rethrowIfNudoReturn, aq as $set, ar as $setKey, as as $shl, at as $shr, au as $spread, av as $staticInvoke, aw as $sub, ax as $super, ay as $switch, az as $thisGet, aA as $thisSet, aB as $throw, aC as $toNumber, aD as $tryCurrentMark, aE as $tryDetachSoftCatch, aF as $tryDigestSoftCatch, aG as $tryDiscardSoft, aH as $tryMark, aI as $tryOrphanSoft, aJ as $tryPopMark, aK as $tryReleaseSoftCatch, aL as $tryReleaseSoftOut, aM as $tryTakeSince, aN as $typeof, aO as $unknown, aP as $ushr, aQ as $while, aR as $whileSeq, aS as $yield, aT as BAbsAssignRecord, aU as BCallRecord, aV as BClassSpec, aW as BPathFallback, aX as DEFAULT_MAX_LOOP_ITERS, aY as MAX_B_CALL_DEPTH, aZ as MAX_B_TOTAL_CALLS, a_ as NudoLoopSignal, a$ as NudoReturn, b0 as NudoThrow, b1 as NudoUnsupportedError, b2 as RUNTIME_IMPORT_RE, R as RunTranspiledOptions, b3 as TranspileOptions, b4 as TranspiledCallResult, b5 as asAbsVal, b7 as bindingsOf, b8 as callAtFunctionBoundary, b9 as callTranspiledExport, ba as callTranspiledExportFull, bb as clearBClasses, bc as clearStaleTermPred, be as currentExecPhi, bf as evalExprAbs, bg as fillTuple, bh as foldRequireSpecArg, bi as foldStaticStringExpr, bj as getBCallCollector, bk as getBClass, bl as isArrMutator, bm as isDefinitelyFalse, bn as isDefinitelyTrue, bo as isNudoBreak, bp as isNudoContinue, bq as isNudoReturn, br as isNudoThrow, bs as litTruth, bt as lookupObjAccessor, bu as namespaceNameOf, bv as noteBCallRecord, bw as noteBPathFallback, bx as pushLoopExit, by as pushThrowExit, bz as registerBClass, bA as resetBCallBudget, bB as runTranspiled, bC as runTranspiledOptionsMemoKey, bD as runWithLoopExits, bE as runtimeImportOf, bF as setBAssignCollector, bG as setBBindingSink, bH as setBCallCollector, bI as setBPathFallbackCollector, bJ as takeLoopExits, bK as takeThrowExits, bL as transpile, bM as transpileBodyNode, bN as transpileExpression, bO as transpileFile, bP as transpileSource, bQ as tryRunTranspiled, bR as withExecPhi } from './index-
|
|
1
|
+
export { $ as $add, a as $arguments, b as $arr, c as $arrMutContainer, d as $arrRest, e as $arrWithHoles, f as $assignRecord, g as $async, h as $asyncReturn, i as $await, j as $bitand, k as $bitnot, l as $bitor, m as $bitxor, n as $call, o as $callNamed, p as $catchVal, q as $class, r as $classExpr, s as $collectionForEach, t as $concat, u as $copy, v as $del, w as $delRes, x as $div, y as $dynamicImport, z as $elems, B as $eq, C as $eqLoose, D as $fnVal, E as $for, F as $forInKeys, G as $forIter, H as $forOf, I as $fork, J as $ge, K as $gen, L as $get, M as $gt, N as $idx, O as $idxSet, P as $importMeta, Q as $in, S as $instanceof, T as $instanceofNonIdent, U as $invoke, V as $invokeSuper, W as $isBreakTo, X as $isForkExit, Y as $join, Z as $le, _ as $len, a0 as $lit, a1 as $loopBreak, a2 as $loopContinue, a3 as $loopReturn, a4 as $lt, a5 as $mod, a6 as $mul, a7 as $ne, a8 as $neLoose, a9 as $neg, aa as $new, ab as $not, ac as $nullishTest, ad as $obj, ae as $objAccessor, af as $objRest, ag as $optionalGet, ah as $optionalInvoke, ai as $orDefault, aj as $pow, ak as $pushLoopExit, al as $rawThis, am as $reStateCall, an as $recordBinding, ao as $regex, ap as $rethrowIfNudoReturn, aq as $set, ar as $setKey, as as $shl, at as $shr, au as $spread, av as $staticInvoke, aw as $sub, ax as $super, ay as $switch, az as $thisGet, aA as $thisSet, aB as $throw, aC as $toNumber, aD as $tryCurrentMark, aE as $tryDetachSoftCatch, aF as $tryDigestSoftCatch, aG as $tryDiscardSoft, aH as $tryMark, aI as $tryOrphanSoft, aJ as $tryPopMark, aK as $tryReleaseSoftCatch, aL as $tryReleaseSoftOut, aM as $tryTakeSince, aN as $typeof, aO as $unknown, aP as $ushr, aQ as $while, aR as $whileSeq, aS as $yield, aT as BAbsAssignRecord, aU as BCallRecord, aV as BClassSpec, aW as BPathFallback, aX as DEFAULT_MAX_LOOP_ITERS, aY as MAX_B_CALL_DEPTH, aZ as MAX_B_TOTAL_CALLS, a_ as NudoLoopSignal, a$ as NudoReturn, b0 as NudoThrow, b1 as NudoUnsupportedError, b2 as RUNTIME_IMPORT_RE, R as RunTranspiledOptions, b3 as TranspileOptions, b4 as TranspiledCallResult, b5 as asAbsVal, b7 as bindingsOf, b8 as callAtFunctionBoundary, b9 as callTranspiledExport, ba as callTranspiledExportFull, bb as clearBClasses, bc as clearStaleTermPred, be as currentExecPhi, bf as evalExprAbs, bg as fillTuple, bh as foldRequireSpecArg, bi as foldStaticStringExpr, bj as getBCallCollector, bk as getBClass, bl as isArrMutator, bm as isDefinitelyFalse, bn as isDefinitelyTrue, bo as isNudoBreak, bp as isNudoContinue, bq as isNudoReturn, br as isNudoThrow, bs as litTruth, bt as lookupObjAccessor, bu as namespaceNameOf, bv as noteBCallRecord, bw as noteBPathFallback, bx as pushLoopExit, by as pushThrowExit, bz as registerBClass, bA as resetBCallBudget, bB as runTranspiled, bC as runTranspiledOptionsMemoKey, bD as runWithLoopExits, bE as runtimeImportOf, bF as setBAssignCollector, bG as setBBindingSink, bH as setBCallCollector, bI as setBPathFallbackCollector, bJ as takeLoopExits, bK as takeThrowExits, bL as transpile, bM as transpileBodyNode, bN as transpileExpression, bO as transpileFile, bP as transpileSource, bQ as tryRunTranspiled, bR as withExecPhi } from './index-D4rnOHre.js';
|
|
2
2
|
import './hof-types-tAeoYvzY.js';
|
|
3
3
|
import '@babel/types';
|
package/dist/exec.js
CHANGED
|
@@ -291,7 +291,7 @@ declare function $copy(a: Abs): Abs;
|
|
|
291
291
|
* 的就地 mutator:Abs 身份不变(JS 引用语义——`const b = a; b.push(4)` 对 a
|
|
292
292
|
* 可见);transpile 重绑 `a = $arrMutContainer(a, …)` 仍写回同一对象。 */
|
|
293
293
|
declare function $arrMutContainer(arr: Abs, method: string, args: Abs[]): Abs;
|
|
294
|
-
/** 下标读 a[i]
|
|
294
|
+
/** 下标读 a[i];规范数组下标走精确投影,确定非下标键 → undefined,否则并所有元素;string[i] → 单字符 */
|
|
295
295
|
declare function $idx(a: Abs, i: Abs): Abs;
|
|
296
296
|
/** 下标写 a[i]=v → 新 tuple(越界写按 JS 语义增长,空洞为 undefined) */
|
|
297
297
|
declare function $idxSet(a: Abs, i: Abs, value: Abs): Abs;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { I as ImplicationOracle, L as LiteralValue, P as PrimName, x as TYPEOF_N
|
|
|
3
3
|
import { Node } from '@babel/types';
|
|
4
4
|
import { p as parseSource, L as LeakBudget, E as EffectiveInterfaceOpts, b as LoadDepsFingerprint, i as CheckReport, N as NudoConstraint } from './check-report-AtnAfY9U.js';
|
|
5
5
|
export { j as CheckAction, C as CheckIssue, k as CheckJson, o as CheckJsonMulti, q as ConstraintBuilder, D as Diagnostic, u as EffectiveInterface, G as GitlabCodeQualityIssue, v as InterfaceDiag, I as InterfaceSource, w as InterfaceTierInfo, a as InterfaceTierOpts, x as NamedImport, y as NudoField, z as NudoFnConstraint, A as NudoSidecarError, B as NudoSig, R as RefineDiag, F as RefineEntry, H as RefineResolveOpts, S as SELF, J as actionsForIssue, K as andC, M as any, O as array, P as boolean, Q as checkArg, T as checkCall, U as constraintToEntryAbs, V as effectiveInterface, W as execNudoModule, X as extractDeclaredThrows, Y as extractNudoImports, Z as extractRefineReturnFromSource, _ as extractRefinesFromSource, $ as fn, a0 as fnConstraintToEntryReqs, a1 as formatCheckReport, a2 as formatConstraint, a3 as formatDiagnostics, a4 as formatEffectiveInterfaceDisplay, a5 as formatGithubAnnotations, a6 as formatGitlabCodeQuality, a7 as formatInterfaceTierLine, a8 as generatedExportNames, a9 as getParseSourceCacheSize, aa as getTerm, ab as instantiateConstraint, ac as interfaceDiagCount, ad as interfaceSourceOf, ae as interfaceTierOf, af as isIntFlag, ag as isNodeModulesPath, ah as isNudoConstraint, ai as lenTerm, aj as litC, ak as localNamedExports, al as number, am as omit, an as partial, ao as pick, ap as refineDiagCount, aq as refineToIndexedFull, ar as resetNudoModuleExecCache, as as resetParseSourceCache, at as serializeCheckJson, au as serializeCheckJsonMulti, av as setInterfaceDiagCollector, aw as setRefineDiagCollector, ax as shape, ay as sidecarClosureFingerprint, az as sidecarPathOf, aA as string, aB as takeInterfaceDiags, aC as takeInterfaceDiagsSince, aD as takeRefineDiags, aE as takeRefineDiagsSince, aF as throwConstraintToKinds, aG as union } from './check-report-AtnAfY9U.js';
|
|
6
|
-
import { A as AbsModuleExports, R as RunTranspiledOptions } from './index-
|
|
7
|
-
export { $ as $add, a as $arguments, b as $arr, c as $arrMutContainer, d as $arrRest, e as $arrWithHoles, f as $assignRecord, g as $async, h as $asyncReturn, i as $await, j as $bitand, k as $bitnot, l as $bitor, m as $bitxor, n as $call, o as $callNamed, p as $catchVal, q as $class, r as $classExpr, s as $collectionForEach, t as $concat, u as $copy, v as $del, w as $delRes, x as $div, y as $dynamicImport, z as $elems, B as $eq, C as $eqLoose, D as $fnVal, E as $for, F as $forInKeys, G as $forIter, H as $forOf, I as $fork, J as $ge, K as $gen, L as $get, M as $gt, N as $idx, O as $idxSet, P as $importMeta, Q as $in, S as $instanceof, T as $instanceofNonIdent, U as $invoke, V as $invokeSuper, W as $isBreakTo, X as $isForkExit, Y as $join, Z as $le, _ as $len, a0 as $lit, a1 as $loopBreak, a2 as $loopContinue, a3 as $loopReturn, a4 as $lt, a5 as $mod, a6 as $mul, a7 as $ne, a8 as $neLoose, a9 as $neg, aa as $new, ab as $not, ac as $nullishTest, ad as $obj, ae as $objAccessor, af as $objRest, ag as $optionalGet, ah as $optionalInvoke, ai as $orDefault, aj as $pow, ak as $pushLoopExit, al as $rawThis, am as $reStateCall, an as $recordBinding, ao as $regex, ap as $rethrowIfNudoReturn, aq as $set, ar as $setKey, as as $shl, at as $shr, au as $spread, av as $staticInvoke, aw as $sub, ax as $super, ay as $switch, az as $thisGet, aA as $thisSet, aB as $throw, aC as $toNumber, aD as $tryCurrentMark, aE as $tryDetachSoftCatch, aF as $tryDigestSoftCatch, aG as $tryDiscardSoft, aH as $tryMark, aI as $tryOrphanSoft, aJ as $tryPopMark, aK as $tryReleaseSoftCatch, aL as $tryReleaseSoftOut, aM as $tryTakeSince, aN as $typeof, aO as $unknown, aP as $ushr, aQ as $while, aR as $whileSeq, aS as $yield, aT as BAbsAssignRecord, aU as BCallRecord, aV as BClassSpec, aW as BPathFallback, aX as DEFAULT_MAX_LOOP_ITERS, aY as MAX_B_CALL_DEPTH, aZ as MAX_B_TOTAL_CALLS, a_ as NudoLoopSignal, a$ as NudoReturn, b0 as NudoThrow, b1 as NudoUnsupportedError, b2 as RUNTIME_IMPORT_RE, b3 as TranspileOptions, b4 as TranspiledCallResult, b5 as asAbsVal, b6 as bindImports, b7 as bindingsOf, b8 as callAtFunctionBoundary, b9 as callTranspiledExport, ba as callTranspiledExportFull, bb as clearBClasses, bc as clearStaleTermPred, bd as collectAbsExports, be as currentExecPhi, bf as evalExprAbs, bg as fillTuple, bh as foldRequireSpecArg, bi as foldStaticStringExpr, bj as getBCallCollector, bk as getBClass, bl as isArrMutator, bm as isDefinitelyFalse, bn as isDefinitelyTrue, bo as isNudoBreak, bp as isNudoContinue, bq as isNudoReturn, br as isNudoThrow, bs as litTruth, bt as lookupObjAccessor, bu as namespaceNameOf, bv as noteBCallRecord, bw as noteBPathFallback, bx as pushLoopExit, by as pushThrowExit, bz as registerBClass, bA as resetBCallBudget, bB as runTranspiled, bC as runTranspiledOptionsMemoKey, bD as runWithLoopExits, bE as runtimeImportOf, bF as setBAssignCollector, bG as setBBindingSink, bH as setBCallCollector, bI as setBPathFallbackCollector, bJ as takeLoopExits, bK as takeThrowExits, bL as transpile, bM as transpileBodyNode, bN as transpileExpression, bO as transpileFile, bP as transpileSource, bQ as tryRunTranspiled, bR as withExecPhi } from './index-
|
|
6
|
+
import { A as AbsModuleExports, R as RunTranspiledOptions } from './index-D4rnOHre.js';
|
|
7
|
+
export { $ as $add, a as $arguments, b as $arr, c as $arrMutContainer, d as $arrRest, e as $arrWithHoles, f as $assignRecord, g as $async, h as $asyncReturn, i as $await, j as $bitand, k as $bitnot, l as $bitor, m as $bitxor, n as $call, o as $callNamed, p as $catchVal, q as $class, r as $classExpr, s as $collectionForEach, t as $concat, u as $copy, v as $del, w as $delRes, x as $div, y as $dynamicImport, z as $elems, B as $eq, C as $eqLoose, D as $fnVal, E as $for, F as $forInKeys, G as $forIter, H as $forOf, I as $fork, J as $ge, K as $gen, L as $get, M as $gt, N as $idx, O as $idxSet, P as $importMeta, Q as $in, S as $instanceof, T as $instanceofNonIdent, U as $invoke, V as $invokeSuper, W as $isBreakTo, X as $isForkExit, Y as $join, Z as $le, _ as $len, a0 as $lit, a1 as $loopBreak, a2 as $loopContinue, a3 as $loopReturn, a4 as $lt, a5 as $mod, a6 as $mul, a7 as $ne, a8 as $neLoose, a9 as $neg, aa as $new, ab as $not, ac as $nullishTest, ad as $obj, ae as $objAccessor, af as $objRest, ag as $optionalGet, ah as $optionalInvoke, ai as $orDefault, aj as $pow, ak as $pushLoopExit, al as $rawThis, am as $reStateCall, an as $recordBinding, ao as $regex, ap as $rethrowIfNudoReturn, aq as $set, ar as $setKey, as as $shl, at as $shr, au as $spread, av as $staticInvoke, aw as $sub, ax as $super, ay as $switch, az as $thisGet, aA as $thisSet, aB as $throw, aC as $toNumber, aD as $tryCurrentMark, aE as $tryDetachSoftCatch, aF as $tryDigestSoftCatch, aG as $tryDiscardSoft, aH as $tryMark, aI as $tryOrphanSoft, aJ as $tryPopMark, aK as $tryReleaseSoftCatch, aL as $tryReleaseSoftOut, aM as $tryTakeSince, aN as $typeof, aO as $unknown, aP as $ushr, aQ as $while, aR as $whileSeq, aS as $yield, aT as BAbsAssignRecord, aU as BCallRecord, aV as BClassSpec, aW as BPathFallback, aX as DEFAULT_MAX_LOOP_ITERS, aY as MAX_B_CALL_DEPTH, aZ as MAX_B_TOTAL_CALLS, a_ as NudoLoopSignal, a$ as NudoReturn, b0 as NudoThrow, b1 as NudoUnsupportedError, b2 as RUNTIME_IMPORT_RE, b3 as TranspileOptions, b4 as TranspiledCallResult, b5 as asAbsVal, b6 as bindImports, b7 as bindingsOf, b8 as callAtFunctionBoundary, b9 as callTranspiledExport, ba as callTranspiledExportFull, bb as clearBClasses, bc as clearStaleTermPred, bd as collectAbsExports, be as currentExecPhi, bf as evalExprAbs, bg as fillTuple, bh as foldRequireSpecArg, bi as foldStaticStringExpr, bj as getBCallCollector, bk as getBClass, bl as isArrMutator, bm as isDefinitelyFalse, bn as isDefinitelyTrue, bo as isNudoBreak, bp as isNudoContinue, bq as isNudoReturn, br as isNudoThrow, bs as litTruth, bt as lookupObjAccessor, bu as namespaceNameOf, bv as noteBCallRecord, bw as noteBPathFallback, bx as pushLoopExit, by as pushThrowExit, bz as registerBClass, bA as resetBCallBudget, bB as runTranspiled, bC as runTranspiledOptionsMemoKey, bD as runWithLoopExits, bE as runtimeImportOf, bF as setBAssignCollector, bG as setBBindingSink, bH as setBCallCollector, bI as setBPathFallbackCollector, bJ as takeLoopExits, bK as takeThrowExits, bL as transpile, bM as transpileBodyNode, bN as transpileExpression, bO as transpileFile, bP as transpileSource, bQ as tryRunTranspiled, bR as withExecPhi } from './index-D4rnOHre.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* AstEnv:抽象求值环境类型面(ast-eval 删除后保留)。
|
|
@@ -363,8 +363,9 @@ declare function mul(a: Abs, b: Abs, phi?: Phi): Abs;
|
|
|
363
363
|
*/
|
|
364
364
|
declare function div(a: Abs, b: Abs, phi?: Phi): Abs;
|
|
365
365
|
/**
|
|
366
|
-
* 取模:字面量折叠;`x % k`(k
|
|
367
|
-
*
|
|
366
|
+
* 取模:字面量折叠;`x % k`(k 为有限非零字面量)仅当被除数有限时
|
|
367
|
+
* 结果界在 (−|k|, |k|)。整数模可收紧到 [0, k),此处先做保守实数界。
|
|
368
|
+
* `n % 0` / `x % 0` / `x % NaN` 恒为 NaN(JS)。
|
|
368
369
|
*/
|
|
369
370
|
declare function mod(a: Abs, b: Abs, phi?: Phi): Abs;
|
|
370
371
|
/** 比较:返回 boolean Abs;若双字面量则 exact */
|
|
@@ -413,7 +414,7 @@ declare function powAbs(a: Abs, b: Abs): Abs;
|
|
|
413
414
|
declare function toNumberAbs(a: Abs): Abs;
|
|
414
415
|
/** JS typeof:结果域永远是 string */
|
|
415
416
|
declare function typeofAbs(a: Abs): Abs;
|
|
416
|
-
/**
|
|
417
|
+
/** 一元负号:字面量折叠(含 ToNumber 强制);符号数翻转不等式 */
|
|
417
418
|
declare function negAbs(a: Abs, _phi?: Phi): Abs;
|
|
418
419
|
/** 逻辑非 */
|
|
419
420
|
declare function notAbs(a: Abs): Abs;
|
|
@@ -453,7 +454,7 @@ declare function setPropFlags(o: Abs, key: string, f: PropFlags): void;
|
|
|
453
454
|
declare function migrateInvariants(from: Abs, to: Abs): void;
|
|
454
455
|
|
|
455
456
|
/**
|
|
456
|
-
* Math.* —
|
|
457
|
+
* Math.* — 字面量实参走 ToNumber/ToInt32 后调用原生折叠,否则 number
|
|
457
458
|
*/
|
|
458
459
|
|
|
459
460
|
declare function evalMathMethod(name: string, args: Abs[]): Abs | undefined;
|
|
@@ -476,7 +477,7 @@ declare function evalObjectMethod(name: string, args: Abs[]): Abs | undefined;
|
|
|
476
477
|
declare function evalJsonMethod(name: string, args: Abs[]): Abs | undefined;
|
|
477
478
|
|
|
478
479
|
/**
|
|
479
|
-
* Number.* 静态方法 + parseInt 折叠
|
|
480
|
+
* Number.* 静态方法 + parseInt/parseFloat 折叠
|
|
480
481
|
*/
|
|
481
482
|
|
|
482
483
|
/** Number.isInteger / isNaN / parseFloat 等 */
|
package/dist/index.js
CHANGED
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
takeRefineDiagsSince,
|
|
68
68
|
throwConstraintToKinds,
|
|
69
69
|
union
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-XOHKHJHE.js";
|
|
71
71
|
import {
|
|
72
72
|
$add,
|
|
73
73
|
$arguments,
|
|
@@ -466,7 +466,7 @@ import {
|
|
|
466
466
|
v,
|
|
467
467
|
withExecPhi,
|
|
468
468
|
withVar
|
|
469
|
-
} from "./chunk-
|
|
469
|
+
} from "./chunk-SQSO4NKT.js";
|
|
470
470
|
|
|
471
471
|
// src/environment.ts
|
|
472
472
|
function createEnvironment(parent, bindings = /* @__PURE__ */ new Map()) {
|
package/dist/internal.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
resolveDepPath,
|
|
17
17
|
sidecarSpecsOf,
|
|
18
18
|
stableAnalyzeKeySource
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-XOHKHJHE.js";
|
|
20
20
|
import {
|
|
21
21
|
$tryDigestSoft,
|
|
22
22
|
$tryMarkSoft,
|
|
@@ -135,7 +135,7 @@ import {
|
|
|
135
135
|
truncatedAbs,
|
|
136
136
|
viewTemplateParts,
|
|
137
137
|
wrapPromise
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-SQSO4NKT.js";
|
|
139
139
|
|
|
140
140
|
// src/algebra/inlay.ts
|
|
141
141
|
function listFunctions(source) {
|