@scriptc/compiler 0.0.30 → 0.0.31
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/frontend/lowering/lower-calls.js +5 -4
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.js +12 -2
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +32 -24
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +3 -2
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +26 -7
- package/dist/frontend/lowering/lowerer.js +56 -11
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/package.json +2 -2
- package/surface-manifest.json +1 -1
|
@@ -4389,8 +4389,9 @@ function lowerArrayIsArrayCall(L, call, access) {
|
|
|
4389
4389
|
}
|
|
4390
4390
|
if (arg.type.kind === "union") {
|
|
4391
4391
|
// A union answers by its RUNTIME TAG: true iff the active arm is an
|
|
4392
|
-
// array
|
|
4393
|
-
// is false in JS too). One
|
|
4392
|
+
// array value (homogeneous array or fixed tuple; bytes arms answer
|
|
4393
|
+
// false — Array.isArray(new Uint8Array) is false in JS too). One
|
|
4394
|
+
// array arm compiles to the plain tag test
|
|
4394
4395
|
// (`Array.isArray(tlds)` on `string | readonly string[]` — the
|
|
4395
4396
|
// narrowing test tsc's control flow then builds on); several array
|
|
4396
4397
|
// arms OR their tag tests, and zero arms fold to false — both only
|
|
@@ -4399,7 +4400,7 @@ function lowerArrayIsArrayCall(L, call, access) {
|
|
|
4399
4400
|
// static tag answer and keep the narrow-first fence.
|
|
4400
4401
|
const def = L.unions.get(arg.type.unionId);
|
|
4401
4402
|
const opaque = !def || def.arms.some((a) => a.kind === "dyn" || a.kind === "caught" || a.kind === "jsval");
|
|
4402
|
-
const arrayTags =
|
|
4403
|
+
const arrayTags = L.arrayValueTags(arg.type.unionId);
|
|
4403
4404
|
const freeRead = arg.kind === "varRef" || arg.kind === "recordGet" || arg.kind === "fieldGet";
|
|
4404
4405
|
if (!opaque && arrayTags.length === 1) {
|
|
4405
4406
|
return { kind: "unionIsTag", unionId: arg.type.unionId, tag: arrayTags[0], negated: false, value: arg, type: BOOL, loc };
|
|
@@ -4417,7 +4418,7 @@ function lowerArrayIsArrayCall(L, call, access) {
|
|
|
4417
4418
|
if (arg.type.kind === "jsval" || arg.type.kind === "caught")
|
|
4418
4419
|
return null;
|
|
4419
4420
|
if (arg.kind === "varRef" || arg.kind === "recordGet" || arg.kind === "fieldGet") {
|
|
4420
|
-
return { kind: "boolLit", value: arg.type
|
|
4421
|
+
return { kind: "boolLit", value: L.isArrayValueType(arg.type), type: BOOL, loc };
|
|
4421
4422
|
}
|
|
4422
4423
|
L.unsupported("SC1090", call, "statically-decided Array.isArray on computed arguments (bind the value to a variable first)");
|
|
4423
4424
|
}
|