@scriptc/compiler 0.1.3 → 0.1.4
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 +200 -51
- package/dist/backend/c/async.d.ts +25 -0
- package/dist/backend/c/async.js +167 -0
- package/dist/backend/c/async.js.map +1 -1
- package/dist/backend/c/c-emitter.d.ts +10 -0
- package/dist/backend/c/c-emitter.js +14 -2
- package/dist/backend/c/c-emitter.js.map +1 -1
- package/dist/backend/c/exprs.js +293 -51
- package/dist/backend/c/exprs.js.map +1 -1
- package/dist/backend/c/types.js +2 -0
- package/dist/backend/c/types.js.map +1 -1
- package/dist/backend/link-plan.d.ts +2 -1
- package/dist/backend/link-plan.js +2 -1
- package/dist/backend/link-plan.js.map +1 -1
- package/dist/backend/llvm/emitter.js +20 -6
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +1 -1
- package/dist/backend/llvm/expr-bytes.js +8 -8
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.d.ts +9 -0
- package/dist/backend/llvm/expr-callbacks.js +125 -0
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +14 -2
- package/dist/backend/llvm/expr-dispatch.js +1 -0
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.d.ts +1 -1
- package/dist/backend/llvm/expr-primitives.js +30 -9
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.d.ts +1 -0
- package/dist/backend/llvm/expr-primitives.test.js +38 -0
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -0
- package/dist/backend/llvm/expr-stream-callbacks.d.ts +3 -0
- package/dist/backend/llvm/expr-stream-callbacks.js +69 -0
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +68 -10
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +18 -2
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +156 -6
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +36 -0
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +23 -0
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/native-toolchain.d.ts +3 -0
- package/dist/backend/native-toolchain.js +3 -1
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +28 -10
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/targets.d.ts +4 -0
- package/dist/backend/targets.js +13 -0
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +8 -1
- package/dist/backend/targets.test.js.map +1 -1
- package/dist/coverage/surface-manifest.js +8 -0
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/diagnostics/diagnostic.js +1 -1
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +2 -0
- package/dist/executable/executable-cache.js +3 -0
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/frontend/fork-target.d.ts +17 -0
- package/dist/frontend/fork-target.js +256 -0
- package/dist/frontend/fork-target.js.map +1 -0
- package/dist/frontend/lowering/abstract-equality.d.ts +6 -0
- package/dist/frontend/lowering/abstract-equality.js +250 -0
- package/dist/frontend/lowering/abstract-equality.js.map +1 -0
- package/dist/frontend/lowering/lower-assert.js +71 -2
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-builtins.d.ts +50 -23
- package/dist/frontend/lowering/lower-builtins.js +939 -106
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +29 -21
- package/dist/frontend/lowering/lower-calls.js +573 -121
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +39 -8
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.js +150 -0
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.js +212 -21
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +135 -83
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +4 -0
- package/dist/frontend/lowering/lower-inspect.js +1 -1
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +6 -3
- package/dist/frontend/lowering/lower-island.js +165 -6
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +6 -0
- package/dist/frontend/lowering/lower-modules.js +184 -38
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.js +7 -0
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +1 -1
- package/dist/frontend/lowering/lower-server.js +130 -27
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +118 -15
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.d.ts +3 -0
- package/dist/frontend/lowering/lower-stream.js +7 -0
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +86 -9
- package/dist/frontend/lowering/lowerer.js +412 -72
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +26 -0
- package/dist/frontend/lowering/surfaces.js +140 -77
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/npm-static-declarations.d.ts +4 -0
- package/dist/frontend/npm-static-declarations.js +56 -0
- package/dist/frontend/npm-static-declarations.js.map +1 -1
- package/dist/frontend/npm-static-declarations.test.js +23 -2
- package/dist/frontend/npm-static-declarations.test.js.map +1 -1
- package/dist/frontend/npm-static.js +6 -5
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.d.ts +15 -3
- package/dist/frontend/npm.js +80 -8
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/npm.test.js +76 -9
- package/dist/frontend/npm.test.js.map +1 -1
- package/dist/frontend/program.js +92 -10
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.d.ts +6 -0
- package/dist/frontend/resolve.js +7 -4
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +5 -0
- package/dist/frontend/type-mapper.js +64 -24
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/dist/ir/ir.d.ts +93 -47
- package/dist/ir/ir.js +63 -4
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +14 -1
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/serialize.d.ts +1 -1
- package/dist/ir/serialize.js +1 -1
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/validate.js +165 -13
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/int-infer.test.js +4 -4
- package/dist/library/int-infer.test.js.map +1 -1
- package/dist/library/library-cache.test.js +5 -5
- package/dist/library/library-cache.test.js.map +1 -1
- package/package.json +17 -17
- package/surface-manifest.json +132 -38
package/dist/ir/validate.js
CHANGED
|
@@ -246,6 +246,7 @@ export const LIB_FN_SIGS = {
|
|
|
246
246
|
"bigint.shl": { argTypes: [BIGINT_T, BIGINT_T], result: BIGINT_T },
|
|
247
247
|
"bigint.shr": { argTypes: [BIGINT_T, BIGINT_T], result: BIGINT_T },
|
|
248
248
|
"bigint.eq": { argTypes: [BIGINT_T, BIGINT_T], result: BOOL },
|
|
249
|
+
"bigint.eqString": { argTypes: [BIGINT_T, STRING], result: BOOL },
|
|
249
250
|
"bigint.cmp": { argTypes: [BIGINT_T, BIGINT_T], result: F64 },
|
|
250
251
|
"bigint.cmpNumber": { argTypes: [BIGINT_T, F64], result: F64 },
|
|
251
252
|
"bigint.truthy": { argTypes: [BIGINT_T], result: BOOL },
|
|
@@ -260,8 +261,12 @@ export const LIB_FN_SIGS = {
|
|
|
260
261
|
"bigint.dataViewSet": { argTypes: [BYTES_U8, F64, BIGINT_T, BOOL], result: VOID },
|
|
261
262
|
"url.new": { argTypes: [STRING], result: URL_T },
|
|
262
263
|
"url.protocol": { argTypes: [URL_T], result: STRING },
|
|
264
|
+
"url.origin": { argTypes: [URL_T], result: STRING },
|
|
265
|
+
"url.username": { argTypes: [URL_T], result: STRING },
|
|
266
|
+
"url.password": { argTypes: [URL_T], result: STRING },
|
|
263
267
|
"url.host": { argTypes: [URL_T], result: STRING },
|
|
264
268
|
"url.hostname": { argTypes: [URL_T], result: STRING },
|
|
269
|
+
"url.port": { argTypes: [URL_T], result: STRING },
|
|
265
270
|
"url.pathname": { argTypes: [URL_T], result: STRING },
|
|
266
271
|
"url.href": { argTypes: [URL_T], result: STRING },
|
|
267
272
|
"url.fileURLToPathUrl": { argTypes: [URL_T], result: STRING },
|
|
@@ -277,6 +282,7 @@ export const LIB_FN_SIGS = {
|
|
|
277
282
|
"sp.with": { argTypes: [SEARCH_PARAMS_T, STRING, STRING], result: SEARCH_PARAMS_T },
|
|
278
283
|
"url.searchParams": { argTypes: [URL_T], result: SEARCH_PARAMS_T },
|
|
279
284
|
"url.search": { argTypes: [URL_T], result: STRING },
|
|
285
|
+
"url.hash": { argTypes: [URL_T], result: STRING },
|
|
280
286
|
// Result is the interned `string | null` union — the libCall case
|
|
281
287
|
// checks the arms (the spawnRes.signal pattern).
|
|
282
288
|
"sp.get": { argTypes: [SEARCH_PARAMS_T, STRING], result: VOID },
|
|
@@ -303,7 +309,12 @@ export const LIB_FN_SIGS = {
|
|
|
303
309
|
"util.parseArgs": { argTypes: [DYN], result: DYN },
|
|
304
310
|
"fs.statSync": { argTypes: [STRING], result: STATS_T },
|
|
305
311
|
"fs.lstatSync": { argTypes: [STRING], result: STATS_T },
|
|
312
|
+
"fs.fstatSync": { argTypes: [F64], result: STATS_T },
|
|
313
|
+
"fs.fchmodSync": { argTypes: [F64, F64], result: VOID },
|
|
314
|
+
"fs.fsyncSync": { argTypes: [F64], result: VOID },
|
|
315
|
+
"fs.linkSync": { argTypes: [STRING, STRING], result: VOID },
|
|
306
316
|
"fs.openSync": { argTypes: [STRING, STRING], result: F64 },
|
|
317
|
+
"fs.openNumericSync": { argTypes: [STRING, F64, F64], result: F64 },
|
|
307
318
|
"fs.readSync": { argTypes: [F64, BYTES_U8, F64, F64, F64], result: F64 },
|
|
308
319
|
"fs.writeSync": { argTypes: [F64, BYTES_U8, F64, F64, F64], result: F64 },
|
|
309
320
|
"fs.writeStrSync": { argTypes: [F64, STRING, F64, STRING], result: F64 },
|
|
@@ -323,10 +334,13 @@ export const LIB_FN_SIGS = {
|
|
|
323
334
|
"stats.isDirectory": { argTypes: [STATS_T], result: BOOL },
|
|
324
335
|
"stats.isSymbolicLink": { argTypes: [STATS_T], result: BOOL },
|
|
325
336
|
"stats.size": { argTypes: [STATS_T], result: F64 },
|
|
337
|
+
"stats.dev": { argTypes: [STATS_T], result: F64 },
|
|
338
|
+
"stats.ino": { argTypes: [STATS_T], result: F64 },
|
|
326
339
|
"stats.blocks": { argTypes: [STATS_T], result: F64 },
|
|
327
340
|
"stats.nlink": { argTypes: [STATS_T], result: F64 },
|
|
328
341
|
"stats.atimeMs": { argTypes: [STATS_T], result: F64 },
|
|
329
342
|
"stats.mtimeMs": { argTypes: [STATS_T], result: F64 },
|
|
343
|
+
"stats.ctimeMs": { argTypes: [STATS_T], result: F64 },
|
|
330
344
|
// The wider sync fs slice (unlink/chmod/chown/copyfile and the
|
|
331
345
|
// mode-carrying write/mkdir forms).
|
|
332
346
|
"fs.unlinkSync": { argTypes: [STRING], result: VOID },
|
|
@@ -445,6 +459,7 @@ export const LIB_FN_SIGS = {
|
|
|
445
459
|
"http.createServer": { argTypes: [null], result: NETSERVER_T },
|
|
446
460
|
"http.createServerEmpty": { argTypes: [], result: NETSERVER_T },
|
|
447
461
|
"http.serverJoinDupHeaders": { argTypes: [NETSERVER_T], result: VOID },
|
|
462
|
+
"http.serverAllowMissingHostHeader": { argTypes: [NETSERVER_T], result: VOID },
|
|
448
463
|
"http.serverTimeoutGet": { argTypes: [NETSERVER_T, F64], result: F64 },
|
|
449
464
|
"http.serverTimeoutSet": { argTypes: [NETSERVER_T, F64, F64], result: VOID },
|
|
450
465
|
"http.serverTimeoutOptionSet": { argTypes: [NETSERVER_T, F64, DYN], result: VOID },
|
|
@@ -462,6 +477,9 @@ export const LIB_FN_SIGS = {
|
|
|
462
477
|
"http.reqUrl": { argTypes: [HTTPREQ_T], result: STRING },
|
|
463
478
|
"http.reqMethod": { argTypes: [HTTPREQ_T], result: STRING },
|
|
464
479
|
"http.reqHeader": { argTypes: [HTTPREQ_T, STRING], result: VOID },
|
|
480
|
+
"http.reqTrailer": { argTypes: [HTTPREQ_T, STRING], result: VOID },
|
|
481
|
+
"http.reqHeaderValues": { argTypes: [HTTPREQ_T, STRING], result: VOID },
|
|
482
|
+
"http.reqTrailerValues": { argTypes: [HTTPREQ_T, STRING], result: VOID },
|
|
465
483
|
"http.reqOnData": { argTypes: [HTTPREQ_T, null, BOOL], result: VOID },
|
|
466
484
|
"http.reqOnEnd": { argTypes: [HTTPREQ_T, { kind: "func", params: [], ret: VOID }, BOOL], result: VOID },
|
|
467
485
|
"http.resSetHeader": { argTypes: [HTTPRES_T, STRING, STRING], result: VOID },
|
|
@@ -475,6 +493,11 @@ export const LIB_FN_SIGS = {
|
|
|
475
493
|
"http.resWriteDyn": { argTypes: [HTTPRES_T, DYN], result: VOID },
|
|
476
494
|
"http.resEndDyn": { argTypes: [HTTPRES_T, DYN], result: VOID },
|
|
477
495
|
"http.resHeadersSent": { argTypes: [HTTPRES_T], result: BOOL },
|
|
496
|
+
"http.resFlushHeaders": { argTypes: [HTTPRES_T], result: VOID },
|
|
497
|
+
"http.resAddTrailers": { argTypes: [HTTPRES_T, arrayOf(STRING)], result: VOID },
|
|
498
|
+
"http.resCork": { argTypes: [HTTPRES_T], result: VOID },
|
|
499
|
+
"http.resUncork": { argTypes: [HTTPRES_T], result: VOID },
|
|
500
|
+
"http.resWritableCorked": { argTypes: [HTTPRES_T], result: F64 },
|
|
478
501
|
// The member follow-ups: reqStatusCode's `number | undefined` and
|
|
479
502
|
// sockRemoteAddress's `string | undefined` results are shape-checked in
|
|
480
503
|
// the special cases below (like reqHeader/columns).
|
|
@@ -484,6 +507,8 @@ export const LIB_FN_SIGS = {
|
|
|
484
507
|
"http.reqStatusMessage": { argTypes: [HTTPREQ_T], result: VOID },
|
|
485
508
|
"http.reqRawHeaders": { argTypes: [HTTPREQ_T], result: arrayOf(STRING) },
|
|
486
509
|
"http.reqHeaderPairs": { argTypes: [HTTPREQ_T], result: arrayOf(STRING) },
|
|
510
|
+
"http.reqRawTrailers": { argTypes: [HTTPREQ_T], result: arrayOf(STRING) },
|
|
511
|
+
"http.reqTrailerPairs": { argTypes: [HTTPREQ_T], result: arrayOf(STRING) },
|
|
487
512
|
"net.sockDestroyed": { argTypes: [NETSOCKET_T], result: BOOL },
|
|
488
513
|
"net.sockWritable": { argTypes: [NETSOCKET_T], result: BOOL },
|
|
489
514
|
// The 'upgrade' registrations: the callback shapes are program-typed
|
|
@@ -678,6 +703,11 @@ export const LIB_FN_SIGS = {
|
|
|
678
703
|
"http.clientEndBytes": { argTypes: [HTTPCLIENTREQ_T, BYTES_U8], result: VOID },
|
|
679
704
|
"http.clientWriteDyn": { argTypes: [HTTPCLIENTREQ_T, DYN], result: VOID },
|
|
680
705
|
"http.clientEndDyn": { argTypes: [HTTPCLIENTREQ_T, DYN], result: VOID },
|
|
706
|
+
"http.clientFlushHeaders": { argTypes: [HTTPCLIENTREQ_T], result: VOID },
|
|
707
|
+
"http.clientAddTrailers": { argTypes: [HTTPCLIENTREQ_T, arrayOf(STRING)], result: VOID },
|
|
708
|
+
"http.clientCork": { argTypes: [HTTPCLIENTREQ_T], result: VOID },
|
|
709
|
+
"http.clientUncork": { argTypes: [HTTPCLIENTREQ_T], result: VOID },
|
|
710
|
+
"http.clientWritableCorked": { argTypes: [HTTPCLIENTREQ_T], result: F64 },
|
|
681
711
|
"http.clientDestroy": { argTypes: [HTTPCLIENTREQ_T], result: VOID },
|
|
682
712
|
"http.clientDestroyed": { argTypes: [HTTPCLIENTREQ_T], result: BOOL },
|
|
683
713
|
"http.clientOnResponse": { argTypes: [HTTPCLIENTREQ_T, null, BOOL], result: VOID },
|
|
@@ -693,17 +723,36 @@ export const LIB_FN_SIGS = {
|
|
|
693
723
|
result: SPAWNRES_T,
|
|
694
724
|
},
|
|
695
725
|
"cp.spawn": { argTypes: [STRING, arrayOf(STRING)], result: CHILD_T },
|
|
726
|
+
"process.forkTarget": { argTypes: [F64], result: F64 },
|
|
727
|
+
"cp.fork": {
|
|
728
|
+
argTypes: [F64, arrayOf(STRING), F64, F64, F64, BOOL, arrayOf(STRING), STRING],
|
|
729
|
+
result: CHILD_T,
|
|
730
|
+
},
|
|
731
|
+
"child.connected": { argTypes: [CHILD_T], result: BOOL },
|
|
732
|
+
"child.send": { argTypes: [CHILD_T, STRING], result: BOOL },
|
|
733
|
+
"child.sendCb": { argTypes: [CHILD_T, STRING, null], result: BOOL },
|
|
734
|
+
"child.disconnect": { argTypes: [CHILD_T], result: VOID },
|
|
735
|
+
"child.onMessage": { argTypes: [CHILD_T, null, BOOL], result: VOID },
|
|
736
|
+
"child.onDisconnect": { argTypes: [CHILD_T, null, BOOL], result: VOID },
|
|
737
|
+
"process.connected": { argTypes: [], result: BOOL },
|
|
738
|
+
"process.send": { argTypes: [STRING], result: BOOL },
|
|
739
|
+
"process.sendCb": { argTypes: [STRING, null], result: BOOL },
|
|
740
|
+
"process.disconnect": { argTypes: [], result: VOID },
|
|
741
|
+
"process.onMessage": { argTypes: [null, BOOL], result: VOID },
|
|
742
|
+
"process.onDisconnect": { argTypes: [null, BOOL], result: VOID },
|
|
743
|
+
"cp.execFile": { argTypes: [STRING, arrayOf(STRING), null], result: CHILD_T },
|
|
696
744
|
// spawn's options form: per-slot stdio modes (0 ignore / 1 inherit /
|
|
697
745
|
// 2 fd) with the out/err fds for mode 2, detached, env replacement
|
|
698
746
|
// pairs, cwd ("" = inherit).
|
|
699
747
|
"cp.spawnOpts": {
|
|
700
|
-
argTypes: [STRING, arrayOf(STRING), F64, F64, F64, F64, F64, BOOL, BOOL, arrayOf(STRING), STRING],
|
|
748
|
+
argTypes: [STRING, arrayOf(STRING), F64, F64, F64, F64, F64, BOOL, BOOL, BOOL, arrayOf(STRING), STRING],
|
|
701
749
|
result: CHILD_T,
|
|
702
750
|
},
|
|
703
751
|
// The callback's func type is program-dependent (zero params, or the
|
|
704
752
|
// `number | null` union / the %Error class) — the libCall case checks
|
|
705
753
|
// the shape; the slot here only pins arity and the child receiver.
|
|
706
754
|
"child.onExit": { argTypes: [CHILD_T, null], result: VOID },
|
|
755
|
+
"child.onClose": { argTypes: [CHILD_T, null], result: VOID },
|
|
707
756
|
"child.onError": { argTypes: [CHILD_T, null], result: VOID },
|
|
708
757
|
// Like process.envGet, spawnRes.status's result type is program-dependent
|
|
709
758
|
// (the interned `number | null` union) — the libCall case checks the arms.
|
|
@@ -734,7 +783,9 @@ export const LIB_FN_SIGS = {
|
|
|
734
783
|
// (zero-param / Buffer / Buffer-armed union) — the slots pin arity,
|
|
735
784
|
// the stream receiver, and the once-flag.
|
|
736
785
|
"stream.onData": { argTypes: [CHILDSTREAM_T, null, BOOL], result: VOID },
|
|
786
|
+
"stream.onDataStr": { argTypes: [CHILDSTREAM_T, null, BOOL], result: VOID },
|
|
737
787
|
"stream.onEnd": { argTypes: [CHILDSTREAM_T, null, BOOL], result: VOID },
|
|
788
|
+
"stream.childSetEncoding": { argTypes: [CHILDSTREAM_T, STRING], result: CHILDSTREAM_T },
|
|
738
789
|
"writer.writeString": { argTypes: [CHILDWRITER_T, STRING], result: BOOL },
|
|
739
790
|
"writer.writeBytes": { argTypes: [CHILDWRITER_T, BYTES_U8], result: BOOL },
|
|
740
791
|
"writer.end": { argTypes: [CHILDWRITER_T], result: VOID },
|
|
@@ -808,6 +859,19 @@ export const LIB_FN_SIGS = {
|
|
|
808
859
|
"fsp.readFileBytes": { argTypes: [STRING], result: { kind: "promise", inner: BYTES_U8 } },
|
|
809
860
|
"zlib.deflateSync": { argTypes: [BYTES_U8], result: BYTES_U8 },
|
|
810
861
|
"zlib.inflateSync": { argTypes: [BYTES_U8], result: BYTES_U8 },
|
|
862
|
+
"zlib.deflateRawSync": { argTypes: [BYTES_U8], result: BYTES_U8 },
|
|
863
|
+
"zlib.inflateRawSync": { argTypes: [BYTES_U8], result: BYTES_U8 },
|
|
864
|
+
"zlib.gzipSync": { argTypes: [BYTES_U8], result: BYTES_U8 },
|
|
865
|
+
"zlib.gunzipSync": { argTypes: [BYTES_U8], result: BYTES_U8 },
|
|
866
|
+
"zlib.unzipSync": { argTypes: [BYTES_U8], result: BYTES_U8 },
|
|
867
|
+
"zlib.deflateCb": { argTypes: [BYTES_U8, null], result: VOID },
|
|
868
|
+
"zlib.inflateCb": { argTypes: [BYTES_U8, null], result: VOID },
|
|
869
|
+
"zlib.deflateRawCb": { argTypes: [BYTES_U8, null], result: VOID },
|
|
870
|
+
"zlib.inflateRawCb": { argTypes: [BYTES_U8, null], result: VOID },
|
|
871
|
+
"zlib.gzipCb": { argTypes: [BYTES_U8, null], result: VOID },
|
|
872
|
+
"zlib.gunzipCb": { argTypes: [BYTES_U8, null], result: VOID },
|
|
873
|
+
"zlib.unzipCb": { argTypes: [BYTES_U8, null], result: VOID },
|
|
874
|
+
"zlib.crc32": { argTypes: [BYTES_U8, F64], result: F64 },
|
|
811
875
|
"process.stdoutWriteBytes": { argTypes: [BYTES_U8, STRING], result: BOOL },
|
|
812
876
|
"process.stderrWriteBytes": { argTypes: [BYTES_U8, STRING], result: BOOL },
|
|
813
877
|
// Completion callback is program-dependent: zero params, checked-dynamic,
|
|
@@ -825,8 +889,13 @@ export const LIB_FN_SIGS = {
|
|
|
825
889
|
"fsp.chmod": { argTypes: [STRING, F64], result: { kind: "promise", inner: VOID } },
|
|
826
890
|
"fsp.rename": { argTypes: [STRING, STRING], result: { kind: "promise", inner: VOID } },
|
|
827
891
|
"fsp.readdir": { argTypes: [STRING], result: { kind: "promise", inner: arrayOf(STRING) } },
|
|
892
|
+
// Result is promise<call-site Dirent record array>; the libCall case
|
|
893
|
+
// validates the program-dependent record shape below.
|
|
894
|
+
"fsp.readdirTypes": { argTypes: [STRING], result: { kind: "promise", inner: VOID } },
|
|
828
895
|
"fsp.rm": { argTypes: [STRING], result: { kind: "promise", inner: VOID } },
|
|
829
896
|
"fsp.stat": { argTypes: [STRING], result: { kind: "promise", inner: STATS_T } },
|
|
897
|
+
"fsp.realpath": { argTypes: [STRING], result: { kind: "promise", inner: STRING } },
|
|
898
|
+
"fsp.lstat": { argTypes: [STRING], result: { kind: "promise", inner: STATS_T } },
|
|
830
899
|
"fsp.open": { argTypes: [STRING, STRING, F64], result: { kind: "promise", inner: FILEHANDLE_T } },
|
|
831
900
|
"fileHandle.fd": { argTypes: [FILEHANDLE_T], result: F64 },
|
|
832
901
|
"fileHandle.close": { argTypes: [FILEHANDLE_T], result: { kind: "promise", inner: VOID } },
|
|
@@ -851,6 +920,8 @@ export const LIB_FN_SIGS = {
|
|
|
851
920
|
"process.envUnset": { argTypes: [STRING], result: VOID },
|
|
852
921
|
"process.envPairs": { argTypes: [], result: arrayOf(STRING) },
|
|
853
922
|
"process.exit": { argTypes: [F64], result: VOID },
|
|
923
|
+
"process.setExitCode": { argTypes: [F64], result: VOID },
|
|
924
|
+
"process.currentExitCode": { argTypes: [], result: F64 },
|
|
854
925
|
"process.cwd": { argTypes: [], result: STRING },
|
|
855
926
|
"process.pid": { argTypes: [], result: F64 },
|
|
856
927
|
"dyn.this": { argTypes: [], result: DYN },
|
|
@@ -869,6 +940,7 @@ export const LIB_FN_SIGS = {
|
|
|
869
940
|
"error.new": { argTypes: [STRING], result: VOID },
|
|
870
941
|
"error.nodeThrow": { argTypes: [F64, STRING, STRING], result: VOID },
|
|
871
942
|
"dyn.toStringCoerce": { argTypes: [DYN], result: STRING },
|
|
943
|
+
"dyn.toNumberCoerce": { argTypes: [DYN], result: F64 },
|
|
872
944
|
// Always throws; the result is the READ's declared type (a typed dummy
|
|
873
945
|
// the unwind abandons) — the libCall case skips the result check.
|
|
874
946
|
"global.undefRead": { argTypes: [STRING], result: VOID },
|
|
@@ -921,9 +993,11 @@ export const LIB_FN_SIGS = {
|
|
|
921
993
|
// once, prepend), offDyn (recv, name, cb dyn).
|
|
922
994
|
"emitter.checkListener": { argTypes: [DYN], result: VOID },
|
|
923
995
|
"emitter.onDyn": { argTypes: [null, STRING, DYN, null, BOOL, BOOL], result: VOID },
|
|
996
|
+
"emitter.onFlex": { argTypes: [null, STRING, DYN, BOOL, BOOL], result: VOID },
|
|
924
997
|
"emitter.offDyn": { argTypes: [null, STRING, DYN], result: VOID },
|
|
925
998
|
"emitter.removeAll": { argTypes: [null, STRING, BOOL], result: VOID },
|
|
926
999
|
"emitter.emit": { argTypes: [null, STRING], result: BOOL },
|
|
1000
|
+
"emitter.emitFlex": { argTypes: [null, STRING], result: BOOL },
|
|
927
1001
|
"emitter.emitError": { argTypes: [null, STRING, null], result: BOOL },
|
|
928
1002
|
"emitter.count": { argTypes: [null, STRING], result: F64 },
|
|
929
1003
|
"emitter.countFn": { argTypes: [null, STRING, null], result: F64 },
|
|
@@ -1035,6 +1109,7 @@ export const LIB_FN_SIGS = {
|
|
|
1035
1109
|
// The equality quartet over checked-dynamic operands (the frontend
|
|
1036
1110
|
// boxes a static side into the checked-dynamic tree first).
|
|
1037
1111
|
"assert.eqDyn": { argTypes: [DYN, DYN, BOOL, BOOL, STRING, BOOL], result: VOID },
|
|
1112
|
+
"assert.looseResult": { argTypes: [BOOL, BOOL, STRING, STRING, STRING, BOOL], result: VOID },
|
|
1038
1113
|
// The throws(fn, {shape}) accumulator: begin/slot calls never throw;
|
|
1039
1114
|
// shapeEnd throws the Comparison diff. The error slot is the
|
|
1040
1115
|
// %Error-narrowed caught value.
|
|
@@ -1139,6 +1214,7 @@ export const LIB_FN_SIGS = {
|
|
|
1139
1214
|
"date.newNow": { argTypes: [], result: DATE_T },
|
|
1140
1215
|
"date.newMs": { argTypes: [F64], result: DATE_T },
|
|
1141
1216
|
"date.newString": { argTypes: [STRING], result: DATE_T },
|
|
1217
|
+
"date.parse": { argTypes: [STRING], result: F64 },
|
|
1142
1218
|
"date.getTime": { argTypes: [DATE_T], result: F64 },
|
|
1143
1219
|
"date.valueOf": { argTypes: [DATE_T], result: F64 },
|
|
1144
1220
|
"date.toISOString": { argTypes: [F64], result: STRING },
|
|
@@ -1817,6 +1893,11 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
1817
1893
|
if (e.type.kind !== "string")
|
|
1818
1894
|
err("strLit must be string", e.loc);
|
|
1819
1895
|
break;
|
|
1896
|
+
case "moduleNsRef":
|
|
1897
|
+
if (e.type.kind !== "moduleNs" || e.type.moduleId !== e.moduleId) {
|
|
1898
|
+
err("moduleNsRef must match its moduleNs type", e.loc);
|
|
1899
|
+
}
|
|
1900
|
+
break;
|
|
1820
1901
|
case "boolLit":
|
|
1821
1902
|
if (e.type.kind !== "bool")
|
|
1822
1903
|
err("boolLit must be bool", e.loc);
|
|
@@ -1855,6 +1936,11 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
1855
1936
|
err(`bin ${e.op} on class values: right operand is ${e.right.type.kind}`, e.loc);
|
|
1856
1937
|
}
|
|
1857
1938
|
}
|
|
1939
|
+
else if (isEq && e.left.type.kind === "moduleNs") {
|
|
1940
|
+
if (e.right.type.kind !== "moduleNs") {
|
|
1941
|
+
err(`bin ${e.op} on module namespaces: right operand is ${e.right.type.kind}`, e.loc);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1858
1944
|
else if (isEq &&
|
|
1859
1945
|
(e.left.type.kind === "array" ||
|
|
1860
1946
|
e.left.type.kind === "map" ||
|
|
@@ -2859,7 +2945,7 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
2859
2945
|
// ISLAND-REST types (restAbi jsval) SPELL their trailing engine
|
|
2860
2946
|
// array param — the lifted signature matches directly, no
|
|
2861
2947
|
// hidden slot.
|
|
2862
|
-
const hiddenRest = e.type.rest === true && e.type.restAbi
|
|
2948
|
+
const hiddenRest = e.type.rest === true && e.type.restAbi === undefined;
|
|
2863
2949
|
const declared = hiddenRest ? target.params.slice(0, -1) : target.params;
|
|
2864
2950
|
const restOk = !hiddenRest ||
|
|
2865
2951
|
(target.params.length === e.type.params.length + 1 &&
|
|
@@ -3764,7 +3850,7 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
3764
3850
|
// The stream constructors (trailing option callbacks), write/end
|
|
3765
3851
|
// (the optional chunk/cb tail), and unpipe (the optional
|
|
3766
3852
|
// destination) admit a longer list the same way.
|
|
3767
|
-
const variadic = e.fn === "emitter.emit" ||
|
|
3853
|
+
const variadic = e.fn === "emitter.emit" || e.fn === "emitter.emitFlex" ||
|
|
3768
3854
|
e.fn === "readable.new" || e.fn === "writable.new" ||
|
|
3769
3855
|
e.fn === "duplex.new" || e.fn === "transform.new" ||
|
|
3770
3856
|
e.fn === "passthrough.new" ||
|
|
@@ -4121,7 +4207,7 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
4121
4207
|
err(`libCall http.reqH2Stream must return the 'Http2Stream | undefined' union`, e.loc);
|
|
4122
4208
|
break;
|
|
4123
4209
|
}
|
|
4124
|
-
if (e.fn === "http.reqHeader" || e.fn === "http.resGetHeader") {
|
|
4210
|
+
if (e.fn === "http.reqHeader" || e.fn === "http.reqTrailer" || e.fn === "http.resGetHeader") {
|
|
4125
4211
|
// Result is the interned `string | undefined` union (envGet's).
|
|
4126
4212
|
const def = e.type.kind === "union" ? unions.get(e.type.unionId) : undefined;
|
|
4127
4213
|
const ok = def &&
|
|
@@ -4133,6 +4219,15 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
4133
4219
|
}
|
|
4134
4220
|
break;
|
|
4135
4221
|
}
|
|
4222
|
+
if (e.fn === "http.reqHeaderValues" || e.fn === "http.reqTrailerValues") {
|
|
4223
|
+
const def = e.type.kind === "union" ? unions.get(e.type.unionId) : undefined;
|
|
4224
|
+
const ok = def && def.arms.length === 2 &&
|
|
4225
|
+
def.arms[0].kind === "array" && def.arms[0].elem.kind === "string" &&
|
|
4226
|
+
def.arms[1].kind === "undefinedT";
|
|
4227
|
+
if (!ok)
|
|
4228
|
+
err(`libCall ${e.fn} must return the 'string[] | undefined' union`, e.loc);
|
|
4229
|
+
break;
|
|
4230
|
+
}
|
|
4136
4231
|
if (e.fn === "net.createServerCb" || e.fn === "net.serverOnConnection" ||
|
|
4137
4232
|
e.fn === "net.serverOnSecureConnection" ||
|
|
4138
4233
|
e.fn === "net.sockOnData" || e.fn === "net.serverOnError" ||
|
|
@@ -4231,6 +4326,30 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
4231
4326
|
}
|
|
4232
4327
|
break;
|
|
4233
4328
|
}
|
|
4329
|
+
if (e.fn === "zlib.deflateCb" || e.fn === "zlib.inflateCb" ||
|
|
4330
|
+
e.fn === "zlib.deflateRawCb" || e.fn === "zlib.inflateRawCb" ||
|
|
4331
|
+
e.fn === "zlib.gzipCb" || e.fn === "zlib.gunzipCb" || e.fn === "zlib.unzipCb") {
|
|
4332
|
+
const cbT = e.args[1]?.type;
|
|
4333
|
+
let ok = cbT?.kind === "func" && cbT.ret.kind === "void" && cbT.params.length <= 2;
|
|
4334
|
+
if (ok && cbT?.kind === "func" && cbT.params.length >= 1) {
|
|
4335
|
+
const error = cbT.params[0];
|
|
4336
|
+
if (error.kind !== "dyn") {
|
|
4337
|
+
const def = error.kind === "union" ? unions.get(error.unionId) : undefined;
|
|
4338
|
+
ok = def !== undefined &&
|
|
4339
|
+
def.arms.some((arm) => arm.kind === "nullT") &&
|
|
4340
|
+
def.arms.some((arm) => arm.kind === "object" && arm.className === "%Error") &&
|
|
4341
|
+
def.arms.every((arm) => arm.kind === "nullT" || arm.kind === "undefinedT" ||
|
|
4342
|
+
(arm.kind === "object" && arm.className === "%Error"));
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
if (ok && cbT?.kind === "func" && cbT.params.length === 2) {
|
|
4346
|
+
const value = cbT.params[1];
|
|
4347
|
+
ok = value.kind === "dyn" || (value.kind === "bytes" && value.elem === "u8");
|
|
4348
|
+
}
|
|
4349
|
+
if (!ok)
|
|
4350
|
+
err(`libCall ${e.fn} callback shape (frontend must fence)`, e.loc);
|
|
4351
|
+
break;
|
|
4352
|
+
}
|
|
4234
4353
|
if (e.fn === "fs.renameCb" ||
|
|
4235
4354
|
e.fn === "process.stdoutWriteBytesCb" ||
|
|
4236
4355
|
e.fn === "process.stderrWriteBytesCb") {
|
|
@@ -4286,12 +4405,15 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
4286
4405
|
}
|
|
4287
4406
|
break;
|
|
4288
4407
|
}
|
|
4289
|
-
if (e.fn === "fs.readdirTypesSync") {
|
|
4408
|
+
if (e.fn === "fs.readdirTypesSync" || e.fn === "fsp.readdirTypes") {
|
|
4290
4409
|
// Result: the interned Dirent record array — {%dtype: f64,
|
|
4291
4410
|
// name: string, parentPath: string} rows (canonical field
|
|
4292
4411
|
// order; the structure lowerFsReaddirTypesCall pinned).
|
|
4293
|
-
const
|
|
4294
|
-
?
|
|
4412
|
+
const result = e.fn === "fsp.readdirTypes"
|
|
4413
|
+
? e.type.kind === "promise" ? e.type.inner : undefined
|
|
4414
|
+
: e.type;
|
|
4415
|
+
const shape = result?.kind === "array" && result.elem.kind === "record"
|
|
4416
|
+
? records.get(result.elem.shapeId)
|
|
4295
4417
|
: undefined;
|
|
4296
4418
|
const ok = shape !== undefined &&
|
|
4297
4419
|
!shape.tuple &&
|
|
@@ -4301,7 +4423,7 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
4301
4423
|
shape.fields[1].name === "name" && shape.fields[1].type.kind === "string" &&
|
|
4302
4424
|
shape.fields[2].name === "parentPath" && shape.fields[2].type.kind === "string";
|
|
4303
4425
|
if (!ok) {
|
|
4304
|
-
err(`libCall
|
|
4426
|
+
err(`libCall ${e.fn} must return ${e.fn === "fsp.readdirTypes" ? "a promise of " : ""}the Dirent record array`, e.loc);
|
|
4305
4427
|
}
|
|
4306
4428
|
break;
|
|
4307
4429
|
}
|
|
@@ -4341,18 +4463,43 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
4341
4463
|
}
|
|
4342
4464
|
break;
|
|
4343
4465
|
}
|
|
4344
|
-
if (e.fn === "
|
|
4466
|
+
if (e.fn === "cp.execFile") {
|
|
4467
|
+
const cb = e.args[2]?.type;
|
|
4468
|
+
if (cb?.kind !== "func" || cb.rest === true || cb.params.length > 3 || cb.ret.kind !== "void") {
|
|
4469
|
+
err(`libCall cp.execFile callback must be a non-rest void function with at most three parameters`, e.loc);
|
|
4470
|
+
}
|
|
4471
|
+
else {
|
|
4472
|
+
const error = cb.params[0];
|
|
4473
|
+
if (error !== undefined) {
|
|
4474
|
+
const def = error.kind === "union" ? unions.get(error.unionId) : undefined;
|
|
4475
|
+
if (!def || def.arms.length !== 2 ||
|
|
4476
|
+
!def.arms.some((arm) => arm.kind === "nullT") ||
|
|
4477
|
+
!def.arms.some((arm) => arm.kind === "object" && arm.className === "%Error")) {
|
|
4478
|
+
err(`libCall cp.execFile callback error parameter must be Error | null`, e.loc);
|
|
4479
|
+
}
|
|
4480
|
+
}
|
|
4481
|
+
const stdout = cb.params[1];
|
|
4482
|
+
if (stdout !== undefined && stdout.kind !== "string") {
|
|
4483
|
+
err(`libCall cp.execFile callback stdout parameter must be string`, e.loc);
|
|
4484
|
+
}
|
|
4485
|
+
const stderr = cb.params[2];
|
|
4486
|
+
if (stderr !== undefined && stderr.kind !== "string") {
|
|
4487
|
+
err(`libCall cp.execFile callback stderr parameter must be string`, e.loc);
|
|
4488
|
+
}
|
|
4489
|
+
}
|
|
4490
|
+
}
|
|
4491
|
+
if (e.fn === "child.onExit" || e.fn === "child.onClose" || e.fn === "child.onError") {
|
|
4345
4492
|
// The listener: a closure with no params, or exactly the
|
|
4346
4493
|
// supported parameter shapes per event — exit takes (code:
|
|
4347
4494
|
// number | null) with an optional (signal: string | null)
|
|
4348
4495
|
// second parameter, error exactly (err: %Error).
|
|
4349
4496
|
const cb = e.args[1];
|
|
4350
4497
|
const cbT = cb?.type;
|
|
4351
|
-
const maxParams = e.fn === "child.
|
|
4498
|
+
const maxParams = e.fn === "child.onError" ? 1 : 2;
|
|
4352
4499
|
let ok = cbT?.kind === "func" && cbT.ret.kind === "void" && cbT.params.length <= maxParams;
|
|
4353
4500
|
if (ok && cbT?.kind === "func" && cbT.params.length >= 1) {
|
|
4354
4501
|
const p = cbT.params[0];
|
|
4355
|
-
if (e.fn === "child.onExit") {
|
|
4502
|
+
if (e.fn === "child.onExit" || e.fn === "child.onClose") {
|
|
4356
4503
|
const def = p.kind === "union" ? unions.get(p.unionId) : undefined;
|
|
4357
4504
|
ok =
|
|
4358
4505
|
def !== undefined &&
|
|
@@ -4789,7 +4936,7 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
4789
4936
|
}
|
|
4790
4937
|
// The chaining forms return the receiver's own static class.
|
|
4791
4938
|
if (e.fn === "emitter.on" || e.fn === "emitter.off" ||
|
|
4792
|
-
e.fn === "emitter.onDyn" || e.fn === "emitter.offDyn" ||
|
|
4939
|
+
e.fn === "emitter.onDyn" || e.fn === "emitter.onFlex" || e.fn === "emitter.offDyn" ||
|
|
4793
4940
|
e.fn === "emitter.onData" || e.fn === "emitter.onDataDyn" ||
|
|
4794
4941
|
e.fn === "emitter.removeAll" || e.fn === "emitter.setMax" ||
|
|
4795
4942
|
e.fn === "emitter.setMaxChk") {
|
|
@@ -4836,7 +4983,12 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
4836
4983
|
err(`libCall emitter.listeners must return a func array`, e.loc);
|
|
4837
4984
|
break;
|
|
4838
4985
|
}
|
|
4839
|
-
if (e.fn === "emitter.
|
|
4986
|
+
if (e.fn === "emitter.emitFlex") {
|
|
4987
|
+
if (e.args.slice(2).some((arg) => arg.type.kind !== "dyn")) {
|
|
4988
|
+
err("libCall emitter.emitFlex payloads must be checked-dynamic", e.loc);
|
|
4989
|
+
}
|
|
4990
|
+
}
|
|
4991
|
+
if (e.fn === "emitter.emit" || e.fn === "emitter.emitFlex" || e.fn === "emitter.count" ||
|
|
4840
4992
|
e.fn === "emitter.getMax" || e.fn === "emitter.ctor" ||
|
|
4841
4993
|
e.fn === "emitter.countFn" || e.fn === "emitter.emitError") {
|
|
4842
4994
|
if (!typeEquals(e.type, sig.result)) {
|