@scriptc/compiler 0.2.0 → 0.2.1
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 +25 -15
- package/dist/backend/cycle-analysis.js +1 -0
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/llvm/classes.js +21 -5
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +5 -0
- package/dist/backend/llvm/dyn.js +166 -99
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +2 -2
- package/dist/backend/llvm/emitter.js +79 -20
- 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 +28 -17
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-control.js +1 -1
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +18 -9
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +11 -1
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-records.js +11 -3
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +125 -17
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +23 -3
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +45 -2
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/shapes.js +8 -2
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/native-toolchain.d.ts +3 -6
- package/dist/backend/native-toolchain.js +53 -23
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +72 -0
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/runtime-abi.d.ts +2 -2
- package/dist/backend/runtime-abi.js +2 -2
- package/dist/backend/runtime-pack-native.js +4 -1
- package/dist/backend/runtime-pack-native.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +1 -1
- package/dist/backend/runtime-pack.test.js +1 -1
- package/dist/backend/targets.js +10 -6
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +7 -0
- package/dist/backend/targets.test.js.map +1 -1
- package/dist/compat/fetch-profile.js +34 -4
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/diagnostics/diagnostic.js +2 -7
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/frontend/lowering/class-callbacks.d.ts +3 -3
- package/dist/frontend/lowering/class-callbacks.js +26 -15
- package/dist/frontend/lowering/class-callbacks.js.map +1 -1
- package/dist/frontend/lowering/class-construction.d.ts +12 -0
- package/dist/frontend/lowering/class-construction.js +156 -0
- package/dist/frontend/lowering/class-construction.js.map +1 -0
- package/dist/frontend/lowering/class-descriptors.d.ts +1 -0
- package/dist/frontend/lowering/class-descriptors.js +46 -5
- package/dist/frontend/lowering/class-descriptors.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +11 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.js +403 -48
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +2 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-instance-constructor.js +4 -1
- package/dist/frontend/lowering/class-instance-constructor.js.map +1 -1
- package/dist/frontend/lowering/class-method-values.d.ts +4 -1
- package/dist/frontend/lowering/class-method-values.js +72 -7
- package/dist/frontend/lowering/class-method-values.js.map +1 -1
- package/dist/frontend/lowering/class-prototypes.d.ts +5 -2
- package/dist/frontend/lowering/class-prototypes.js +121 -13
- package/dist/frontend/lowering/class-prototypes.js.map +1 -1
- package/dist/frontend/lowering/class-runtime-statics.d.ts +8 -0
- package/dist/frontend/lowering/class-runtime-statics.js +66 -0
- package/dist/frontend/lowering/class-runtime-statics.js.map +1 -0
- package/dist/frontend/lowering/class-static-data.js +2 -2
- package/dist/frontend/lowering/class-static-data.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.js +49 -13
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.js +19 -47
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/error-methods.d.ts +4 -1
- package/dist/frontend/lowering/error-methods.js +100 -1
- package/dist/frontend/lowering/error-methods.js.map +1 -1
- package/dist/frontend/lowering/expressions/native-proxy.js +3 -1
- package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +19 -11
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +38 -7
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +3 -4
- package/dist/frontend/lowering/expressions/optional-chains.js +69 -17
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/function-context.d.ts +11 -3
- package/dist/frontend/lowering/function-context.js +11 -5
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/generator-dynamic-dispatch.d.ts +1 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.js +39 -1
- package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.d.ts +2 -0
- package/dist/frontend/lowering/lib-boundary.js +54 -1
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.d.ts +7 -1
- package/dist/frontend/lowering/lower-builtin-values.js +113 -3
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-builtins.d.ts +6 -5
- package/dist/frontend/lowering/lower-builtins.js +156 -41
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +8 -5
- package/dist/frontend/lowering/lower-calls.js +448 -83
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +13 -13
- package/dist/frontend/lowering/lower-classes.js +650 -176
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.d.ts +9 -0
- package/dist/frontend/lowering/lower-containers.js +135 -36
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.js +3 -2
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +2 -2
- package/dist/frontend/lowering/lower-exprs.js +531 -126
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.js +12 -1
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +2 -0
- package/dist/frontend/lowering/lower-island.js +32 -10
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +220 -17
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.test.d.ts +1 -0
- package/dist/frontend/lowering/lower-modules.test.js +39 -0
- package/dist/frontend/lowering/lower-modules.test.js.map +1 -0
- package/dist/frontend/lowering/lower-stmts.d.ts +7 -3
- package/dist/frontend/lowering/lower-stmts.js +135 -26
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +1 -1
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +27 -1
- package/dist/frontend/lowering/lowerer.js +172 -50
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +149 -3
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +2 -0
- package/dist/frontend/lowering/surfaces.js +25 -8
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/text-decoder-encoding.d.ts +2 -0
- package/dist/frontend/lowering/text-decoder-encoding.js +5 -0
- package/dist/frontend/lowering/text-decoder-encoding.js.map +1 -1
- package/dist/frontend/lowering/unregistered-class-types.test.js +3 -3
- package/dist/frontend/lowering/unregistered-class-types.test.js.map +1 -1
- package/dist/frontend/npm-static-prune.js +116 -34
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static-prune.test.js +8 -0
- package/dist/frontend/npm-static-prune.test.js.map +1 -1
- package/dist/frontend/program.d.ts +1 -1
- package/dist/frontend/program.js +53 -24
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +18 -0
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/ts7/ast.js +4 -3
- package/dist/frontend/ts7/ast.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.js +5 -10
- package/dist/frontend/ts7/semantic-json.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +9 -1
- package/dist/frontend/type-mapper.js +90 -13
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/type-mapper.test.js +23 -0
- package/dist/frontend/type-mapper.test.js.map +1 -1
- package/dist/frontend/union-discriminants.d.ts +1 -1
- package/dist/frontend/union-discriminants.js +2 -2
- package/dist/frontend/union-discriminants.js.map +1 -1
- package/dist/ir/analysis.js +2 -0
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/ir.d.ts +52 -33
- package/dist/ir/ir.js +142 -42
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +35 -0
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/serialize.js +15 -3
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/serialize.test.js +5 -1
- package/dist/ir/serialize.test.js.map +1 -1
- package/dist/ir/validate.js +80 -11
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +61 -1
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/native/sanitizer.js +3 -1
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/toolchain.d.ts +1 -1
- package/dist/native/toolchain.js +26 -6
- package/dist/native/toolchain.js.map +1 -1
- package/dist/native/toolchain.test.js +53 -1
- package/dist/native/toolchain.test.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +56 -81
package/dist/ir/validate.js
CHANGED
|
@@ -40,6 +40,8 @@ export const REGEX_INTRINSIC_SIGS = {
|
|
|
40
40
|
// VOID here is the process.envGet sentinel; the regexIntrinsic case
|
|
41
41
|
// checks the union's arms.
|
|
42
42
|
match: { receiver: STRING, argTypes: [REGEX], result: VOID },
|
|
43
|
+
exec: { receiver: STRING, argTypes: [REGEX], result: VOID },
|
|
44
|
+
lastIndex: { receiver: REGEX, argTypes: [], result: F64 },
|
|
43
45
|
matchAll: { receiver: STRING, argTypes: [REGEX], result: arrayOf(arrayOf(STRING)) },
|
|
44
46
|
matchAllInto: { receiver: STRING, argTypes: [REGEX, arrayOf(F64)], result: arrayOf(arrayOf(STRING)) },
|
|
45
47
|
search: { receiver: STRING, argTypes: [REGEX], result: F64 },
|
|
@@ -60,6 +62,10 @@ export const REGEX_INTRINSIC_SIGS = {
|
|
|
60
62
|
export const LIB_FN_SIGS = {
|
|
61
63
|
"fetch.start": { argTypes: [STRING, DYN], result: { kind: "promise", inner: DYN } },
|
|
62
64
|
"fetch.responseNew": { argTypes: [DYN, DYN], result: DYN },
|
|
65
|
+
"fetch.input": { argTypes: [DYN, DYN], result: { kind: "promise", inner: DYN } },
|
|
66
|
+
"fetch.function": { argTypes: [], result: DYN },
|
|
67
|
+
"fetch.requestNew": { argTypes: [DYN, DYN], result: DYN },
|
|
68
|
+
"fetch.headersNew": { argTypes: [DYN], result: DYN },
|
|
63
69
|
"fetch.responseArrayBuffer": { argTypes: [DYN], result: { kind: "promise", inner: DYN } },
|
|
64
70
|
"fetch.responseJson": { argTypes: [DYN], result: { kind: "promise", inner: DYN } },
|
|
65
71
|
"fetch.responseText": { argTypes: [DYN], result: { kind: "promise", inner: STRING } },
|
|
@@ -72,6 +78,8 @@ export const LIB_FN_SIGS = {
|
|
|
72
78
|
// Program-dependent iterable: typed arrays/bytes/string stay intact so
|
|
73
79
|
// the native stream can pull lazily; checked-dynamic values are the
|
|
74
80
|
// fallback. The libCall validator below checks the closed set.
|
|
81
|
+
"fetch.webIs": { argTypes: [DYN, STRING], result: BOOL },
|
|
82
|
+
"fetch.streamIs": { argTypes: [DYN], result: BOOL },
|
|
75
83
|
"fetch.streamFrom": { argTypes: [null], result: DYN },
|
|
76
84
|
// The chunk/result record depends on ReadableStream<T>; validated below.
|
|
77
85
|
"fetch.readerRead": { argTypes: [DYN], result: VOID },
|
|
@@ -97,6 +105,7 @@ export const LIB_FN_SIGS = {
|
|
|
97
105
|
"dyn.globalSymbolHas": { argTypes: [SYMBOL_T], result: BOOL },
|
|
98
106
|
"dyn.globalSymbolDelete": { argTypes: [SYMBOL_T], result: VOID },
|
|
99
107
|
"dyn.typedRefIs": { argTypes: [DYN, STRING], result: BOOL },
|
|
108
|
+
"dyn.classIs": { argTypes: [DYN, STRING], result: BOOL },
|
|
100
109
|
"dyn.iterPack": { argTypes: [DYN, STRING], result: DYN },
|
|
101
110
|
"dyn.arrayFromIterator": { argTypes: [DYN], result: DYN },
|
|
102
111
|
"dyn.iterator": { argTypes: [DYN, STRING], result: DYN },
|
|
@@ -280,11 +289,13 @@ export const LIB_FN_SIGS = {
|
|
|
280
289
|
"str.btoa": { argTypes: [DYN], result: STRING },
|
|
281
290
|
"str.b64Missing": { argTypes: [], result: STRING },
|
|
282
291
|
"str.decodeUriComponent": { argTypes: [STRING], result: STRING },
|
|
292
|
+
"str.decodeUri": { argTypes: [STRING], result: STRING },
|
|
283
293
|
"str.encodeUri": { argTypes: [STRING], result: STRING },
|
|
284
294
|
"regexp.escape": { argTypes: [STRING], result: STRING },
|
|
285
295
|
"num.toExponential": { argTypes: [F64], result: STRING },
|
|
286
296
|
"num.toFixed0": { argTypes: [F64], result: STRING },
|
|
287
297
|
"num.toFixed": { argTypes: [F64, F64], result: STRING },
|
|
298
|
+
"num.toStringRadix": { argTypes: [F64, DYN], result: STRING },
|
|
288
299
|
"num.sameValue": { argTypes: [F64, F64], result: BOOL },
|
|
289
300
|
"intl.numFormatEnUs": { argTypes: [F64], result: STRING },
|
|
290
301
|
"sym.new": { argTypes: [STRING], result: SYMBOL_T },
|
|
@@ -343,6 +354,7 @@ export const LIB_FN_SIGS = {
|
|
|
343
354
|
"url.pathToFileURLPlatform": { argTypes: [STRING, BOOL], result: URL_T },
|
|
344
355
|
"url.pathToFileURLWin32": { argTypes: [STRING], result: URL_T },
|
|
345
356
|
"sp.new": { argTypes: [], result: SEARCH_PARAMS_T },
|
|
357
|
+
"sp.newChecked": { argTypes: [DYN], result: SEARCH_PARAMS_T },
|
|
346
358
|
"sp.parse": { argTypes: [STRING], result: SEARCH_PARAMS_T },
|
|
347
359
|
"sp.copy": { argTypes: [SEARCH_PARAMS_T], result: SEARCH_PARAMS_T },
|
|
348
360
|
// The pairs argument is string[][] — checked structurally below (the
|
|
@@ -856,6 +868,8 @@ export const LIB_FN_SIGS = {
|
|
|
856
868
|
"child.disconnect": { argTypes: [CHILD_T], result: VOID },
|
|
857
869
|
"child.onMessage": { argTypes: [CHILD_T, null, BOOL], result: VOID },
|
|
858
870
|
"child.onDisconnect": { argTypes: [CHILD_T, null, BOOL], result: VOID },
|
|
871
|
+
"child.onSpawn": { argTypes: [CHILD_T, null], result: VOID },
|
|
872
|
+
"child.onDyn": { argTypes: [CHILD_T, STRING, DYN], result: VOID },
|
|
859
873
|
"process.connected": { argTypes: [], result: BOOL },
|
|
860
874
|
"process.send": { argTypes: [STRING], result: BOOL },
|
|
861
875
|
"process.sendCb": { argTypes: [STRING, null], result: BOOL },
|
|
@@ -870,6 +884,7 @@ export const LIB_FN_SIGS = {
|
|
|
870
884
|
argTypes: [STRING, arrayOf(STRING), F64, F64, F64, F64, F64, BOOL, BOOL, BOOL, arrayOf(STRING), STRING],
|
|
871
885
|
result: CHILD_T,
|
|
872
886
|
},
|
|
887
|
+
"cp.spawnDynamic": { argTypes: [STRING, arrayOf(STRING), DYN], result: CHILD_T },
|
|
873
888
|
// The callback's func type is program-dependent (zero params, or the
|
|
874
889
|
// `number | null` union / the %Error class) — the libCall case checks
|
|
875
890
|
// the shape; the slot here only pins arity and the child receiver.
|
|
@@ -921,6 +936,7 @@ export const LIB_FN_SIGS = {
|
|
|
921
936
|
"child.kill": { argTypes: [CHILD_T, STRING], result: BOOL },
|
|
922
937
|
"child.killNum": { argTypes: [CHILD_T, F64], result: BOOL },
|
|
923
938
|
"child.unref": { argTypes: [CHILD_T], result: VOID },
|
|
939
|
+
"child.ref": { argTypes: [CHILD_T], result: VOID },
|
|
924
940
|
"spawnRes.stdout": { argTypes: [SPAWNRES_T], result: STRING },
|
|
925
941
|
"spawnRes.stderr": { argTypes: [SPAWNRES_T], result: STRING },
|
|
926
942
|
"crypto.randomUUID": { argTypes: [], result: STRING },
|
|
@@ -928,6 +944,7 @@ export const LIB_FN_SIGS = {
|
|
|
928
944
|
"crypto.randomBytes": { argTypes: [F64], result: BYTES_U8 },
|
|
929
945
|
"crypto.hashDigestStr": { argTypes: [STRING, STRING, STRING], result: STRING },
|
|
930
946
|
"crypto.hashDigestBytes": { argTypes: [STRING, BYTES_U8, STRING], result: STRING },
|
|
947
|
+
"crypto.native": { argTypes: [], result: DYN },
|
|
931
948
|
"crypto.hashNew": { argTypes: [STRING], result: CRYPTOHASH_T },
|
|
932
949
|
"crypto.hmacNewStr": { argTypes: [STRING, STRING], result: CRYPTOHMAC_T },
|
|
933
950
|
"crypto.hmacNewBytes": { argTypes: [STRING, BYTES_U8], result: CRYPTOHMAC_T },
|
|
@@ -953,6 +970,7 @@ export const LIB_FN_SIGS = {
|
|
|
953
970
|
"buffer.brand": { argTypes: [BYTES_U8], result: BYTES_U8 },
|
|
954
971
|
"buffer.fromDyn": { argTypes: [DYN, STRING], result: BYTES_U8 },
|
|
955
972
|
"buffer.concat": { argTypes: [arrayOf(BYTES_U8)], result: BYTES_U8 },
|
|
973
|
+
"buffer.byteLenDyn": { argTypes: [DYN, STRING], result: F64 },
|
|
956
974
|
"buffer.byteLenStr": { argTypes: [STRING, STRING], result: F64 },
|
|
957
975
|
"buffer.isEncoding": { argTypes: [STRING], result: BOOL },
|
|
958
976
|
"buffer.concatLen": { argTypes: [arrayOf(BYTES_U8), F64], result: BYTES_U8 },
|
|
@@ -1051,6 +1069,7 @@ export const LIB_FN_SIGS = {
|
|
|
1051
1069
|
"process.cwd": { argTypes: [], result: STRING },
|
|
1052
1070
|
"process.pid": { argTypes: [], result: F64 },
|
|
1053
1071
|
"dyn.this": { argTypes: [], result: DYN },
|
|
1072
|
+
"dyn.generatorThis": { argTypes: [], result: DYN },
|
|
1054
1073
|
"process.getuid": { argTypes: [], result: F64 },
|
|
1055
1074
|
"process.getgid": { argTypes: [], result: F64 },
|
|
1056
1075
|
"process.execPath": { argTypes: [], result: STRING },
|
|
@@ -1059,6 +1078,8 @@ export const LIB_FN_SIGS = {
|
|
|
1059
1078
|
"process.builtinId": { argTypes: [DYN, arrayOf(STRING)], result: STRING },
|
|
1060
1079
|
"process.builtinModule": { argTypes: [STRING, DYN], result: DYN },
|
|
1061
1080
|
"process.builtinUnsupported": { argTypes: [STRING, STRING], result: DYN },
|
|
1081
|
+
"fs.callbackValue": { argTypes: [STRING], result: DYN },
|
|
1082
|
+
"fs.callbackCall": { argTypes: [STRING, DYN], result: DYN },
|
|
1062
1083
|
"process.hrtimeValue": { argTypes: [], result: DYN },
|
|
1063
1084
|
"process.versionsNode": { argTypes: [], result: STRING },
|
|
1064
1085
|
"process.versionsOpenssl": { argTypes: [], result: STRING },
|
|
@@ -1075,6 +1096,7 @@ export const LIB_FN_SIGS = {
|
|
|
1075
1096
|
"error.cause": { argTypes: [null], result: DYN },
|
|
1076
1097
|
"error.hasCause": { argTypes: [null], result: BOOL },
|
|
1077
1098
|
"error.setCause": { argTypes: [null, DYN], result: VOID },
|
|
1099
|
+
"error.defineCause": { argTypes: [null, DYN], result: VOID },
|
|
1078
1100
|
"error.deleteCause": { argTypes: [null], result: VOID },
|
|
1079
1101
|
"error.nodeThrow": { argTypes: [F64, STRING, STRING], result: VOID },
|
|
1080
1102
|
"dyn.toStringCoerce": { argTypes: [DYN], result: STRING },
|
|
@@ -1083,9 +1105,11 @@ export const LIB_FN_SIGS = {
|
|
|
1083
1105
|
"dyn.toNumeric": { argTypes: [DYN], result: DYN },
|
|
1084
1106
|
"dyn.increment": { argTypes: [DYN, BOOL], result: DYN },
|
|
1085
1107
|
"dyn.numberConstructor": { argTypes: [DYN], result: F64 },
|
|
1108
|
+
"dyn.bigintConstructor": { argTypes: [DYN], result: BIGINT_T },
|
|
1086
1109
|
"dyn.toNumberCoerce": { argTypes: [DYN], result: F64 },
|
|
1087
1110
|
"dyn.add": { argTypes: [DYN, DYN], result: DYN },
|
|
1088
1111
|
"dyn.arithmetic": { argTypes: [DYN, DYN, STRING], result: DYN },
|
|
1112
|
+
"dyn.compare": { argTypes: [DYN, DYN, STRING], result: BOOL },
|
|
1089
1113
|
"dyn.bitwise": { argTypes: [DYN, DYN, STRING], result: DYN },
|
|
1090
1114
|
"dyn.proxyNew": { argTypes: [DYN, DYN], result: DYN },
|
|
1091
1115
|
// Always throws; the result is the READ's declared type (a typed dummy
|
|
@@ -1098,6 +1122,7 @@ export const LIB_FN_SIGS = {
|
|
|
1098
1122
|
"class.name": { argTypes: [null], result: STRING },
|
|
1099
1123
|
"error.ctor": { argTypes: [null, STRING], result: VOID },
|
|
1100
1124
|
"error.toString": { argTypes: [null], result: STRING },
|
|
1125
|
+
"dyn.sameValue": { argTypes: [DYN, DYN], result: BOOL },
|
|
1101
1126
|
"error.stack": { argTypes: [null], result: STRING },
|
|
1102
1127
|
"error.stackLimitGet": { argTypes: [], result: F64 },
|
|
1103
1128
|
"error.stackLimitSet": { argTypes: [F64], result: VOID },
|
|
@@ -1120,6 +1145,12 @@ export const LIB_FN_SIGS = {
|
|
|
1120
1145
|
"weakMap.new": { argTypes: [DYN], result: DYN },
|
|
1121
1146
|
"weakSet.new": { argTypes: [DYN], result: DYN },
|
|
1122
1147
|
"dyn.fromEntries": { argTypes: [DYN], result: DYN },
|
|
1148
|
+
"bytes.constructor": { argTypes: [STRING], result: DYN },
|
|
1149
|
+
"bytes.instanceOf": { argTypes: [DYN, DYN], result: BOOL },
|
|
1150
|
+
"bytes.construct": { argTypes: [DYN, DYN, STRING], result: DYN },
|
|
1151
|
+
"dyn.dataViewIs": { argTypes: [DYN], result: BOOL },
|
|
1152
|
+
"dyn.construct": { argTypes: [DYN, DYN, STRING], result: DYN },
|
|
1153
|
+
"arrayBuffer.constructor": { argTypes: [], result: DYN },
|
|
1123
1154
|
"arrayBuffer.new": { argTypes: [DYN], result: DYN },
|
|
1124
1155
|
"ffi.argument": { argTypes: [DYN, STRING], result: DYN },
|
|
1125
1156
|
"ffi.memoryModule": { argTypes: [DYN], result: DYN },
|
|
@@ -1144,14 +1175,20 @@ export const LIB_FN_SIGS = {
|
|
|
1144
1175
|
"dyn.propertyIsEnumerable": { argTypes: [DYN, STRING], result: BOOL },
|
|
1145
1176
|
"dyn.assign": { argTypes: [DYN, DYN], result: DYN },
|
|
1146
1177
|
"dyn.copyDataProperties": { argTypes: [DYN, DYN], result: DYN },
|
|
1178
|
+
"dyn.objectRest": { argTypes: [DYN, DYN], result: DYN },
|
|
1147
1179
|
"dyn.packPush": { argTypes: [DYN, DYN], result: VOID },
|
|
1148
1180
|
"dyn.packPushSpread": { argTypes: [DYN, DYN, STRING], result: VOID },
|
|
1149
1181
|
"dyn.packPushSpreadIter": { argTypes: [DYN, DYN], result: VOID },
|
|
1182
|
+
"dyn.reflectApply": { argTypes: [DYN, DYN, DYN], result: DYN },
|
|
1150
1183
|
"dyn.assignAll": { argTypes: [DYN, DYN], result: DYN },
|
|
1151
1184
|
"dyn.objCreateNullProto": { argTypes: [], result: DYN },
|
|
1152
1185
|
"dyn.arrayPrototype": { argTypes: [], result: DYN },
|
|
1186
|
+
"dyn.objectPrototype": { argTypes: [], result: DYN },
|
|
1187
|
+
"dyn.functionApply": { argTypes: [], result: DYN },
|
|
1188
|
+
"dyn.builtinMethod": { argTypes: [STRING, STRING], result: DYN },
|
|
1153
1189
|
"dyn.classPrototype": { argTypes: [DYN, DYN], result: DYN },
|
|
1154
1190
|
"dyn.classBasePrototype": { argTypes: [DYN], result: DYN },
|
|
1191
|
+
"dyn.classInherit": { argTypes: [DYN, DYN], result: DYN },
|
|
1155
1192
|
"dyn.classSuper": { argTypes: [DYN, DYN, DYN], result: VOID },
|
|
1156
1193
|
"dyn.assignPrototype": { argTypes: [DYN, DYN, DYN], result: DYN },
|
|
1157
1194
|
"dyn.objCreate": { argTypes: [DYN], result: DYN },
|
|
@@ -1159,6 +1196,7 @@ export const LIB_FN_SIGS = {
|
|
|
1159
1196
|
"dyn.getPrototype": { argTypes: [DYN], result: DYN },
|
|
1160
1197
|
"dyn.setPrototype": { argTypes: [DYN, DYN], result: DYN },
|
|
1161
1198
|
"dyn.getOwnPropertyNames": { argTypes: [DYN], result: DYN },
|
|
1199
|
+
"dyn.ownKeys": { argTypes: [DYN], result: DYN },
|
|
1162
1200
|
"dyn.getOwnPropertySymbols": { argTypes: [DYN], result: DYN },
|
|
1163
1201
|
"dyn.getOwnPropertyDescriptors": { argTypes: [DYN], result: DYN },
|
|
1164
1202
|
"dyn.preventExtensions": { argTypes: [DYN], result: DYN },
|
|
@@ -1171,6 +1209,7 @@ export const LIB_FN_SIGS = {
|
|
|
1171
1209
|
"dyn.cloneMissing": { argTypes: [], result: DYN },
|
|
1172
1210
|
"dyn.cloneTransferFail": { argTypes: [], result: DYN },
|
|
1173
1211
|
"regex.new": { argTypes: [STRING, STRING], result: REGEX },
|
|
1212
|
+
"regex.resetLastIndex": { argTypes: [REGEX, F64], result: VOID },
|
|
1174
1213
|
"regex.newChecked": { argTypes: [DYN, DYN], result: REGEX },
|
|
1175
1214
|
// node:events EventEmitter: receivers are emitter-hierarchy objects and
|
|
1176
1215
|
// the chaining forms (on/off/removeAll/setMax) return the receiver's
|
|
@@ -1258,6 +1297,8 @@ export const LIB_FN_SIGS = {
|
|
|
1258
1297
|
"readable.pushDyn": { argTypes: [null, DYN], result: BOOL },
|
|
1259
1298
|
"readable.unshift": { argTypes: [null, BYTES_U8], result: VOID },
|
|
1260
1299
|
"readable.unshiftStr": { argTypes: [null, STRING], result: VOID },
|
|
1300
|
+
"stream.onDyn": { argTypes: [null, STRING, DYN, BOOL, BOOL], result: VOID },
|
|
1301
|
+
"readable.readDyn": { argTypes: [null, DYN], result: DYN },
|
|
1261
1302
|
"readable.read": { argTypes: [null, F64], result: VOID },
|
|
1262
1303
|
"readable.pause": { argTypes: [null], result: VOID },
|
|
1263
1304
|
"readable.setEncoding": { argTypes: [null, STRING], result: VOID },
|
|
@@ -1437,7 +1478,13 @@ export const LIB_FN_SIGS = {
|
|
|
1437
1478
|
"date.parseGetTime": { argTypes: [STRING], result: F64 },
|
|
1438
1479
|
"date.utc": { argTypes: [F64, F64, F64, F64, F64, F64, F64], result: F64 },
|
|
1439
1480
|
"text.decode": { argTypes: [BYTES_U8], result: STRING },
|
|
1481
|
+
"bytes.bufferSource": { argTypes: [DYN], result: BYTES_U8 },
|
|
1482
|
+
"text.decodeBufferSource": { argTypes: [DYN], result: STRING },
|
|
1483
|
+
"text.decodeOptions": { argTypes: [BYTES_U8, BOOL, BOOL], result: STRING },
|
|
1484
|
+
"text.decodeStream": { argTypes: [DYN, BYTES_U8, F64, BOOL, BOOL, BOOL], result: STRING },
|
|
1485
|
+
"text.decodeLegacyOptions": { argTypes: [BYTES_U8, F64, BOOL, BOOL], result: STRING },
|
|
1440
1486
|
"text.decodeLegacy": { argTypes: [BYTES_U8, F64], result: STRING },
|
|
1487
|
+
"text.decoderEncoding": { argTypes: [DYN], result: F64 },
|
|
1441
1488
|
"fs.mkdirRecursiveSync": { argTypes: [STRING], result: VOID },
|
|
1442
1489
|
"fs.rmOptsSync": { argTypes: [STRING, BOOL, BOOL], result: VOID },
|
|
1443
1490
|
"fs.rmRetrySync": { argTypes: [STRING, BOOL, BOOL, F64, F64], result: VOID },
|
|
@@ -1695,6 +1742,12 @@ export function validateModule(mod) {
|
|
|
1695
1742
|
errors.push({ message: `class ${cls.name}: invalid local base capture`, loc: cls.loc });
|
|
1696
1743
|
}
|
|
1697
1744
|
}
|
|
1745
|
+
if (cls.baseValueGlobal !== undefined) {
|
|
1746
|
+
const global = mod.globals?.find((global) => global.id === cls.baseValueGlobal);
|
|
1747
|
+
if (cls.localBaseCapture !== undefined || !cls.base || global?.type.kind !== "classval" || global.type.className !== cls.base) {
|
|
1748
|
+
errors.push({ message: `class ${cls.name}: invalid computed base global`, loc: cls.loc });
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1698
1751
|
if (cls.jsLength !== undefined && (!Number.isSafeInteger(cls.jsLength) || cls.jsLength < 0)) {
|
|
1699
1752
|
errors.push({ message: `class ${cls.name}: invalid constructor length`, loc: cls.loc });
|
|
1700
1753
|
}
|
|
@@ -1704,6 +1757,20 @@ export function validateModule(mod) {
|
|
|
1704
1757
|
errors.push({ message: `class ${cls.name}: prototype data helper must be a noncapturing () => dyn function`, loc: cls.loc });
|
|
1705
1758
|
}
|
|
1706
1759
|
}
|
|
1760
|
+
if (cls.instancePrototypeHelper !== undefined) {
|
|
1761
|
+
const helper = functionsByName.get(cls.instancePrototypeHelper);
|
|
1762
|
+
const receiver = helper?.params[0]?.type;
|
|
1763
|
+
if (!helper || helper.params.length !== 1 || receiver?.kind !== "object" || receiver.className !== cls.name ||
|
|
1764
|
+
helper.returnType.kind !== "dyn" || helper.captures !== undefined || helper.classCaptures !== undefined) {
|
|
1765
|
+
errors.push({ message: `class ${cls.name}: instance prototype helper must be a noncapturing (instance) => dyn function`, loc: cls.loc });
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
for (const symbol of cls.symbolFields ?? []) {
|
|
1769
|
+
const global = mod.globals?.find((global) => global.id === symbol.globalId);
|
|
1770
|
+
if (global?.type.kind !== "symbol" || !cls.fields.some((field) => field.name === symbol.field)) {
|
|
1771
|
+
errors.push({ message: `class ${cls.name}: invalid symbol field metadata`, loc: cls.loc });
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1707
1774
|
const seen = new Set();
|
|
1708
1775
|
for (const f of cls.fields) {
|
|
1709
1776
|
if (seen.has(f.name)) {
|
|
@@ -1746,7 +1813,7 @@ export function validateModule(mod) {
|
|
|
1746
1813
|
errors.push({ message: `class ${cls.name}: undeclared base "${cls.base}"`, loc: cls.loc });
|
|
1747
1814
|
continue;
|
|
1748
1815
|
}
|
|
1749
|
-
if (base.localCaptures !== undefined && cls.localBaseCapture === undefined) {
|
|
1816
|
+
if (base.localCaptures !== undefined && cls.localBaseCapture === undefined && cls.baseValueGlobal === undefined) {
|
|
1750
1817
|
errors.push({ message: `class ${cls.name}: local base requires a captured constructor`, loc: cls.loc });
|
|
1751
1818
|
}
|
|
1752
1819
|
const seen = new Set([cls.name]);
|
|
@@ -2113,9 +2180,8 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
2113
2180
|
if (isUnitType(fn.returnType)) {
|
|
2114
2181
|
err(`return type is bare unit type ${fn.returnType.kind}`, fn.loc);
|
|
2115
2182
|
}
|
|
2116
|
-
//
|
|
2117
|
-
//
|
|
2118
|
-
// escape; a caught anywhere else is frontend breakage).
|
|
2183
|
+
// Exception snapshots may be captured, but are never public parameters
|
|
2184
|
+
// or return values. Their payload crosses those boundaries explicitly.
|
|
2119
2185
|
if (fn.returnType.kind === "caught")
|
|
2120
2186
|
err("return type is caught", fn.loc);
|
|
2121
2187
|
for (const p of fn.params) {
|
|
@@ -2133,8 +2199,6 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
2133
2199
|
err(`capture local "${c.localId}" is not boxed`, fn.loc);
|
|
2134
2200
|
else if (!typeEquals(local.type, c.type))
|
|
2135
2201
|
err(`capture local "${c.localId}" has the wrong type`, fn.loc);
|
|
2136
|
-
if (c.type.kind === "caught")
|
|
2137
|
-
err(`capture "${c.name}" is caught-typed`, fn.loc);
|
|
2138
2202
|
}
|
|
2139
2203
|
if (fn.classCaptures !== undefined) {
|
|
2140
2204
|
const self = fn.params[0];
|
|
@@ -2838,7 +2902,7 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
2838
2902
|
err(`toString of unknown union ${e.operand.type.unionId}`, e.loc);
|
|
2839
2903
|
}
|
|
2840
2904
|
else if (!def.arms.every((a) => a.kind === "undefinedT" || a.kind === "nullT" ||
|
|
2841
|
-
a.kind === "string" || a.kind === "f64" || a.kind === "bool" ||
|
|
2905
|
+
a.kind === "string" || a.kind === "f64" || a.kind === "bigint" || a.kind === "bool" ||
|
|
2842
2906
|
(a.kind === "bytes" && a.elem === "u8"))) {
|
|
2843
2907
|
err("toString union operand has a non-stringable arm (frontend must fence)", e.loc);
|
|
2844
2908
|
}
|
|
@@ -2908,7 +2972,7 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
2908
2972
|
if (want)
|
|
2909
2973
|
expectType(a, want, `regexIntrinsic ${e.method} arg ${i}`);
|
|
2910
2974
|
});
|
|
2911
|
-
if (e.method === "match") {
|
|
2975
|
+
if (e.method === "match" || e.method === "exec") {
|
|
2912
2976
|
// The `string[] | null` union (program-dependent id) — checked
|
|
2913
2977
|
// by arms, like the libCall case checks process.envGet.
|
|
2914
2978
|
const def = e.type.kind === "union" ? unions.get(e.type.unionId) : undefined;
|
|
@@ -4508,7 +4572,7 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
4508
4572
|
return;
|
|
4509
4573
|
if (checkLibEmitterCall(e, sig.result))
|
|
4510
4574
|
return;
|
|
4511
|
-
if (e.fn === "error.stack" || e.fn === "error.cause" || e.fn === "error.hasCause" || e.fn === "error.setCause" || e.fn === "error.deleteCause") {
|
|
4575
|
+
if (e.fn === "error.stack" || e.fn === "error.cause" || e.fn === "error.hasCause" || e.fn === "error.setCause" || e.fn === "error.defineCause" || e.fn === "error.deleteCause") {
|
|
4512
4576
|
const recv = e.args[0];
|
|
4513
4577
|
let cls = recv?.type.kind === "object" ? classes.get(recv.type.className) : undefined;
|
|
4514
4578
|
while (cls?.base)
|
|
@@ -5162,6 +5226,11 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
5162
5226
|
}
|
|
5163
5227
|
}
|
|
5164
5228
|
}
|
|
5229
|
+
if (e.fn === "child.onSpawn") {
|
|
5230
|
+
const cb = e.args[1];
|
|
5231
|
+
if (!cb || cb.type.kind !== "func" || cb.type.params.length !== 0 || cb.type.ret.kind !== "void")
|
|
5232
|
+
err("child.onSpawn callback must be () => void", e.loc);
|
|
5233
|
+
}
|
|
5165
5234
|
if (e.fn === "child.onExit" || e.fn === "child.onClose" || e.fn === "child.onError") {
|
|
5166
5235
|
// The listener: a closure with no params, or exactly the
|
|
5167
5236
|
// supported parameter shapes per event — exit takes (code:
|
|
@@ -5590,7 +5659,7 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
5590
5659
|
return false;
|
|
5591
5660
|
}
|
|
5592
5661
|
function checkLibEmitterCall(e, result) {
|
|
5593
|
-
if (e.fn.startsWith("emitter.") && e.fn !== "emitter.setDefaultMax" &&
|
|
5662
|
+
if ((e.fn.startsWith("emitter.") || e.fn === "stream.onDyn") && e.fn !== "emitter.setDefaultMax" &&
|
|
5594
5663
|
e.fn !== "emitter.setDefaultMaxChk" &&
|
|
5595
5664
|
e.fn !== "emitter.getDefaultMax" && e.fn !== "emitter.checkListener") {
|
|
5596
5665
|
// Receiver: an emitter-hierarchy object (the %EventEmitter class
|
|
@@ -5619,7 +5688,7 @@ function validateFunction(fn, functions, ffiByName, classes, records, unions, gl
|
|
|
5619
5688
|
}
|
|
5620
5689
|
// The chaining forms return the receiver's own static class.
|
|
5621
5690
|
if (e.fn === "emitter.on" || e.fn === "emitter.off" ||
|
|
5622
|
-
e.fn === "emitter.onDyn" || e.fn === "emitter.onFlex" || e.fn === "emitter.offDyn" ||
|
|
5691
|
+
e.fn === "emitter.onDyn" || (e.fn === "emitter.onFlex" || e.fn === "stream.onDyn") || e.fn === "emitter.offDyn" ||
|
|
5623
5692
|
e.fn === "emitter.onData" || e.fn === "emitter.onDataDyn" ||
|
|
5624
5693
|
e.fn === "emitter.removeAll" || e.fn === "emitter.setMax" ||
|
|
5625
5694
|
e.fn === "emitter.setMaxChk") {
|