@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
|
@@ -633,13 +633,23 @@ export function lowerTupleReadMethodCall(L, call, access) {
|
|
|
633
633
|
return null;
|
|
634
634
|
if (!L.isStdlibMember(access))
|
|
635
635
|
return null;
|
|
636
|
-
|
|
636
|
+
let receiverIr = L.mapTypeOf(L.typeOf(access.expression));
|
|
637
|
+
let receiver = null;
|
|
638
|
+
// A readonly tuple union under Array.isArray is checker-typed as an
|
|
639
|
+
// unmappable intersection with any[], while maybeNarrow still extracts
|
|
640
|
+
// its one tuple arm. Dispatch the supported tuple read methods from
|
|
641
|
+
// that lowered representation, like tuple indexing and `.length`.
|
|
642
|
+
const checkerArray = L.checkerArrayValue(access.expression);
|
|
643
|
+
if (checkerArray?.type.kind === "record") {
|
|
644
|
+
receiverIr = checkerArray.type;
|
|
645
|
+
receiver = checkerArray;
|
|
646
|
+
}
|
|
637
647
|
if (receiverIr?.kind !== "record")
|
|
638
648
|
return null;
|
|
639
649
|
const shape = L.shapes.get(receiverIr.shapeId);
|
|
640
650
|
if (!shape?.tuple)
|
|
641
651
|
return null;
|
|
642
|
-
|
|
652
|
+
receiver ??= L.lowerExpr(access.expression);
|
|
643
653
|
if (receiver.type.kind !== "record")
|
|
644
654
|
return null;
|
|
645
655
|
if (!pureReemittable(receiver)) {
|