@nudojs/core 1.7.8 → 1.7.10
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.
|
@@ -3361,7 +3361,12 @@ function isKnownNonBigintNumeric(a) {
|
|
|
3361
3361
|
if (r.ok && r.value === void 0) return true;
|
|
3362
3362
|
return a.shape.k === "prim" && (a.shape.type === "number" || a.shape.type === "boolean");
|
|
3363
3363
|
}
|
|
3364
|
+
function isNullishLitOperand(a) {
|
|
3365
|
+
const r = litValue(a);
|
|
3366
|
+
return r.ok && (r.value === null || r.value === void 0);
|
|
3367
|
+
}
|
|
3364
3368
|
function isMaybeBigintOperand(a) {
|
|
3369
|
+
if (isNullishLitOperand(a)) return false;
|
|
3365
3370
|
const k = a.shape.k;
|
|
3366
3371
|
if (k === "sum") {
|
|
3367
3372
|
const members = a.shape.members;
|
|
@@ -6971,15 +6976,32 @@ function mergeGrain(a, b) {
|
|
|
6971
6976
|
if (a !== b) return "nullish";
|
|
6972
6977
|
return a;
|
|
6973
6978
|
}
|
|
6979
|
+
var memberGuardTarget = (n) => {
|
|
6980
|
+
const t = n;
|
|
6981
|
+
const m = t?.type === "ChainExpression" ? t.expression : t;
|
|
6982
|
+
if (m?.type !== "MemberExpression" && m?.type !== "OptionalMemberExpression") return void 0;
|
|
6983
|
+
if (m.computed) return void 0;
|
|
6984
|
+
if (m.object?.type !== "Identifier" || !m.object.name) return void 0;
|
|
6985
|
+
const p = m.property;
|
|
6986
|
+
const key = p?.type === "Identifier" ? p.name : p?.type === "StringLiteral" && typeof p.value === "string" ? p.value : void 0;
|
|
6987
|
+
if (key === void 0) return void 0;
|
|
6988
|
+
return { name: m.object.name, key };
|
|
6989
|
+
};
|
|
6974
6990
|
function nullishGuardOf(test) {
|
|
6975
6991
|
const t = test;
|
|
6976
6992
|
if (t?.type === "LogicalExpression") return compositeNullishGuardOf(t);
|
|
6977
6993
|
if (t?.type === "UnaryExpression" && t.operator === "!" && t.argument?.type === "Identifier" && t.argument.name) {
|
|
6978
6994
|
return { name: t.argument.name, arm: "alt", grain: "nullish" };
|
|
6979
6995
|
}
|
|
6996
|
+
if (t?.type === "UnaryExpression" && t.operator === "!") {
|
|
6997
|
+
const m = memberGuardTarget(t.argument);
|
|
6998
|
+
if (m) return { name: m.name, arm: "alt", grain: "nullish", memberKey: m.key };
|
|
6999
|
+
}
|
|
6980
7000
|
if (t?.type === "Identifier" && t.name) {
|
|
6981
7001
|
return { name: t.name, arm: "cons", grain: "nullish" };
|
|
6982
7002
|
}
|
|
7003
|
+
const bare = memberGuardTarget(t);
|
|
7004
|
+
if (bare) return { name: bare.name, arm: "cons", grain: "nullish", memberKey: bare.key };
|
|
6983
7005
|
if (t?.type !== "BinaryExpression") return void 0;
|
|
6984
7006
|
const op = t.operator;
|
|
6985
7007
|
if (op !== "===" && op !== "!==" && op !== "==" && op !== "!=") return void 0;
|
|
@@ -7016,15 +7038,20 @@ function nullishGuardOf(test) {
|
|
|
7016
7038
|
function compositeNullishGuardOf(test) {
|
|
7017
7039
|
const t = test;
|
|
7018
7040
|
if (t?.type !== "LogicalExpression" || t.operator !== "||" && t.operator !== "&&") return void 0;
|
|
7041
|
+
const wantArm = t.operator === "||" ? "alt" : "cons";
|
|
7019
7042
|
const l = nullishGuardOf(t.left);
|
|
7020
7043
|
const r = nullishGuardOf(t.right);
|
|
7021
|
-
|
|
7022
|
-
const
|
|
7023
|
-
if (
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7044
|
+
const lg = l && l.arm === wantArm ? l : void 0;
|
|
7045
|
+
const rg = r && r.arm === wantArm ? r : void 0;
|
|
7046
|
+
if (lg && rg) {
|
|
7047
|
+
if (lg.name !== rg.name) return void 0;
|
|
7048
|
+
const g1 = lg.grain === "null" || lg.grain === "undefined" ? lg.grain : null;
|
|
7049
|
+
const g2 = rg.grain === "null" || rg.grain === "undefined" ? rg.grain : null;
|
|
7050
|
+
const grain = g1 === null || g2 === null ? "nullish" : mergeGrain(g1, g2);
|
|
7051
|
+
const memberKey = lg.memberKey ?? rg.memberKey;
|
|
7052
|
+
return { name: lg.name, arm: wantArm, grain, ...memberKey !== void 0 ? { memberKey } : {} };
|
|
7053
|
+
}
|
|
7054
|
+
return lg ?? rg;
|
|
7028
7055
|
}
|
|
7029
7056
|
function typeGuardOf(test) {
|
|
7030
7057
|
const t = test;
|
|
@@ -7039,16 +7066,19 @@ function typeGuardOf(test) {
|
|
|
7039
7066
|
if (litSide.value === "undefined" || !TYPEOF_NAMES2.has(litSide.value)) return void 0;
|
|
7040
7067
|
return { name, typeOf: litSide.value, arm: op === "===" || op === "==" ? "cons" : "alt" };
|
|
7041
7068
|
}
|
|
7042
|
-
function
|
|
7043
|
-
if (
|
|
7044
|
-
|
|
7045
|
-
|
|
7069
|
+
function nullishRemoveCallOf(guard) {
|
|
7070
|
+
if (guard.memberKey !== void 0) {
|
|
7071
|
+
return `$removeMemberNullish($removeNullish(${guard.name}), ${JSON.stringify(guard.memberKey)})`;
|
|
7072
|
+
}
|
|
7073
|
+
if (guard.grain === "undefined") return `$removeUndefined(${guard.name})`;
|
|
7074
|
+
if (guard.grain === "null") return `$removeNull(${guard.name})`;
|
|
7075
|
+
return `$removeNullish(${guard.name})`;
|
|
7046
7076
|
}
|
|
7047
7077
|
function narrowNullishArmThunk(thunk, guard, arm, forkBindingNames) {
|
|
7048
7078
|
if (!guard || guard.arm !== arm) return thunk;
|
|
7049
7079
|
const names = forkBindingNames instanceof Set ? forkBindingNames : new Set(forkBindingNames);
|
|
7050
7080
|
if (names.has(guard.name)) return thunk;
|
|
7051
|
-
return `((${guard.name}) => ${thunk})(${
|
|
7081
|
+
return `((${guard.name}) => ${thunk})(${nullishRemoveCallOf(guard)})`;
|
|
7052
7082
|
}
|
|
7053
7083
|
function narrowTypeArmThunk(thunk, guard, arm, forkBindingNames) {
|
|
7054
7084
|
if (!guard) return thunk;
|
|
@@ -7151,13 +7181,24 @@ function transpileFnBodyStmts(stmtsIn, depth, opts, varScope) {
|
|
|
7151
7181
|
};
|
|
7152
7182
|
const testRecvs = collectArrMutatorReceivers(stmt.test);
|
|
7153
7183
|
const testRebinds = testRecvs.size ? emitArrMutatorRebinds(stmt.test, scopedOpts, pad) : [];
|
|
7154
|
-
const
|
|
7184
|
+
const earlyGuard = nullishGuardOf(stmt.test);
|
|
7185
|
+
const earlyTGuard = typeGuardOf(stmt.test);
|
|
7186
|
+
const consNarrowed = narrowTypeArmThunk(
|
|
7187
|
+
narrowNullishArmThunk(
|
|
7188
|
+
transpileBlockAsThunk(stmt.consequent, depth, scopedOpts),
|
|
7189
|
+
earlyGuard,
|
|
7190
|
+
"cons",
|
|
7191
|
+
recvSet
|
|
7192
|
+
),
|
|
7193
|
+
earlyTGuard,
|
|
7194
|
+
"cons",
|
|
7195
|
+
recvSet
|
|
7196
|
+
);
|
|
7197
|
+
const cons = wrapArm(consNarrowed, "fk1_");
|
|
7155
7198
|
const altBody = transpileFnBodyStmts(rest, depth + 1, { ...scopedOpts, inLoop: opts.inLoop });
|
|
7156
7199
|
const altThunk = `() => {
|
|
7157
7200
|
${altBody}
|
|
7158
7201
|
${pad}}`;
|
|
7159
|
-
const earlyGuard = nullishGuardOf(stmt.test);
|
|
7160
|
-
const earlyTGuard = typeGuardOf(stmt.test);
|
|
7161
7202
|
const altNarrowed = narrowTypeArmThunk(
|
|
7162
7203
|
narrowNullishArmThunk(altThunk, earlyGuard, "alt", recvSet),
|
|
7163
7204
|
earlyTGuard,
|
|
@@ -8398,9 +8439,9 @@ function transpileShortCircuitExpr(opts, parts) {
|
|
|
8398
8439
|
let altExpr = parts.altSrc === "__test" ? parts.alwaysSrc : parts.altSrc;
|
|
8399
8440
|
if (parts.narrowGuard) {
|
|
8400
8441
|
if (parts.narrowGuard.arm === "cons") {
|
|
8401
|
-
consExpr = `((${parts.narrowGuard.name}) => (${consExpr}))($
|
|
8442
|
+
consExpr = `((${parts.narrowGuard.name}) => (${consExpr}))(${nullishRemoveCallOf(parts.narrowGuard)})`;
|
|
8402
8443
|
} else {
|
|
8403
|
-
altExpr = `((${parts.narrowGuard.name}) => (${altExpr}))($
|
|
8444
|
+
altExpr = `((${parts.narrowGuard.name}) => (${altExpr}))(${nullishRemoveCallOf(parts.narrowGuard)})`;
|
|
8404
8445
|
}
|
|
8405
8446
|
}
|
|
8406
8447
|
if (parts.typeGuard) {
|
|
@@ -9420,7 +9461,7 @@ function transpileSource(source, opts = {}) {
|
|
|
9420
9461
|
return transpileFile(file, { ...opts, source: opts.source ?? source });
|
|
9421
9462
|
}
|
|
9422
9463
|
function runtimeImportOf(runtime) {
|
|
9423
|
-
return `import { $absVal, $add, $sub, $mul, $div, $mod, $bitand, $bitor, $bitxor, $bitnot, $shl, $shr, $ushr, $pow, $toNumber, $toNumeric, $updateAdd, $updateSub, $in, $instanceof, $instanceofNonIdent, $classExpr, $del, $delRes, $objAccessor, $objAccessorKey, $neg, $typeof, $not, $eq, $ne, $eqLoose, $neLoose, $lt, $le, $gt, $ge, $join, $lit, $fork, $for, $forIter, $obj, $get, $set, $setProto, $while, $whileSeq, $arr, $arrWithHoles, $arrMutContainer, $idx, $idxSet, $len, $call, $throw, $loopReturn, $loopBreak, $loopContinue, $class, $new, $invoke, $invokeSuper, $invokeSuperObj, $invokeSuperKey, $getSuper, $getSuperObj, $super, $async, $copy, $await, $asyncReturn, $orDefault, $callNamed, $optionalGet, $optionalInvoke, $spread, $concat, $forOf, $forInKeys, $iterCheck, $catchVal, $switch, $staticInvoke, $setKey, $gen, $newTarget, $staticInit, $yield, $fnVal, $regex, $reStateCall, $rethrowIfNudoReturn, $nullishTest, $removeNullish, $removeNull, $removeUndefined, $narrowTypeOf, $tryMark, $assignRecord, $recordBinding, $unknown, $importMeta, $dynamicImport, $tryTakeSince, $tryCurrentMark, $tryPopMark, $tryDigestSoftCatch, $tryReleaseSoftOut, $tryDetachSoftCatch, $tryDiscardSoft, $tryOrphanSoft, $pushLoopExit, $objRest, $arrRest, $elems, $arguments, $isForkExit, $rawThis, $isBreakTo, $yieldStar, $tpl } from ${JSON.stringify(runtime)};`;
|
|
9464
|
+
return `import { $absVal, $add, $sub, $mul, $div, $mod, $bitand, $bitor, $bitxor, $bitnot, $shl, $shr, $ushr, $pow, $toNumber, $toNumeric, $updateAdd, $updateSub, $in, $instanceof, $instanceofNonIdent, $classExpr, $del, $delRes, $objAccessor, $objAccessorKey, $neg, $typeof, $not, $eq, $ne, $eqLoose, $neLoose, $lt, $le, $gt, $ge, $join, $lit, $fork, $for, $forIter, $obj, $get, $set, $setProto, $while, $whileSeq, $arr, $arrWithHoles, $arrMutContainer, $idx, $idxSet, $len, $call, $throw, $loopReturn, $loopBreak, $loopContinue, $class, $new, $invoke, $invokeSuper, $invokeSuperObj, $invokeSuperKey, $getSuper, $getSuperObj, $super, $async, $copy, $await, $asyncReturn, $orDefault, $callNamed, $optionalGet, $optionalInvoke, $spread, $concat, $forOf, $forInKeys, $iterCheck, $catchVal, $switch, $staticInvoke, $setKey, $gen, $newTarget, $staticInit, $yield, $fnVal, $regex, $reStateCall, $rethrowIfNudoReturn, $nullishTest, $removeNullish, $removeNull, $removeUndefined, $removeMemberNullish, $narrowTypeOf, $tryMark, $assignRecord, $recordBinding, $unknown, $importMeta, $dynamicImport, $tryTakeSince, $tryCurrentMark, $tryPopMark, $tryDigestSoftCatch, $tryReleaseSoftOut, $tryDetachSoftCatch, $tryDiscardSoft, $tryOrphanSoft, $pushLoopExit, $objRest, $arrRest, $elems, $arguments, $isForkExit, $rawThis, $isBreakTo, $yieldStar, $tpl } from ${JSON.stringify(runtime)};`;
|
|
9424
9465
|
}
|
|
9425
9466
|
function transpileFile(file, opts = {}) {
|
|
9426
9467
|
const runtime = opts.runtimeImport ?? "@nudojs/core/exec";
|
|
@@ -9441,7 +9482,7 @@ function transpileFile(file, opts = {}) {
|
|
|
9441
9482
|
};
|
|
9442
9483
|
const lines = [
|
|
9443
9484
|
`// nudo evaluator transpile \u2014 values are Abs; operators are overloaded calls`,
|
|
9444
|
-
`import { $absVal, $add, $sub, $mul, $div, $mod, $bitand, $bitor, $bitxor, $bitnot, $shl, $shr, $ushr, $pow, $toNumber, $toNumeric, $updateAdd, $updateSub, $in, $instanceof, $instanceofNonIdent, $classExpr, $del, $delRes, $objAccessor, $objAccessorKey, $neg, $typeof, $not, $eq, $ne, $eqLoose, $neLoose, $lt, $le, $gt, $ge, $join, $lit, $fork, $for, $forIter, $obj, $get, $set, $setProto, $while, $whileSeq, $arr, $arrWithHoles, $arrMutContainer, $idx, $idxSet, $len, $call, $throw, $loopReturn, $loopBreak, $loopContinue, $class, $new, $invoke, $invokeSuper, $invokeSuperObj, $invokeSuperKey, $getSuper, $getSuperObj, $super, $async, $copy, $await, $asyncReturn, $orDefault, $callNamed, $optionalGet, $optionalInvoke, $spread, $concat, $forOf, $forInKeys, $iterCheck, $catchVal, $switch, $staticInvoke, $setKey, $gen, $newTarget, $staticInit, $yield, $fnVal, $regex, $reStateCall, $rethrowIfNudoReturn, $nullishTest, $removeNullish, $removeNull, $removeUndefined, $narrowTypeOf, $tryMark, $assignRecord, $recordBinding, $unknown, $importMeta, $dynamicImport, $tryTakeSince, $tryCurrentMark, $tryPopMark, $tryDigestSoftCatch, $tryReleaseSoftOut, $tryDetachSoftCatch, $tryDiscardSoft, $tryOrphanSoft, $pushLoopExit, $objRest, $arrRest, $elems, $arguments, $isForkExit, $rawThis, $isBreakTo, $yieldStar, $tpl } from ${JSON.stringify(runtime)};`,
|
|
9485
|
+
`import { $absVal, $add, $sub, $mul, $div, $mod, $bitand, $bitor, $bitxor, $bitnot, $shl, $shr, $ushr, $pow, $toNumber, $toNumeric, $updateAdd, $updateSub, $in, $instanceof, $instanceofNonIdent, $classExpr, $del, $delRes, $objAccessor, $objAccessorKey, $neg, $typeof, $not, $eq, $ne, $eqLoose, $neLoose, $lt, $le, $gt, $ge, $join, $lit, $fork, $for, $forIter, $obj, $get, $set, $setProto, $while, $whileSeq, $arr, $arrWithHoles, $arrMutContainer, $idx, $idxSet, $len, $call, $throw, $loopReturn, $loopBreak, $loopContinue, $class, $new, $invoke, $invokeSuper, $invokeSuperObj, $invokeSuperKey, $getSuper, $getSuperObj, $super, $async, $copy, $await, $asyncReturn, $orDefault, $callNamed, $optionalGet, $optionalInvoke, $spread, $concat, $forOf, $forInKeys, $iterCheck, $catchVal, $switch, $staticInvoke, $setKey, $gen, $newTarget, $staticInit, $yield, $fnVal, $regex, $reStateCall, $rethrowIfNudoReturn, $nullishTest, $removeNullish, $removeNull, $removeUndefined, $removeMemberNullish, $narrowTypeOf, $tryMark, $assignRecord, $recordBinding, $unknown, $importMeta, $dynamicImport, $tryTakeSince, $tryCurrentMark, $tryPopMark, $tryDigestSoftCatch, $tryReleaseSoftOut, $tryDetachSoftCatch, $tryDiscardSoft, $tryOrphanSoft, $pushLoopExit, $objRest, $arrRest, $elems, $arguments, $isForkExit, $rawThis, $isBreakTo, $yieldStar, $tpl } from ${JSON.stringify(runtime)};`,
|
|
9445
9486
|
``
|
|
9446
9487
|
];
|
|
9447
9488
|
if (varHoistLine) lines.push(varHoistLine);
|
|
@@ -9537,6 +9578,7 @@ __export(runtime_exports, {
|
|
|
9537
9578
|
$pushLoopExit: () => $pushLoopExit,
|
|
9538
9579
|
$rawThis: () => $rawThis,
|
|
9539
9580
|
$regex: () => $regex,
|
|
9581
|
+
$removeMemberNullish: () => $removeMemberNullish,
|
|
9540
9582
|
$removeNull: () => $removeNull,
|
|
9541
9583
|
$removeNullish: () => $removeNullish,
|
|
9542
9584
|
$removeUndefined: () => $removeUndefined,
|
|
@@ -13282,6 +13324,28 @@ function $removeUndefined(a) {
|
|
|
13282
13324
|
}
|
|
13283
13325
|
return a;
|
|
13284
13326
|
}
|
|
13327
|
+
function $removeMemberNullish(a, key) {
|
|
13328
|
+
if (!a || typeof a !== "object" || !("shape" in a)) return a;
|
|
13329
|
+
if (a.shape.k !== "obj") return a;
|
|
13330
|
+
const slots = a.shape.slots;
|
|
13331
|
+
if (!Object.prototype.hasOwnProperty.call(slots, key)) return a;
|
|
13332
|
+
const slot = slots[key];
|
|
13333
|
+
let value = slot.value;
|
|
13334
|
+
let changed = false;
|
|
13335
|
+
if (!definitelyNotNullishShape(value.shape) && value.shape.k === "sum") {
|
|
13336
|
+
const members = value.shape.members;
|
|
13337
|
+
const kept = members.filter((m) => !isNullishLitAbs(m));
|
|
13338
|
+
if (kept.length > 0 && kept.length < members.length) {
|
|
13339
|
+
value = kept.length === 1 ? kept[0] : { ...value, shape: { k: "sum", members: kept } };
|
|
13340
|
+
changed = true;
|
|
13341
|
+
}
|
|
13342
|
+
}
|
|
13343
|
+
if (slot.optional) changed = true;
|
|
13344
|
+
if (!changed) return a;
|
|
13345
|
+
const next = { ...slot, value };
|
|
13346
|
+
delete next.optional;
|
|
13347
|
+
return { ...a, shape: { ...a.shape, slots: { ...slots, [key]: next } } };
|
|
13348
|
+
}
|
|
13285
13349
|
function typeofOfMember(m) {
|
|
13286
13350
|
const t = m.term;
|
|
13287
13351
|
if (t?.op === "lit") {
|
|
@@ -20315,7 +20379,12 @@ function isKnownNonBigintNumeric2(a) {
|
|
|
20315
20379
|
if (a.term?.op === "lit" && a.term.value === void 0) return true;
|
|
20316
20380
|
return a.shape.k === "prim" && (a.shape.type === "number" || a.shape.type === "boolean");
|
|
20317
20381
|
}
|
|
20382
|
+
function isNullishLitOperand2(a) {
|
|
20383
|
+
const r = litValue(a);
|
|
20384
|
+
return r.ok && (r.value === null || r.value === void 0);
|
|
20385
|
+
}
|
|
20318
20386
|
function isMaybeBigintOperand2(a) {
|
|
20387
|
+
if (isNullishLitOperand2(a)) return false;
|
|
20319
20388
|
const k = a.shape.k;
|
|
20320
20389
|
if (k === "sum") {
|
|
20321
20390
|
const members = a.shape.members;
|
|
@@ -21332,6 +21401,7 @@ export {
|
|
|
21332
21401
|
$removeNullish,
|
|
21333
21402
|
$removeNull,
|
|
21334
21403
|
$removeUndefined,
|
|
21404
|
+
$removeMemberNullish,
|
|
21335
21405
|
$narrowTypeOf,
|
|
21336
21406
|
$nullishTest,
|
|
21337
21407
|
clearPureCallMemo,
|
package/dist/exec.d.ts
CHANGED
|
@@ -466,6 +466,16 @@ declare function $removeNull(a: Abs): Abs;
|
|
|
466
466
|
* null,`u.v` 对 null 仍原生抛 TypeError,不得剪)。
|
|
467
467
|
*/
|
|
468
468
|
declare function $removeUndefined(a: Abs): Abs;
|
|
469
|
+
/**
|
|
470
|
+
* 成员真值守卫臂剪影(issue #118):`if (o.p)` 真值臂 / `if (!o.p)` 假值臂 /
|
|
471
|
+
* `o?.p` 真值守卫里,槽 p 的值必为真值 ⇒ 非 nullish 且槽必在场——重建 obj
|
|
472
|
+
* slots:槽值过与 $removeNullish 同款成员剥离,并摘除 optional 标记
|
|
473
|
+
* (真值 ⇒ 在场;$get 的 join(value, undef) 随之消失)。槽值剥空(纯
|
|
474
|
+
* nullish)→ 保守原样(臂不可达近似,与 $removeNullish 空集口径一致);
|
|
475
|
+
* 键缺席 / 非 obj / 裸宿主值 → 透传(同 $removeNullish 契约)。真值 ⇒ 非
|
|
476
|
+
* nullish 是 sound 下界:0/''/false 等 falsy-but-not-nullish 成员保留。
|
|
477
|
+
*/
|
|
478
|
+
declare function $removeMemberNullish(a: Abs, key: string): Abs;
|
|
469
479
|
/**
|
|
470
480
|
* typeof 类型守卫臂剪影(Bug 23):`typeof v === "string"` 真臂把 v 重绑为
|
|
471
481
|
* union 中 typeof 匹配的成员(keep=true)/ 假臂绑补集(keep=false)——臂内
|
|
@@ -744,4 +754,4 @@ declare class NudoUnsupportedError extends Error {
|
|
|
744
754
|
detail?: string);
|
|
745
755
|
}
|
|
746
756
|
|
|
747
|
-
export { $absVal, $add, $arguments, $arr, $arrMutContainer, $arrRest, $arrWithHoles, $async, $asyncReturn, $await, $bitand, $bitnot, $bitor, $bitxor, $catchVal, $class, $classExpr, $collectionForEach, $concat, $copy, $del, $delRes, $div, $dynamicImport, $elems, $eq, $eqLoose, $fnVal, $for, $forInKeys, $forIter, $forOf, $fork, $ge, $gen, $get, $getSuper, $getSuperObj, $gt, $idx, $idxSet, $importMeta, $in, $instanceof, $instanceofNonIdent, $invoke, $invokeSuper, $invokeSuperKey, $invokeSuperObj, $isBreakTo, $isForkExit, $iterCheck, $join, $le, $len, $lit, $loopBreak, $loopContinue, $loopReturn, $lt, $mod, $mul, $narrowTypeOf, $ne, $neLoose, $neg, $new, $newTarget, $not, $nullishTest, $obj, $objAccessor, $objAccessorKey, $objRest, $optionalGet, $optionalInvoke, $orDefault, $pow, $pushLoopExit, $rawThis, $reStateCall, $regex, $removeNull, $removeNullish, $removeUndefined, $rethrowIfNudoReturn, $set, $setKey, $setProto, $shl, $shr, $spread, $staticInit, $staticInvoke, $sub, $super, $switch, $thisGet, $thisSet, $throw, $toNumber, $toNumeric, $tpl, $tryCurrentMark, $tryDetachSoftCatch, $tryDigestSoftCatch, $tryDiscardSoft, $tryMark, $tryOrphanSoft, $tryPopMark, $tryReleaseSoftCatch, $tryReleaseSoftOut, $tryTakeSince, $typeof, $unknown, $updateAdd, $updateSub, $ushr, $while, $whileSeq, $yield, $yieldStar, DEFAULT_MAX_LOOP_ITERS, type EvalClassSpec, NudoLoopSignal, NudoReturn, NudoThrow, NudoUnsupportedError, type TranspileOptions, asAbsVal, callAtFunctionBoundary, clearBClasses, clearStaleTermPred, currentExecPhi, fillTuple, foldRequireSpecArg, foldStaticStringExpr, getEvalClass, isArrMutator, isDefinitelyFalse, isDefinitelyTrue, isNudoBreak, isNudoContinue, isNudoReturn, isNudoThrow, litTruth, lookupObjAccessor, namespaceNameOf, pushLoopExit, pushThrowExit, registerEvalClass, runWithLoopExits, runtimeImportOf, takeLoopExits, takeThrowExits, transpile, transpileBodyNode, transpileExpression, transpileFile, transpileSource, withExecPhi };
|
|
757
|
+
export { $absVal, $add, $arguments, $arr, $arrMutContainer, $arrRest, $arrWithHoles, $async, $asyncReturn, $await, $bitand, $bitnot, $bitor, $bitxor, $catchVal, $class, $classExpr, $collectionForEach, $concat, $copy, $del, $delRes, $div, $dynamicImport, $elems, $eq, $eqLoose, $fnVal, $for, $forInKeys, $forIter, $forOf, $fork, $ge, $gen, $get, $getSuper, $getSuperObj, $gt, $idx, $idxSet, $importMeta, $in, $instanceof, $instanceofNonIdent, $invoke, $invokeSuper, $invokeSuperKey, $invokeSuperObj, $isBreakTo, $isForkExit, $iterCheck, $join, $le, $len, $lit, $loopBreak, $loopContinue, $loopReturn, $lt, $mod, $mul, $narrowTypeOf, $ne, $neLoose, $neg, $new, $newTarget, $not, $nullishTest, $obj, $objAccessor, $objAccessorKey, $objRest, $optionalGet, $optionalInvoke, $orDefault, $pow, $pushLoopExit, $rawThis, $reStateCall, $regex, $removeMemberNullish, $removeNull, $removeNullish, $removeUndefined, $rethrowIfNudoReturn, $set, $setKey, $setProto, $shl, $shr, $spread, $staticInit, $staticInvoke, $sub, $super, $switch, $thisGet, $thisSet, $throw, $toNumber, $toNumeric, $tpl, $tryCurrentMark, $tryDetachSoftCatch, $tryDigestSoftCatch, $tryDiscardSoft, $tryMark, $tryOrphanSoft, $tryPopMark, $tryReleaseSoftCatch, $tryReleaseSoftOut, $tryTakeSince, $typeof, $unknown, $updateAdd, $updateSub, $ushr, $while, $whileSeq, $yield, $yieldStar, DEFAULT_MAX_LOOP_ITERS, type EvalClassSpec, NudoLoopSignal, NudoReturn, NudoThrow, NudoUnsupportedError, type TranspileOptions, asAbsVal, callAtFunctionBoundary, clearBClasses, clearStaleTermPred, currentExecPhi, fillTuple, foldRequireSpecArg, foldStaticStringExpr, getEvalClass, isArrMutator, isDefinitelyFalse, isDefinitelyTrue, isNudoBreak, isNudoContinue, isNudoReturn, isNudoThrow, litTruth, lookupObjAccessor, namespaceNameOf, pushLoopExit, pushThrowExit, registerEvalClass, runWithLoopExits, runtimeImportOf, takeLoopExits, takeThrowExits, transpile, transpileBodyNode, transpileExpression, transpileFile, transpileSource, withExecPhi };
|
package/dist/exec.js
CHANGED
|
@@ -86,6 +86,7 @@ import {
|
|
|
86
86
|
$reStateCall,
|
|
87
87
|
$recordBinding,
|
|
88
88
|
$regex,
|
|
89
|
+
$removeMemberNullish,
|
|
89
90
|
$removeNull,
|
|
90
91
|
$removeNullish,
|
|
91
92
|
$removeUndefined,
|
|
@@ -192,7 +193,7 @@ import {
|
|
|
192
193
|
tryRunTranspiled,
|
|
193
194
|
withEvalBudgetOverride,
|
|
194
195
|
withExecPhi
|
|
195
|
-
} from "./chunk-
|
|
196
|
+
} from "./chunk-MJP4P5J3.js";
|
|
196
197
|
export {
|
|
197
198
|
$absVal,
|
|
198
199
|
$add,
|
|
@@ -280,6 +281,7 @@ export {
|
|
|
280
281
|
$reStateCall,
|
|
281
282
|
$recordBinding,
|
|
282
283
|
$regex,
|
|
284
|
+
$removeMemberNullish,
|
|
283
285
|
$removeNull,
|
|
284
286
|
$removeNullish,
|
|
285
287
|
$removeUndefined,
|
package/dist/index.js
CHANGED
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
takeRefineDiagsSince,
|
|
92
92
|
throwConstraintToKinds,
|
|
93
93
|
union
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-45WFXDZD.js";
|
|
95
95
|
import {
|
|
96
96
|
$add,
|
|
97
97
|
$arguments,
|
|
@@ -513,7 +513,7 @@ import {
|
|
|
513
513
|
v,
|
|
514
514
|
withExecPhi,
|
|
515
515
|
withVar
|
|
516
|
-
} from "./chunk-
|
|
516
|
+
} from "./chunk-MJP4P5J3.js";
|
|
517
517
|
|
|
518
518
|
// src/environment.ts
|
|
519
519
|
function createEnvironment(parent, bindings = /* @__PURE__ */ new Map()) {
|
|
@@ -786,6 +786,15 @@ function flattenSumArms(ret) {
|
|
|
786
786
|
function isWidenedSumArm(m, parent) {
|
|
787
787
|
return parent.conf === "partial" && m.shape.k === "prim" && !m.term && (!m.pred || m.pred.op === "true");
|
|
788
788
|
}
|
|
789
|
+
function provesBarePrimDomain(arm, constraint) {
|
|
790
|
+
if (!constraint.prim || constraint.preds.length > 0 || isIntFlag(constraint)) {
|
|
791
|
+
return false;
|
|
792
|
+
}
|
|
793
|
+
if (constraint.fields || constraint.element || constraint.members || constraint.fn) {
|
|
794
|
+
return false;
|
|
795
|
+
}
|
|
796
|
+
return arm.shape.k === "prim" && arm.shape.type === constraint.prim;
|
|
797
|
+
}
|
|
789
798
|
function assertImplies(ret, constraint, opts) {
|
|
790
799
|
const phi = opts?.phi ?? pTrue;
|
|
791
800
|
if (ret.shape.k === "never") return proved();
|
|
@@ -820,6 +829,9 @@ function assertSumArms(arms, parent, constraint, opts, phi) {
|
|
|
820
829
|
continue;
|
|
821
830
|
}
|
|
822
831
|
if (isValueSetUnknown(arm) || isWidenedSumArm(arm, parent)) {
|
|
832
|
+
if (isWidenedSumArm(arm, parent) && provesBarePrimDomain(arm, constraint)) {
|
|
833
|
+
continue;
|
|
834
|
+
}
|
|
823
835
|
sawUnprovable = true;
|
|
824
836
|
continue;
|
|
825
837
|
}
|
package/dist/internal.js
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
stableAnalyzeKeySource,
|
|
22
22
|
stablePathKey,
|
|
23
23
|
stablePathKeyGraph
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-45WFXDZD.js";
|
|
25
25
|
import {
|
|
26
26
|
$tryDigestSoft,
|
|
27
27
|
$tryMarkSoft,
|
|
@@ -169,7 +169,7 @@ import {
|
|
|
169
169
|
withEvalBudgetOverride,
|
|
170
170
|
withFnBudgetOverride,
|
|
171
171
|
wrapPromise
|
|
172
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-MJP4P5J3.js";
|
|
173
173
|
|
|
174
174
|
// src/algebra/inlay.ts
|
|
175
175
|
function listFunctions(source) {
|