@scriptc/compiler 0.0.16 → 0.0.18
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 +4 -4
- package/dist/backend/cc.d.ts +5 -0
- package/dist/backend/cc.js +2 -0
- package/dist/backend/cc.js.map +1 -1
- package/dist/backend/emission/emit-async.js +35 -2
- package/dist/backend/emission/emit-async.js.map +1 -1
- package/dist/backend/emission/emit-exprs.js +44 -6
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/emission/emitter.js +69 -11
- package/dist/backend/emission/emitter.js.map +1 -1
- package/dist/backend/emission/may-throw.d.ts +3 -3
- package/dist/backend/emission/may-throw.js +15 -4
- package/dist/backend/emission/may-throw.js.map +1 -1
- package/dist/backend/llvm/emitter.js +200 -21
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/coverage/surface-manifest.js +27 -9
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/frontend/lowering/lower-builtins.js +4 -7
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +4 -4
- package/dist/frontend/lowering/lower-calls.js +44 -11
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.d.ts +22 -17
- package/dist/frontend/lowering/lower-containers.js +628 -51
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +19 -1
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +2 -2
- package/dist/frontend/lowering/lower-island.js +57 -9
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +144 -10
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +8 -0
- package/dist/frontend/lowering/lower-stmts.js +408 -21
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +38 -0
- package/dist/frontend/lowering/lowerer.js +149 -2
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +8 -0
- package/dist/frontend/lowering/surfaces.js +10 -0
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/shared.d.ts +4 -0
- package/dist/frontend/shared.js +9 -3
- package/dist/frontend/shared.js.map +1 -1
- package/dist/frontend/ts7/program.js +5 -4
- package/dist/frontend/ts7/program.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +53 -22
- package/dist/ir/nodes.js +42 -0
- 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 +99 -39
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/fence-eval.js +9 -1
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/int-infer.js +191 -25
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/int-infer.test.js +206 -1
- package/dist/library/int-infer.test.js.map +1 -1
- package/package.json +2 -2
- package/surface-manifest.json +27 -3
|
@@ -574,7 +574,8 @@ export function emitExpr(E, e) {
|
|
|
574
574
|
case "strCmp": {
|
|
575
575
|
const l = E.emitExpr(e.left);
|
|
576
576
|
const r = E.emitExpr(e.right);
|
|
577
|
-
|
|
577
|
+
const fn = e.utf16 === true ? "scr_str_cmp_u16" : "scr_str_cmp";
|
|
578
|
+
return E.newTemp(e.type, `${fn}(${l.name}, ${r.name}) ${e.op} 0`);
|
|
578
579
|
}
|
|
579
580
|
case "toString": {
|
|
580
581
|
const v = E.emitExpr(e.operand);
|
|
@@ -902,6 +903,21 @@ export function emitExpr(E, e) {
|
|
|
902
903
|
const end = e.args[1] ? E.emitExpr(e.args[1]).name : "INFINITY";
|
|
903
904
|
return E.newTemp(e.type, `scr_arr_slice(${r.name}, ${start}, ${end})`);
|
|
904
905
|
}
|
|
906
|
+
case "toReversed":
|
|
907
|
+
return E.newTemp(e.type, `scr_arr_to_reversed(${r.name})`);
|
|
908
|
+
case "toSpliced": {
|
|
909
|
+
const start = E.emitExpr(e.args[0]);
|
|
910
|
+
const count = E.emitExpr(e.args[1]);
|
|
911
|
+
const items = E.emitExpr(e.args[2]);
|
|
912
|
+
return E.newTemp(e.type, `scr_arr_to_spliced(${r.name}, ${start.name}, ${count.name}, ${items.name})`);
|
|
913
|
+
}
|
|
914
|
+
case "with": {
|
|
915
|
+
const index = E.emitExpr(e.args[0]);
|
|
916
|
+
const value = E.emitExpr(e.args[1]);
|
|
917
|
+
const out = E.newTemp(e.type, `scr_arr_with_${acc}(${r.name}, ${index.name}, ${value.name})`);
|
|
918
|
+
E.emitPendingCheck();
|
|
919
|
+
return out;
|
|
920
|
+
}
|
|
905
921
|
case "splice": {
|
|
906
922
|
// The removal splice: the removed elements come back as a
|
|
907
923
|
// fresh +1 array, their ownership MOVED out of the receiver
|
|
@@ -1023,6 +1039,17 @@ export function emitExpr(E, e) {
|
|
|
1023
1039
|
// Same defaults; the result is a +1 VIEW aliasing the
|
|
1024
1040
|
// receiver's storage (subarray / Buffer's slice).
|
|
1025
1041
|
return E.newTemp(e.type, `scr_bytes_subarray(${r.name}, ${args[0]?.name ?? "0"}, ${args[1]?.name ?? "INFINITY"})`);
|
|
1042
|
+
case "toReversed":
|
|
1043
|
+
return E.newTemp(e.type, `scr_bytes_to_reversed(${r.name})`);
|
|
1044
|
+
case "with": {
|
|
1045
|
+
const out = E.newTemp(e.type, `scr_bytes_with(${r.name}, ${args[0].name}, ${args[1].name})`);
|
|
1046
|
+
E.emitPendingCheck();
|
|
1047
|
+
return out;
|
|
1048
|
+
}
|
|
1049
|
+
case "join":
|
|
1050
|
+
return E.newTemp(e.type, `scr_bytes_join(${r.name}, ${args[0].name})`);
|
|
1051
|
+
case "toArray":
|
|
1052
|
+
return E.newTemp(e.type, `scr_bytes_to_arr(${r.name})`);
|
|
1026
1053
|
case "setFrom": {
|
|
1027
1054
|
// dst.set(src, offset?) — void; throws Node's RangeError on
|
|
1028
1055
|
// overflow (may-throw seed).
|
|
@@ -2095,6 +2122,15 @@ export function emitExpr(E, e) {
|
|
|
2095
2122
|
return E.newTemp(e.type, `${E.caughtToDynHelper()}(${c.name})`);
|
|
2096
2123
|
}
|
|
2097
2124
|
case "intrinsic": {
|
|
2125
|
+
if (e.name === "module.await") {
|
|
2126
|
+
// The module evaluator's dependency wait: park only while the
|
|
2127
|
+
// promise is pending. A settled dependency continues in this
|
|
2128
|
+
// turn (no JavaScript-await hop); a rejection rethrows.
|
|
2129
|
+
const p = E.emitExpr(e.args[0]);
|
|
2130
|
+
E.line(`scr_module_await(${p.name});${E.srcComment(e.loc)}`);
|
|
2131
|
+
E.emitPendingCheck();
|
|
2132
|
+
return { name: "", type: e.type };
|
|
2133
|
+
}
|
|
2098
2134
|
if (e.name === "promise.all") {
|
|
2099
2135
|
// The runtime countdown combinator: a pre-sized values array
|
|
2100
2136
|
// (filled per INPUT index by the per-kind store helper as
|
|
@@ -2612,12 +2648,14 @@ export function emitExpr(E, e) {
|
|
|
2612
2648
|
return finish(`scr_btoa(${arg(0)})`);
|
|
2613
2649
|
case "str.b64Missing":
|
|
2614
2650
|
return finish(`scr_b64_missing_arg()`);
|
|
2615
|
-
//
|
|
2616
|
-
//
|
|
2651
|
+
// Number.prototype formatters (scr_lib.c). Borrow nothing;
|
|
2652
|
+
// successful results +1; explicit toFixed may throw RangeError.
|
|
2617
2653
|
case "num.toExponential":
|
|
2618
2654
|
return finish(`scr_num_to_exponential(${arg(0)})`);
|
|
2619
2655
|
case "num.toFixed0":
|
|
2620
2656
|
return finish(`scr_num_to_fixed0(${arg(0)})`);
|
|
2657
|
+
case "num.toFixed":
|
|
2658
|
+
return finish(`scr_num_to_fixed(${arg(0)}, ${arg(1)})`);
|
|
2621
2659
|
// Object.is over two numbers — SameValue on doubles. No throw.
|
|
2622
2660
|
case "num.sameValue":
|
|
2623
2661
|
return finish(`scr_num_same_value(${arg(0)}, ${arg(1)})`);
|
|
@@ -4675,14 +4713,14 @@ export function emitExpr(E, e) {
|
|
|
4675
4713
|
case "process.emitWarning":
|
|
4676
4714
|
return finish(`scr_process_emit_warning(${arg(0)})`);
|
|
4677
4715
|
case "process.onUnhandledRejection":
|
|
4678
|
-
// The report
|
|
4716
|
+
// The completed-checkpoint report dispatches the listeners.
|
|
4679
4717
|
E.usesTimers = true;
|
|
4680
4718
|
return finish(`scr_process_on_unhandled_rejection(${arg(0)}, ${arg(1)})`);
|
|
4681
4719
|
case "process.offUnhandledRejection":
|
|
4682
4720
|
return finish(`scr_process_off_unhandled_rejection(${arg(0)})`);
|
|
4683
4721
|
case "process.onRejectionHandled":
|
|
4684
|
-
// Fires
|
|
4685
|
-
//
|
|
4722
|
+
// Fires after a reported promise gains a handler — the loop
|
|
4723
|
+
// must be live for the checkpoint report to run.
|
|
4686
4724
|
E.usesTimers = true;
|
|
4687
4725
|
return finish(`scr_process_on_rejection_handled(${arg(0)}, ${arg(1)})`);
|
|
4688
4726
|
case "process.offRejectionHandled":
|