@scriptc/compiler 0.0.33 → 0.0.34
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/cc-cache.test.js +122 -0
- package/dist/backend/cc-cache.test.js.map +1 -1
- package/dist/backend/cc.d.ts +19 -0
- package/dist/backend/cc.js +111 -20
- package/dist/backend/cc.js.map +1 -1
- package/dist/backend/emission/emit-exprs.js +26 -1
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/emission/emit-shapes.js +37 -4
- package/dist/backend/emission/emit-shapes.js.map +1 -1
- package/dist/backend/emission/emitter.d.ts +11 -2
- package/dist/backend/emission/emitter.js +11 -5
- package/dist/backend/emission/emitter.js.map +1 -1
- package/dist/backend/library-identity.d.ts +22 -0
- package/dist/backend/library-identity.js +103 -0
- package/dist/backend/library-identity.js.map +1 -0
- package/dist/backend/llvm/emitter.d.ts +3 -0
- package/dist/backend/llvm/emitter.js +35 -5
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +1 -0
- package/dist/backend/llvm/shapes.js +25 -1
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/mangle.d.ts +1 -0
- package/dist/backend/mangle.js +3 -0
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/object-localize.d.ts +5 -5
- package/dist/backend/object-localize.js +19 -16
- package/dist/backend/object-localize.js.map +1 -1
- package/dist/backend/object-localize.test.js +37 -13
- package/dist/backend/object-localize.test.js.map +1 -1
- package/dist/frontend/input-tracker.d.ts +82 -0
- package/dist/frontend/input-tracker.js +380 -0
- package/dist/frontend/input-tracker.js.map +1 -0
- package/dist/frontend/input-tracker.test.d.ts +1 -0
- package/dist/frontend/input-tracker.test.js +137 -0
- package/dist/frontend/input-tracker.test.js.map +1 -0
- package/dist/frontend/lowering/lower-builtins.js +2 -8
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +155 -140
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +3 -0
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.js +48 -9
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +67 -1
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +45 -26
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +1 -1
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +48 -3
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +67 -29
- package/dist/frontend/lowering/lowerer.js +410 -87
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/npm-static-rewrite.js +25 -26
- package/dist/frontend/npm-static-rewrite.js.map +1 -1
- package/dist/frontend/npm-static.js +29 -30
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm-static.test.d.ts +1 -0
- package/dist/frontend/npm-static.test.js +15 -0
- package/dist/frontend/npm-static.test.js.map +1 -0
- package/dist/frontend/npm.js +5 -17
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/program.js +2 -6
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.js +8 -29
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/ts7/program.js +17 -18
- package/dist/frontend/ts7/program.js.map +1 -1
- package/dist/frontend/types.d.ts +33 -0
- package/dist/frontend/types.js +114 -3
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +241 -42
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +21 -4
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/serialize.d.ts +1 -1
- package/dist/ir/serialize.js +1 -1
- package/dist/ir/validate.js +31 -1
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/early-cache.d.ts +65 -0
- package/dist/library/early-cache.js +380 -0
- package/dist/library/early-cache.js.map +1 -0
- package/dist/library/early-cache.test.d.ts +1 -0
- package/dist/library/early-cache.test.js +528 -0
- package/dist/library/early-cache.test.js.map +1 -0
- package/dist/library/int-infer.js +14 -0
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/int-infer.test.js +21 -4
- package/dist/library/int-infer.test.js.map +1 -1
- package/dist/library/semantic-source.d.ts +13 -0
- package/dist/library/semantic-source.js +257 -0
- package/dist/library/semantic-source.js.map +1 -0
- package/dist/library/semantic-source.test.d.ts +1 -0
- package/dist/library/semantic-source.test.js +113 -0
- package/dist/library/semantic-source.test.js.map +1 -0
- package/dist/library/sidecar.d.ts +6 -0
- package/dist/library/sidecar.js +11 -0
- package/dist/library/sidecar.js.map +1 -1
- package/package.json +2 -2
- package/surface-manifest.json +1 -1
|
@@ -5854,6 +5854,7 @@ export function objectIterOverIndexShape(L, node, member, argIr, shape, receiver
|
|
|
5854
5854
|
const body = [
|
|
5855
5855
|
{ kind: "varDecl", localId: "out.0", init: { kind: "arrayLit", elems: [], type: resultT, loc }, loc },
|
|
5856
5856
|
];
|
|
5857
|
+
const fieldStmts = new Map();
|
|
5857
5858
|
// Declared fields, in declaration order. Undefined-valued fields
|
|
5858
5859
|
// skip at runtime (the unset-optional convention); values surface
|
|
5859
5860
|
// into the element type or the site fences with the field named.
|
|
@@ -5921,7 +5922,7 @@ export function objectIterOverIndexShape(L, node, member, argIr, shape, receiver
|
|
|
5921
5922
|
loc,
|
|
5922
5923
|
};
|
|
5923
5924
|
}
|
|
5924
|
-
|
|
5925
|
+
const fieldStmt = utag >= 0 && f.type.kind === "union"
|
|
5925
5926
|
? {
|
|
5926
5927
|
kind: "if",
|
|
5927
5928
|
cond: { kind: "unionIsTag", unionId: f.type.unionId, tag: utag, negated: true, value: raw, type: BOOL, loc },
|
|
@@ -5929,7 +5930,9 @@ export function objectIterOverIndexShape(L, node, member, argIr, shape, receiver
|
|
|
5929
5930
|
else_: null,
|
|
5930
5931
|
loc,
|
|
5931
5932
|
}
|
|
5932
|
-
: push(pushed)
|
|
5933
|
+
: push(pushed);
|
|
5934
|
+
fieldStmts.set(f.name, fieldStmt);
|
|
5935
|
+
body.push(fieldStmt);
|
|
5933
5936
|
}
|
|
5934
5937
|
// The overflow walk: a fresh key snapshot in JS own-key order, each
|
|
5935
5938
|
// value read back through the overflow-only keyed read (declared
|
|
@@ -5976,8 +5979,9 @@ export function objectIterOverIndexShape(L, node, member, argIr, shape, receiver
|
|
|
5976
5979
|
],
|
|
5977
5980
|
loc,
|
|
5978
5981
|
}, { kind: "return", value: outRef, loc });
|
|
5982
|
+
const suffix = body.slice(1 + fieldStmts.size);
|
|
5979
5983
|
L.arrHofHelpers.set(key, helper);
|
|
5980
|
-
|
|
5984
|
+
const fn = {
|
|
5981
5985
|
name: helper,
|
|
5982
5986
|
params: [{ localId: "r.0", name: "r", type: argIr }],
|
|
5983
5987
|
returnType: resultT,
|
|
@@ -5990,7 +5994,16 @@ export function objectIterOverIndexShape(L, node, member, argIr, shape, receiver
|
|
|
5990
5994
|
],
|
|
5991
5995
|
body,
|
|
5992
5996
|
loc,
|
|
5997
|
+
};
|
|
5998
|
+
L.shapeOrderHelperFinalizers.push(() => {
|
|
5999
|
+
const current = L.shapes.get(argIr.shapeId) ?? shape;
|
|
6000
|
+
const currentOrder = current.declaredOrder ?? current.fields.map((f) => f.name);
|
|
6001
|
+
fn.body = [body[0], ...currentOrder.flatMap((name) => {
|
|
6002
|
+
const stmt = fieldStmts.get(name);
|
|
6003
|
+
return stmt ? [stmt] : [];
|
|
6004
|
+
}), ...suffix];
|
|
5993
6005
|
});
|
|
6006
|
+
L.liftedFns.push(fn);
|
|
5994
6007
|
}
|
|
5995
6008
|
return { kind: "call", callee: helper, args: [receiver], type: resultT, loc };
|
|
5996
6009
|
}
|
|
@@ -6356,6 +6369,7 @@ export function lowerRecordOvfCaptureHelper(L, fromId, toId, loc) {
|
|
|
6356
6369
|
loc,
|
|
6357
6370
|
},
|
|
6358
6371
|
];
|
|
6372
|
+
const fieldStmts = new Map();
|
|
6359
6373
|
// Source declared fields in declaration order, skipping unset
|
|
6360
6374
|
// optionals (stance 37) and the direct-initialized (consumed) names.
|
|
6361
6375
|
for (const ff of orderedFields) {
|
|
@@ -6374,7 +6388,7 @@ export function lowerRecordOvfCaptureHelper(L, fromId, toId, loc) {
|
|
|
6374
6388
|
...(to.fields.some((f) => f.name === ff.name) ? {} : { overflowOnly: true }),
|
|
6375
6389
|
loc,
|
|
6376
6390
|
};
|
|
6377
|
-
|
|
6391
|
+
const fieldStmt = utag >= 0 && ff.type.kind === "union"
|
|
6378
6392
|
? {
|
|
6379
6393
|
kind: "if",
|
|
6380
6394
|
cond: { kind: "unionIsTag", unionId: ff.type.unionId, tag: utag, negated: true, value: raw, type: BOOL, loc },
|
|
@@ -6382,7 +6396,9 @@ export function lowerRecordOvfCaptureHelper(L, fromId, toId, loc) {
|
|
|
6382
6396
|
else_: null,
|
|
6383
6397
|
loc,
|
|
6384
6398
|
}
|
|
6385
|
-
: write
|
|
6399
|
+
: write;
|
|
6400
|
+
fieldStmts.set(ff.name, fieldStmt);
|
|
6401
|
+
body.push(fieldStmt);
|
|
6386
6402
|
}
|
|
6387
6403
|
// The source overflow, in JS own-key order (only index-signature
|
|
6388
6404
|
// sources carry one).
|
|
@@ -6421,7 +6437,8 @@ export function lowerRecordOvfCaptureHelper(L, fromId, toId, loc) {
|
|
|
6421
6437
|
});
|
|
6422
6438
|
}
|
|
6423
6439
|
body.push({ kind: "return", value: outRef, loc });
|
|
6424
|
-
|
|
6440
|
+
const suffix = body.slice(1 + fieldStmts.size);
|
|
6441
|
+
const fn = {
|
|
6425
6442
|
name,
|
|
6426
6443
|
params: [{ localId: "s.0", name: "s", type: fromT }],
|
|
6427
6444
|
returnType: toT,
|
|
@@ -6438,7 +6455,16 @@ export function lowerRecordOvfCaptureHelper(L, fromId, toId, loc) {
|
|
|
6438
6455
|
],
|
|
6439
6456
|
body,
|
|
6440
6457
|
loc,
|
|
6458
|
+
};
|
|
6459
|
+
L.shapeOrderHelperFinalizers.push(() => {
|
|
6460
|
+
const current = L.shapes.get(fromId) ?? from;
|
|
6461
|
+
const currentOrder = current.declaredOrder ?? current.fields.map((f) => f.name);
|
|
6462
|
+
fn.body = [body[0], ...currentOrder.flatMap((field) => {
|
|
6463
|
+
const stmt = fieldStmts.get(field);
|
|
6464
|
+
return stmt ? [stmt] : [];
|
|
6465
|
+
}), ...suffix];
|
|
6441
6466
|
});
|
|
6467
|
+
L.liftedFns.push(fn);
|
|
6442
6468
|
return name;
|
|
6443
6469
|
}
|
|
6444
6470
|
/** `Object.assign(target, ...sources)` into an INDEX-SIGNATURE record:
|
|
@@ -6531,6 +6557,7 @@ export function lowerObjectAssignIndexShape(L, call) {
|
|
|
6531
6557
|
const sRef = ref("s.0", fromT);
|
|
6532
6558
|
const intoSlot = (v, lift) => lift === "dyn" ? { kind: "dynFrom", value: v, type: DYN, loc } : L.applyWidthLift(lift, v, tIv, loc);
|
|
6533
6559
|
const body = [];
|
|
6560
|
+
const fieldStmts = new Map();
|
|
6534
6561
|
for (const ff of plan.fields) {
|
|
6535
6562
|
const raw = { kind: "recordGet", obj: sRef, shapeId: plan.fromId, field: ff.name, type: ff.type, loc };
|
|
6536
6563
|
const utag = ff.type.kind === "union" ? L.armTag(ff.type.unionId, UNDEFINED_T) : -1;
|
|
@@ -6542,7 +6569,7 @@ export function lowerObjectAssignIndexShape(L, call) {
|
|
|
6542
6569
|
value: intoSlot(raw, ff.lift),
|
|
6543
6570
|
loc,
|
|
6544
6571
|
};
|
|
6545
|
-
|
|
6572
|
+
const fieldStmt = utag >= 0 && ff.type.kind === "union"
|
|
6546
6573
|
? {
|
|
6547
6574
|
kind: "if",
|
|
6548
6575
|
cond: { kind: "unionIsTag", unionId: ff.type.unionId, tag: utag, negated: true, value: raw, type: BOOL, loc },
|
|
@@ -6550,7 +6577,9 @@ export function lowerObjectAssignIndexShape(L, call) {
|
|
|
6550
6577
|
else_: null,
|
|
6551
6578
|
loc,
|
|
6552
6579
|
}
|
|
6553
|
-
: write
|
|
6580
|
+
: write;
|
|
6581
|
+
fieldStmts.set(ff.name, fieldStmt);
|
|
6582
|
+
body.push(fieldStmt);
|
|
6554
6583
|
}
|
|
6555
6584
|
const ksT = arrayOf(STRING);
|
|
6556
6585
|
const fromShape = L.shapes.get(plan.fromId);
|
|
@@ -6588,7 +6617,8 @@ export function lowerObjectAssignIndexShape(L, call) {
|
|
|
6588
6617
|
});
|
|
6589
6618
|
}
|
|
6590
6619
|
body.push({ kind: "return", value: tRef, loc });
|
|
6591
|
-
|
|
6620
|
+
const suffix = body.slice(fieldStmts.size);
|
|
6621
|
+
const fn = {
|
|
6592
6622
|
name,
|
|
6593
6623
|
params: [
|
|
6594
6624
|
{ localId: "t.0", name: "t", type: toT },
|
|
@@ -6608,7 +6638,16 @@ export function lowerObjectAssignIndexShape(L, call) {
|
|
|
6608
6638
|
],
|
|
6609
6639
|
body,
|
|
6610
6640
|
loc,
|
|
6641
|
+
};
|
|
6642
|
+
L.shapeOrderHelperFinalizers.push(() => {
|
|
6643
|
+
const current = L.shapes.get(plan.fromId) ?? fromShape;
|
|
6644
|
+
const currentOrder = current.declaredOrder ?? current.fields.map((f) => f.name);
|
|
6645
|
+
fn.body = [...currentOrder.flatMap((field) => {
|
|
6646
|
+
const stmt = fieldStmts.get(field);
|
|
6647
|
+
return stmt ? [stmt] : [];
|
|
6648
|
+
}), ...suffix];
|
|
6611
6649
|
});
|
|
6650
|
+
L.liftedFns.push(fn);
|
|
6612
6651
|
return name;
|
|
6613
6652
|
};
|
|
6614
6653
|
let acc = L.lowerExprExpecting(call.arguments[0], targetIr);
|