@scriptc/compiler 0.0.22 → 0.0.24
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/ambient/scriptc-node-fallback.d.ts +139 -14
- package/dist/backend/cc.d.ts +13 -0
- package/dist/backend/cc.js +11 -0
- package/dist/backend/cc.js.map +1 -1
- package/dist/backend/emission/emit-async.d.ts +4 -0
- package/dist/backend/emission/emit-async.js +34 -2
- package/dist/backend/emission/emit-async.js.map +1 -1
- package/dist/backend/emission/emit-exprs.d.ts +10 -0
- package/dist/backend/emission/emit-exprs.js +272 -22
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/emission/emit-shapes.js +1 -0
- package/dist/backend/emission/emit-shapes.js.map +1 -1
- package/dist/backend/emission/emit-stmts.js +36 -9
- package/dist/backend/emission/emit-stmts.js.map +1 -1
- package/dist/backend/emission/emit-types.js +14 -1
- package/dist/backend/emission/emit-types.js.map +1 -1
- package/dist/backend/emission/emitter.d.ts +19 -1
- package/dist/backend/emission/emitter.js +81 -2
- package/dist/backend/emission/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.js +578 -36
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/shapes.js +12 -3
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/mangle.d.ts +3 -0
- package/dist/backend/mangle.js +5 -0
- package/dist/backend/mangle.js.map +1 -1
- package/dist/compat/fetch-profile.d.ts +10 -0
- package/dist/compat/fetch-profile.js +55 -6
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/coverage/surface-manifest.js +16 -1
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +10 -0
- package/dist/diagnostics/diagnostic.js +27 -1
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/frontend/lowering/lower-builtins.d.ts +17 -16
- package/dist/frontend/lowering/lower-builtins.js +817 -117
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +3 -1
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +28 -8
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.d.ts +2 -1
- package/dist/frontend/lowering/lower-containers.js +99 -32
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +1 -1
- package/dist/frontend/lowering/lower-exprs.js +78 -6
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.js +7 -1
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +59 -1
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +21 -0
- package/dist/frontend/lowering/lower-island.js +284 -10
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +5 -0
- package/dist/frontend/lowering/lower-server.js +1 -1
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +6 -2
- package/dist/frontend/lowering/lower-stmts.js +53 -14
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +3 -2
- package/dist/frontend/lowering/lowerer.js +17 -8
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/surfaces.js +108 -25
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/program.d.ts +4 -4
- package/dist/frontend/program.js +264 -46
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.d.ts +10 -0
- package/dist/frontend/resolve.js +37 -0
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/ts7/enums.d.ts +9 -0
- package/dist/frontend/ts7/enums.js +8 -6
- package/dist/frontend/ts7/enums.js.map +1 -1
- package/dist/frontend/ts7/program.js +4 -1
- package/dist/frontend/ts7/program.js.map +1 -1
- package/dist/frontend/types.d.ts +7 -4
- package/dist/frontend/types.js +103 -8
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/ir/integer-loops.d.ts +23 -0
- package/dist/ir/integer-loops.js +82 -0
- package/dist/ir/integer-loops.js.map +1 -0
- package/dist/ir/nodes.d.ts +104 -28
- package/dist/ir/nodes.js +89 -1
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/validate.js +136 -25
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/fence-eval.js +4 -3
- package/dist/library/fence-eval.js.map +1 -1
- package/package.json +2 -2
- package/surface-manifest.json +186 -29
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* accessor access, upcasts, `new` expressions, and the builtin Error
|
|
5
5
|
* hierarchy registration. */
|
|
6
6
|
import * as ts from "../ts7/adapter.js";
|
|
7
|
-
import { BOOL, DYN, F64, bytesOf, JSVAL, RUNTIME_EMITTER_CLASS, RUNTIME_ERROR_CLASSES, RUNTIME_STREAM_CLASSES, STRING, UNDEFINED_T, URL_T, VOID, arrayOf, isSupportedMapKey, isUnitType, typeEquals } from "../../ir/nodes.js";
|
|
7
|
+
import { BOOL, DATE_T, DYN, F64, bytesOf, JSVAL, RUNTIME_EMITTER_CLASS, RUNTIME_ERROR_CLASSES, RUNTIME_STREAM_CLASSES, STRING, UNDEFINED_T, URL_T, VOID, arrayOf, isSupportedMapKey, isUnitType, typeEquals } from "../../ir/nodes.js";
|
|
8
8
|
import { MAX_GENERIC_INSTANCES, genericCallInstance, implicitAnyParamSymbolsOf, implicitCallInstance, implicitMonoFile, omittedArgFor } from "./lower-calls.js";
|
|
9
9
|
import { isGenericCallableMemberType, typeKey } from "../types.js";
|
|
10
10
|
import { cjsClassExprWholeExportOf, isCjsJsFile, isJsSourceFile, isModuleExportsAccess, isNodeTypesPath, locOf } from "../program.js";
|
|
@@ -279,7 +279,7 @@ export function builtinStreamInfoOf(L, symbol) {
|
|
|
279
279
|
* level (undefined until the write runs, Node-exact). Null when the
|
|
280
280
|
* inference is unmappable, checked-dynamic (dyn stays out of class
|
|
281
281
|
* fields — KEEP NARROW), or an arm-less kind that cannot join a union
|
|
282
|
-
* (genResultRecord's list). */
|
|
282
|
+
* (genResultRecord's list, including scalar-backed Date values). */
|
|
283
283
|
function undefArmedFieldType(L, p) {
|
|
284
284
|
const t = L.checker.getTypeOfSymbol(p);
|
|
285
285
|
const mapped = L.mapTypeOf(t);
|
|
@@ -288,7 +288,8 @@ function undefArmedFieldType(L, p) {
|
|
|
288
288
|
const byKey = new Map();
|
|
289
289
|
const arms = mapped.kind === "union" ? (L.unions.get(mapped.unionId)?.arms ?? []) : [mapped];
|
|
290
290
|
for (const a of arms) {
|
|
291
|
-
if (a.kind === "map" || a.kind === "regex" || a.kind === "
|
|
291
|
+
if (a.kind === "map" || a.kind === "regex" || a.kind === "date" ||
|
|
292
|
+
a.kind === "jsval" || a.kind === "generator") {
|
|
292
293
|
return null;
|
|
293
294
|
}
|
|
294
295
|
byKey.set(typeKey(a), a);
|
|
@@ -1601,7 +1602,8 @@ mixin) {
|
|
|
1601
1602
|
const declared = fields.get(f.name);
|
|
1602
1603
|
const armable = declared !== undefined && !isUnitType(declared) &&
|
|
1603
1604
|
declared.kind !== "union" && declared.kind !== "jsval" && declared.kind !== "dyn" &&
|
|
1604
|
-
declared.kind !== "map" && declared.kind !== "
|
|
1605
|
+
declared.kind !== "map" && declared.kind !== "date" && declared.kind !== "generator" &&
|
|
1606
|
+
declared.kind !== "void" &&
|
|
1605
1607
|
declared.kind !== "caught";
|
|
1606
1608
|
const armed = armable ? L.withUndefinedArm(declared) : null;
|
|
1607
1609
|
if (armed !== null && armed.kind === "union") {
|
|
@@ -4499,11 +4501,29 @@ export function lowerNew(L, expr) {
|
|
|
4499
4501
|
if (symbol && symbol.name === "URLSearchParams" && L.isStdlibSymbol(symbol)) {
|
|
4500
4502
|
return lowerSearchParamsNew(L, expr, loc);
|
|
4501
4503
|
}
|
|
4502
|
-
//
|
|
4503
|
-
//
|
|
4504
|
-
//
|
|
4504
|
+
// Date's read-only value slice: store the constructor's TimeClip'd
|
|
4505
|
+
// epoch milliseconds as the scalar date kind. That is sufficient
|
|
4506
|
+
// for every getter and toISOString; identity and setters stay
|
|
4507
|
+
// fenced, so copying the scalar cannot create an observable lie.
|
|
4505
4508
|
if (symbol && symbol.name === "Date" && L.isStdlibSymbol(symbol)) {
|
|
4506
|
-
|
|
4509
|
+
const args = expr.arguments ?? [];
|
|
4510
|
+
if (args.some(ts.isSpreadElement) || args.length > 1) {
|
|
4511
|
+
L.noLowering(`new Date with ${args.length} arguments`, expr, "new Date(), new Date(milliseconds), and new Date(dateString) are supported; the local-time year/month field constructor has no lowering", symbol);
|
|
4512
|
+
}
|
|
4513
|
+
if (args.length === 0) {
|
|
4514
|
+
return { kind: "libCall", fn: "date.newNow", args: [], type: DATE_T, loc };
|
|
4515
|
+
}
|
|
4516
|
+
const arg = L.lowerExpr(args[0]);
|
|
4517
|
+
if (arg.type.kind === "f64") {
|
|
4518
|
+
return { kind: "libCall", fn: "date.newMs", args: [arg], type: DATE_T, loc };
|
|
4519
|
+
}
|
|
4520
|
+
if (arg.type.kind === "string") {
|
|
4521
|
+
return { kind: "libCall", fn: "date.newString", args: [arg], type: DATE_T, loc };
|
|
4522
|
+
}
|
|
4523
|
+
if (arg.type.kind === "date") {
|
|
4524
|
+
return arg;
|
|
4525
|
+
}
|
|
4526
|
+
L.noLowering(`new Date of '${L.fmt(arg.type)}' values`, args[0], "pass milliseconds, a date string, or another Date value", symbol);
|
|
4507
4527
|
}
|
|
4508
4528
|
// `new StringDecoder(encoding?)` (node:string_decoder): the decoder
|
|
4509
4529
|
// is a two-field record — the CANONICAL encoding name (aliases fold
|