@scriptc/compiler 0.1.5 → 0.1.6
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/c/exprs.js +36 -8
- package/dist/backend/c/exprs.js.map +1 -1
- package/dist/backend/llvm/expr-containers.js +28 -2
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +8 -0
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +4 -3
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +1 -0
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/coverage/surface-manifest.js +6 -1
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/frontend/lowering/array-indexed-mutation.d.ts +8 -0
- package/dist/frontend/lowering/array-indexed-mutation.js +176 -0
- package/dist/frontend/lowering/array-indexed-mutation.js.map +1 -0
- package/dist/frontend/lowering/containers/string-and-regexp.d.ts +7 -0
- package/dist/frontend/lowering/containers/string-and-regexp.js +190 -13
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/indexed-comparison.d.ts +6 -0
- package/dist/frontend/lowering/indexed-comparison.js +30 -0
- package/dist/frontend/lowering/indexed-comparison.js.map +1 -0
- package/dist/frontend/lowering/lower-builtins.d.ts +1 -1
- package/dist/frontend/lowering/lower-builtins.js +6 -6
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +266 -10
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +3 -27
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.d.ts +8 -2
- package/dist/frontend/lowering/lower-containers.js +454 -104
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +18 -2
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +2 -0
- package/dist/frontend/lowering/surfaces.js +13 -1
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/ir/ir.d.ts +15 -2
- package/dist/ir/ir.js +2 -0
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/validate.js +43 -26
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +17 -0
- package/dist/ir/validate.test.js.map +1 -1
- package/package.json +17 -17
- package/surface-manifest.json +36 -4
|
@@ -10,7 +10,7 @@ import { MAX_GENERIC_INSTANCES, appendImplicitUndefinedReturn, generatorMeta, ge
|
|
|
10
10
|
import { isGenericCallableMemberType, typeKey } from "../type-mapper.js";
|
|
11
11
|
import { cjsClassExprWholeExportOf, isCjsJsFile, isJsSourceFile, isModuleExportsAccess, isNodeTypesPath, locOf } from "../program.js";
|
|
12
12
|
import { PoisonError, dynFallbackType, dynUndefinedExpr, newFnCtx, own } from "./lowerer.js";
|
|
13
|
-
import { lowerMapSeedArrayNew } from "./lower-containers.js";
|
|
13
|
+
import { lowerArrayConstructor, lowerMapSeedArrayNew } from "./lower-containers.js";
|
|
14
14
|
import { bufEncoding } from "./containers/bytes.js";
|
|
15
15
|
import { isSafeToRepeat } from "./expressions/evaluation-safety.js";
|
|
16
16
|
import { lowerSearchParamsNew } from "./lower-builtins.js";
|
|
@@ -4660,12 +4660,7 @@ export function lowerNew(lowerer, expr) {
|
|
|
4660
4660
|
// the fence: never silently an empty map. Unsupported key/value
|
|
4661
4661
|
// types get their half named specifically instead of the component
|
|
4662
4662
|
// fence (SC2009, which names Map slots at value positions elsewhere).
|
|
4663
|
-
//
|
|
4664
|
-
// any argument list that is not one lone number) ARE array literals
|
|
4665
|
-
// — the spec's ArrayCreate + element writes. The one-NUMBER form
|
|
4666
|
-
// allocates a HOLE array (reads answer undefined where the element
|
|
4667
|
-
// type says T) — no honest lowering exists unless the element type
|
|
4668
|
-
// admits undefined, so it fences by name.
|
|
4663
|
+
// Both Array() and new Array() share the elements/count lowering.
|
|
4669
4664
|
// `new Object()` — the spec's OrdinaryObjectCreate, exactly what the
|
|
4670
4665
|
// `{}` literal builds (fresh reference identity, no own properties) —
|
|
4671
4666
|
// lowers as the empty record. The ARGUMENT form is Object(x): it
|
|
@@ -4682,26 +4677,7 @@ export function lowerNew(lowerer, expr) {
|
|
|
4682
4677
|
};
|
|
4683
4678
|
}
|
|
4684
4679
|
if (symbol?.name === "Array" && lowerer.isStdlibSymbol(symbol)) {
|
|
4685
|
-
|
|
4686
|
-
if (args.some(ts.isSpreadElement)) {
|
|
4687
|
-
lowerer.noLowering("new Array with spread arguments", expr, "write the array literal: [...xs]");
|
|
4688
|
-
}
|
|
4689
|
-
if (args.length === 1 && lowerer.mapTypeOf(lowerer.typeOf(args[0]))?.kind === "f64") {
|
|
4690
|
-
lowerer.noLowering("new Array(count)", expr, "the one-number form allocates HOLES (reads answer undefined, which the element type cannot carry) — build and push, or use the elements form: new Array(a, b)");
|
|
4691
|
-
}
|
|
4692
|
-
let t = lowerer.mapTypeOf(lowerer.typeOf(expr));
|
|
4693
|
-
// JS's `new Array()` types any[]; the contextual type carries the
|
|
4694
|
-
// annotation when one exists (the new Map() stance).
|
|
4695
|
-
if (t?.kind !== "array") {
|
|
4696
|
-
const ctx = lowerer.checker.getContextualType(expr);
|
|
4697
|
-
const ctxMapped = ctx ? lowerer.mapTypeOf(ctx) : null;
|
|
4698
|
-
if (ctxMapped?.kind === "array")
|
|
4699
|
-
t = ctxMapped;
|
|
4700
|
-
}
|
|
4701
|
-
if (t?.kind !== "array")
|
|
4702
|
-
lowerer.badType(expr, lowerer.typeOf(expr));
|
|
4703
|
-
const elems = args.map((a) => lowerer.lowerExprExpecting(a, t.elem));
|
|
4704
|
-
return { kind: "arrayLit", elems, type: t, loc };
|
|
4680
|
+
return lowerArrayConstructor(lowerer, expr, expr.arguments ?? []);
|
|
4705
4681
|
}
|
|
4706
4682
|
if (symbol?.name === "Map" && lowerer.isStdlibSymbol(symbol)) {
|
|
4707
4683
|
const seedArg = (expr.arguments?.length ?? 0) === 1 ? expr.arguments[0] : null;
|