@scriptc/compiler 0.0.5 → 0.0.7
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/backend/emission/emit-exprs.js +25 -2
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/emission/emit-walkers.js +47 -0
- package/dist/backend/emission/emit-walkers.js.map +1 -1
- package/dist/backend/emission/emitter.js +7 -0
- package/dist/backend/emission/emitter.js.map +1 -1
- package/dist/backend/emission/may-throw.js +12 -0
- package/dist/backend/emission/may-throw.js.map +1 -1
- package/dist/backend/llvm/dyn.js +23 -1
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.js +28 -4
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +5 -0
- package/dist/backend/llvm/walkers.js +65 -5
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +6 -0
- package/dist/diagnostics/diagnostic.js +16 -0
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/frontend/lib-contract.d.ts +96 -0
- package/dist/frontend/lib-contract.js +291 -0
- package/dist/frontend/lib-contract.js.map +1 -0
- package/dist/frontend/lowering/lower-assert.js +41 -1
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +19 -4
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +7 -0
- package/dist/frontend/lowering/lower-inspect.js +130 -28
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +9 -1
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +1 -1
- package/dist/frontend/lowering/lowerer.js +16 -6
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/types.d.ts +68 -6
- package/dist/frontend/types.js +285 -57
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.js +60 -1
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +27 -4
- package/dist/ir/nodes.js +105 -13
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/validate.js +10 -0
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/profile.d.ts +36 -0
- package/dist/library/profile.js +105 -3
- package/dist/library/profile.js.map +1 -1
- package/dist/library/sidecar-validate.d.ts +4 -0
- package/dist/library/sidecar-validate.js +506 -0
- package/dist/library/sidecar-validate.js.map +1 -0
- package/dist/library/sidecar.d.ts +191 -0
- package/dist/library/sidecar.js +568 -0
- package/dist/library/sidecar.js.map +1 -0
- package/dist/library/wyhash.d.ts +12 -0
- package/dist/library/wyhash.js +116 -0
- package/dist/library/wyhash.js.map +1 -0
- package/package.json +2 -2
- package/surface-manifest.json +1 -1
|
@@ -1744,10 +1744,25 @@ export function lowerUnitComparison(L, left, right, negated, loc) {
|
|
|
1744
1744
|
}
|
|
1745
1745
|
if (other.type.kind === "union") {
|
|
1746
1746
|
const tag = L.armTag(other.type.unionId, unit.type);
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1747
|
+
if (tag < 0) {
|
|
1748
|
+
// A union WITHOUT that unit arm: legal TS (`miss === null` on a
|
|
1749
|
+
// `number | undefined` — null/undefined guard comparisons are
|
|
1750
|
+
// permitted against nullable-adjacent types), and === never
|
|
1751
|
+
// coerces, so the answer is the constant `negated`. The literal
|
|
1752
|
+
// must NOT flow into the union representation (the unionEq
|
|
1753
|
+
// fallback would coerce it through the stranded-arm trap and
|
|
1754
|
+
// throw where Node answers false). JS still evaluates the
|
|
1755
|
+
// operand, so a non-droppable one (`xs.find(f) === null` — the
|
|
1756
|
+
// callback's effects are observable) rides one throwaway tag
|
|
1757
|
+
// test; droppable reads fold to the bare literal.
|
|
1758
|
+
const answer = { kind: "boolLit", value: negated, type: BOOL, loc };
|
|
1759
|
+
if (droppableStatic(other))
|
|
1760
|
+
return answer;
|
|
1761
|
+
const evalOnce = {
|
|
1762
|
+
kind: "unionIsTag", unionId: other.type.unionId, tag: 0, negated: false, value: other, type: BOOL, loc,
|
|
1763
|
+
};
|
|
1764
|
+
return { kind: "logical", op: negated ? "||" : "&&", left: evalOnce, right: answer, type: BOOL, loc };
|
|
1765
|
+
}
|
|
1751
1766
|
return {
|
|
1752
1767
|
kind: "unionIsTag",
|
|
1753
1768
|
unionId: other.type.unionId,
|