@scriptc/compiler 0.0.1 → 0.0.3
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/emission/emit-exprs.js +2 -0
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/llvm/emitter.js +19 -4
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/coverage/report.d.ts +1 -0
- package/dist/coverage/report.js +12 -0
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.d.ts +22 -0
- package/dist/coverage/surface-manifest.js +295 -0
- package/dist/coverage/surface-manifest.js.map +1 -0
- package/dist/diagnostics/diagnostic.d.ts +16 -0
- package/dist/diagnostics/diagnostic.js +24 -0
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +10 -5
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.d.ts +3 -0
- package/dist/frontend/lowering/lower-containers.js +64 -0
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +14 -2
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +8 -3
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +3 -3
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +2 -2
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.js +4 -3
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/program.js +104 -21
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/shared.d.ts +7 -0
- package/dist/frontend/shared.js +9 -0
- package/dist/frontend/shared.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +1 -1
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/validate.js +1 -0
- package/dist/ir/validate.js.map +1 -1
- package/package.json +6 -4
- package/surface-manifest.json +2052 -0
|
@@ -45,6 +45,7 @@ const LIB_FN_SYMS = {
|
|
|
45
45
|
"math.random": "scr_math_random",
|
|
46
46
|
"num.parseInt": "scr_parse_int",
|
|
47
47
|
"num.parseFloat": "scr_parse_float",
|
|
48
|
+
"num.fromString": "scr_string_to_number",
|
|
48
49
|
"math.round": "scr_math_round",
|
|
49
50
|
// decodeUriComponent is NOT here: it throws (MAY_THROW_LIB_FNS), so it
|
|
50
51
|
// refuses by name like the rest of the throwing tier.
|
|
@@ -288,7 +289,8 @@ const LIB_FN_SYMS = {
|
|
|
288
289
|
"process.killNum": "scr_process_kill",
|
|
289
290
|
// fs.promises (scr_bytes_io.c / scr_lib.c): the promise forms settle
|
|
290
291
|
// instead of throwing — plain generic calls answering a +1 promise.
|
|
291
|
-
|
|
292
|
+
// fsp.readFile is NOT here: it carries the ignored encoding argument,
|
|
293
|
+
// so it is special-cased in emitLibCall (the fs.readFileSync pattern).
|
|
292
294
|
"fsp.readFileBytes": "scr_fsp_read_file_bytes",
|
|
293
295
|
"fsp.writeFile": "scr_fsp_write_file",
|
|
294
296
|
"fsp.mkdir": "scr_fsp_mkdir",
|
|
@@ -8269,6 +8271,19 @@ class LlEmitter {
|
|
|
8269
8271
|
this.emitPendingCheck();
|
|
8270
8272
|
return out;
|
|
8271
8273
|
}
|
|
8274
|
+
if (e.fn === "fsp.readFile") {
|
|
8275
|
+
// fs.promises.readFile(path, "utf8"): args[1] is the encoding —
|
|
8276
|
+
// evaluated for JS-exact side-effect order, ignored by the runtime
|
|
8277
|
+
// exactly like fs.readFileSync's. The C prototype takes ONLY the
|
|
8278
|
+
// path, so the generic path (which passes every evaluated arg)
|
|
8279
|
+
// would declare a second parameter the runtime never had. Settles
|
|
8280
|
+
// the +1 promise instead of throwing — no pending check.
|
|
8281
|
+
const args = e.args.map((a) => this.emitExpr(a));
|
|
8282
|
+
this.declare(`declare ptr @scr_fsp_read_file(ptr)`);
|
|
8283
|
+
const t = B.tmp();
|
|
8284
|
+
B.line(`${t} = call ptr @scr_fsp_read_file(ptr ${args[0].name})`);
|
|
8285
|
+
return this.own({ name: t, type: e.type });
|
|
8286
|
+
}
|
|
8272
8287
|
if (e.fn === "timers.setTimeout" || e.fn === "timers.setInterval" || e.fn === "timers.setTimeoutHandle" || e.fn === "timers.setImmediate" || e.fn === "process.nextTick" || e.fn === "timers.queueMicrotask") {
|
|
8273
8288
|
// The loop owns the callback until it fires (setTimeout/setImmediate/
|
|
8274
8289
|
// queueMicrotask) or until clear (setInterval) — the +1 MOVES in;
|
|
@@ -9534,7 +9549,7 @@ class LlEmitter {
|
|
|
9534
9549
|
throw new Error("llvm emitter bug: net.serverAddress record unknown");
|
|
9535
9550
|
const args = e.args.map((a) => this.emitExpr(a));
|
|
9536
9551
|
this.declare(`declare ptr @scr_net_server_addr_ip(ptr)`);
|
|
9537
|
-
this.declare(`declare
|
|
9552
|
+
this.declare(`declare ptr @scr_net_server_addr_family(ptr)`);
|
|
9538
9553
|
this.declare(`declare double @scr_net_server_port(ptr)`);
|
|
9539
9554
|
const ip = B.tmp();
|
|
9540
9555
|
B.line(`${ip} = call ptr @scr_net_server_addr_ip(ptr ${args[0].name}) ; +1`);
|
|
@@ -9553,8 +9568,8 @@ class LlEmitter {
|
|
|
9553
9568
|
};
|
|
9554
9569
|
store("address", "ptr", ip);
|
|
9555
9570
|
const fam = B.tmp();
|
|
9556
|
-
B.line(`${fam} = call
|
|
9557
|
-
store("family", "
|
|
9571
|
+
B.line(`${fam} = call ptr @scr_net_server_addr_family(ptr ${args[0].name}) ; +1 — "IPv4"/"IPv6"`);
|
|
9572
|
+
store("family", "ptr", fam);
|
|
9558
9573
|
const port = B.tmp();
|
|
9559
9574
|
B.line(`${port} = call double @scr_net_server_port(ptr ${args[0].name})`);
|
|
9560
9575
|
store("port", "double", port);
|