@scriptc/compiler 0.0.20 → 0.0.22
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 +78 -34
- package/dist/backend/cc-cache.test.d.ts +1 -0
- package/dist/backend/cc-cache.test.js +2507 -0
- package/dist/backend/cc-cache.test.js.map +1 -0
- package/dist/backend/cc.d.ts +69 -11
- package/dist/backend/cc.js +1937 -222
- package/dist/backend/cc.js.map +1 -1
- package/dist/backend/emission/emit-exprs.js +355 -8
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/emission/emit-walkers.js +108 -7
- package/dist/backend/emission/emit-walkers.js.map +1 -1
- package/dist/backend/emission/emitter.d.ts +16 -0
- package/dist/backend/emission/emitter.js +23 -2
- package/dist/backend/emission/emitter.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +1 -0
- package/dist/backend/llvm/dyn.js +305 -8
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.js +527 -2
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/compat/fetch-profile.d.ts +108 -0
- package/dist/compat/fetch-profile.js +482 -0
- package/dist/compat/fetch-profile.js.map +1 -0
- package/dist/coverage/surface-manifest.js +54 -0
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/frontend/lowering/lower-builtins.d.ts +21 -8
- package/dist/frontend/lowering/lower-builtins.js +137 -14
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +40 -0
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +4 -3
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +2 -2
- package/dist/frontend/lowering/lower-exprs.js +63 -12
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +102 -7
- package/dist/frontend/lowering/lower-island.js +1702 -26
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +17 -1
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +25 -5
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +39 -0
- package/dist/frontend/lowering/lowerer.js +286 -18
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/surfaces.js +12 -0
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/program.d.ts +16 -0
- package/dist/frontend/program.js +130 -6
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/types.d.ts +14 -7
- package/dist/frontend/types.js +95 -31
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +86 -20
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +32 -16
- package/dist/ir/nodes.js +36 -28
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/validate.js +61 -1
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/int-infer.d.ts +7 -12
- package/dist/library/int-infer.js +72 -30
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/int-infer.test.js +200 -1
- package/dist/library/int-infer.test.js.map +1 -1
- package/dist/library/profile.d.ts +7 -0
- package/dist/library/profile.js +2 -0
- package/dist/library/profile.js.map +1 -1
- package/dist/library/sidecar-validate.js +5 -0
- package/dist/library/sidecar-validate.js.map +1 -1
- package/dist/library/sidecar.d.ts +3 -0
- package/dist/library/sidecar.js +168 -30
- package/dist/library/sidecar.js.map +1 -1
- package/package.json +2 -2
- package/surface-manifest.json +859 -1
|
@@ -232,8 +232,8 @@ export declare function foldedStringKeyOf(L: Lowerer, expr: ts.Expression): stri
|
|
|
232
232
|
* dyn's String() for dyn operands — `{ [field]: v }` where field is a
|
|
233
233
|
* checked-dynamic param). Values convert through the usual dyn boundary
|
|
234
234
|
* (dynFrom's domain, functions box); a value with no dyn representation
|
|
235
|
-
* fences per property. Spreads
|
|
236
|
-
*
|
|
235
|
+
* fences per property. Spreads copy through dyn.assign in source order;
|
|
236
|
+
* accessors stay fenced. */
|
|
237
237
|
export declare function lowerDynObjectLiteral(L: Lowerer, expr: ts.ObjectLiteralExpression): IrExpr;
|
|
238
238
|
export declare function lowerObjectLiteral(L: Lowerer, expr: ts.ObjectLiteralExpression): IrExpr;
|
|
239
239
|
/** A conditional spread's carrier property: `name: value` or shorthand,
|
|
@@ -82,6 +82,15 @@ function lowerExprInner(L, expr) {
|
|
|
82
82
|
const chainRecv = L.chainRecvByNode.get(expr);
|
|
83
83
|
if (chainRecv)
|
|
84
84
|
return { ...chainRecv, loc };
|
|
85
|
+
// --external-types supplies CHECKER truth only. A value rooted in one
|
|
86
|
+
// of those declarations has no runtime implementation in scriptc, so
|
|
87
|
+
// every use fences at its expression instead of accidentally lowering
|
|
88
|
+
// as an ambient ReferenceError or a structural value. This keeps the
|
|
89
|
+
// rest of coverage measurable without overstating the host boundary.
|
|
90
|
+
const externalTypeSpecifier = L.externalTypeSpecifierOf(expr);
|
|
91
|
+
if (externalTypeSpecifier !== null) {
|
|
92
|
+
L.externalHostFence(externalTypeSpecifier, expr);
|
|
93
|
+
}
|
|
85
94
|
if (ts.isNumericLiteral(expr)) {
|
|
86
95
|
const value = Number(expr.text.replace(/_/g, ""));
|
|
87
96
|
// Ask 4's representability input: a DECIMAL INTEGER source spelling
|
|
@@ -1605,6 +1614,9 @@ function lowerExprInner(L, expr) {
|
|
|
1605
1614
|
// The lib fence's PROPERTY chokepoint: a stdlib-declared member that
|
|
1606
1615
|
// no lowering above claimed ([1,2].entries, Math.SQRT2, Promise.all,
|
|
1607
1616
|
// re.exec as a value, ...) reports SC2020 here.
|
|
1617
|
+
L.fenceStaticResponseMember(expr, "read");
|
|
1618
|
+
L.fenceStaticHeadersMember(expr, "read");
|
|
1619
|
+
L.fenceStaticReadableStreamMember(expr, "read");
|
|
1608
1620
|
L.stdlibMemberFence(expr);
|
|
1609
1621
|
// The npm chokepoint: a member on a package-typed receiver in a
|
|
1610
1622
|
// static build — attributed to the package, like every other site.
|
|
@@ -3360,9 +3372,11 @@ export function lowerArrayLiteral(L, expr, expected) {
|
|
|
3360
3372
|
let srcNode = el.expression;
|
|
3361
3373
|
while (ts.isParenthesizedExpression(srcNode))
|
|
3362
3374
|
srcNode = srcNode.expression;
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3375
|
+
L.fenceStaticHeadersIteration(el.expression);
|
|
3376
|
+
let src = L.lowerDynamicHeadersSpread(el.expression, type) ??
|
|
3377
|
+
(ts.isConditionalExpression(srcNode)
|
|
3378
|
+
? lowerTernary(L, srcNode, type)
|
|
3379
|
+
: L.lowerExpr(el.expression));
|
|
3366
3380
|
// `[...someSet]`: a same-element Set drains into a fresh array in
|
|
3367
3381
|
// insertion order (setIntrinsic toArray); the spread machinery
|
|
3368
3382
|
// then copies like any array source.
|
|
@@ -3639,14 +3653,36 @@ function propNameText(L, name) {
|
|
|
3639
3653
|
* dyn's String() for dyn operands — `{ [field]: v }` where field is a
|
|
3640
3654
|
* checked-dynamic param). Values convert through the usual dyn boundary
|
|
3641
3655
|
* (dynFrom's domain, functions box); a value with no dyn representation
|
|
3642
|
-
* fences per property. Spreads
|
|
3643
|
-
*
|
|
3656
|
+
* fences per property. Spreads copy through dyn.assign in source order;
|
|
3657
|
+
* accessors stay fenced. */
|
|
3644
3658
|
export function lowerDynObjectLiteral(L, expr) {
|
|
3645
3659
|
const loc = locOf(expr);
|
|
3646
|
-
|
|
3660
|
+
let fields = [];
|
|
3661
|
+
let acc = null;
|
|
3662
|
+
const flushFields = () => {
|
|
3663
|
+
if (fields.length === 0)
|
|
3664
|
+
return;
|
|
3665
|
+
const chunk = { kind: "dynObjLit", fields, type: DYN, loc };
|
|
3666
|
+
acc = acc === null
|
|
3667
|
+
? chunk
|
|
3668
|
+
: { kind: "libCall", fn: "dyn.assign", args: [acc, chunk], type: DYN, loc };
|
|
3669
|
+
fields = [];
|
|
3670
|
+
};
|
|
3647
3671
|
for (const prop of expr.properties) {
|
|
3648
|
-
if (
|
|
3649
|
-
|
|
3672
|
+
if (ts.isSpreadAssignment(prop)) {
|
|
3673
|
+
flushFields();
|
|
3674
|
+
const source = L.coerceToExpected(L.lowerExpr(prop.expression), DYN);
|
|
3675
|
+
if (source.type.kind !== "dyn") {
|
|
3676
|
+
L.unsupported("SC1101", prop.expression, `spreading '${L.fmt(source.type)}' into a checked-dynamic object literal`);
|
|
3677
|
+
}
|
|
3678
|
+
acc ??= { kind: "dynObjLit", fields: [], type: DYN, loc };
|
|
3679
|
+
acc = { kind: "libCall", fn: "dyn.assign", args: [acc, source], type: DYN, loc: locOf(prop) };
|
|
3680
|
+
continue;
|
|
3681
|
+
}
|
|
3682
|
+
if (!ts.isPropertyAssignment(prop) &&
|
|
3683
|
+
!ts.isShorthandPropertyAssignment(prop) &&
|
|
3684
|
+
!ts.isMethodDeclaration(prop)) {
|
|
3685
|
+
L.unsupported("SC1090", prop, "accessors in a runtime-keyed (computed-key) object literal");
|
|
3650
3686
|
}
|
|
3651
3687
|
const name = prop.name;
|
|
3652
3688
|
let key;
|
|
@@ -3675,16 +3711,23 @@ export function lowerDynObjectLiteral(L, expr) {
|
|
|
3675
3711
|
else {
|
|
3676
3712
|
L.unsupported("SC1090", prop, "non-identifier property names");
|
|
3677
3713
|
}
|
|
3678
|
-
const valueExpr = ts.
|
|
3714
|
+
const valueExpr = ts.isMethodDeclaration(prop)
|
|
3715
|
+
? prop
|
|
3716
|
+
: ts.isShorthandPropertyAssignment(prop)
|
|
3717
|
+
? prop.name
|
|
3718
|
+
: prop.initializer;
|
|
3679
3719
|
// Lambda values that fail to lower become trap closures (the
|
|
3680
3720
|
// per-call fence granularity — fenceClosureProbe) so the object
|
|
3681
3721
|
// still builds; everything else keeps the per-property fence below.
|
|
3682
3722
|
let raw;
|
|
3683
3723
|
const propDiagsBefore = L.diags.length;
|
|
3684
3724
|
try {
|
|
3725
|
+
const lowerValue = () => ts.isMethodDeclaration(prop)
|
|
3726
|
+
? (L.rejectThisInObjectMethod(prop.body ?? prop), L.lowerLambda(prop))
|
|
3727
|
+
: L.lowerExpr(valueExpr);
|
|
3685
3728
|
raw =
|
|
3686
|
-
fenceClosureProbe(L, valueExpr, undefined,
|
|
3687
|
-
|
|
3729
|
+
fenceClosureProbe(L, valueExpr, undefined, lowerValue) ??
|
|
3730
|
+
lowerValue();
|
|
3688
3731
|
}
|
|
3689
3732
|
catch (err) {
|
|
3690
3733
|
// A PURE member read a JS file cannot lower (a namespace object
|
|
@@ -3768,7 +3811,8 @@ export function lowerDynObjectLiteral(L, expr) {
|
|
|
3768
3811
|
}
|
|
3769
3812
|
fields.push({ key, value: v });
|
|
3770
3813
|
}
|
|
3771
|
-
|
|
3814
|
+
flushFields();
|
|
3815
|
+
return acc ?? { kind: "dynObjLit", fields: [], type: DYN, loc };
|
|
3772
3816
|
}
|
|
3773
3817
|
/** Spreading a source whose shape carries accessor slots: Node's copy
|
|
3774
3818
|
* invokes each getter exactly once in insertion order — even for keys a
|
|
@@ -5185,6 +5229,13 @@ export function lowerElementAccess(L, expr) {
|
|
|
5185
5229
|
if (en)
|
|
5186
5230
|
return en;
|
|
5187
5231
|
}
|
|
5232
|
+
// Native Web handles use the same supported surface for bracket and dot
|
|
5233
|
+
// spellings. Fence a statically-known unsupported key before the generic
|
|
5234
|
+
// checked-dynamic element-read path can turn it into a runtime missing
|
|
5235
|
+
// member.
|
|
5236
|
+
L.fenceStaticResponseMember(expr, "read");
|
|
5237
|
+
L.fenceStaticHeadersMember(expr, "read");
|
|
5238
|
+
L.fenceStaticReadableStreamMember(expr, "read");
|
|
5188
5239
|
// `globalThis[<expr>]` — the dynamic global probe (the harness's
|
|
5189
5240
|
// conditional-globals sweep): a compiled binary's globals are
|
|
5190
5241
|
// compile-time bindings, not runtime properties, and none of the
|