@mirascript/wasm 0.1.0

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/lib/wasm.js ADDED
@@ -0,0 +1,1463 @@
1
+ let wasm;
2
+
3
+ let cachedUint8ArrayMemory0 = null;
4
+
5
+ function getUint8ArrayMemory0() {
6
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
7
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
8
+ }
9
+ return cachedUint8ArrayMemory0;
10
+ }
11
+
12
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
13
+
14
+ cachedTextDecoder.decode();
15
+
16
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
17
+ let numBytesDecoded = 0;
18
+ function decodeText(ptr, len) {
19
+ numBytesDecoded += len;
20
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
21
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
22
+ cachedTextDecoder.decode();
23
+ numBytesDecoded = len;
24
+ }
25
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
26
+ }
27
+
28
+ function getStringFromWasm0(ptr, len) {
29
+ ptr = ptr >>> 0;
30
+ return decodeText(ptr, len);
31
+ }
32
+
33
+ let heap = new Array(128).fill(undefined);
34
+
35
+ heap.push(undefined, null, true, false);
36
+
37
+ let heap_next = heap.length;
38
+
39
+ function addHeapObject(obj) {
40
+ if (heap_next === heap.length) heap.push(heap.length + 1);
41
+ const idx = heap_next;
42
+ heap_next = heap[idx];
43
+
44
+ heap[idx] = obj;
45
+ return idx;
46
+ }
47
+
48
+ function getObject(idx) { return heap[idx]; }
49
+
50
+ let WASM_VECTOR_LEN = 0;
51
+
52
+ const cachedTextEncoder = new TextEncoder();
53
+
54
+ if (!('encodeInto' in cachedTextEncoder)) {
55
+ cachedTextEncoder.encodeInto = function (arg, view) {
56
+ const buf = cachedTextEncoder.encode(arg);
57
+ view.set(buf);
58
+ return {
59
+ read: arg.length,
60
+ written: buf.length
61
+ };
62
+ }
63
+ }
64
+
65
+ function passStringToWasm0(arg, malloc, realloc) {
66
+
67
+ if (realloc === undefined) {
68
+ const buf = cachedTextEncoder.encode(arg);
69
+ const ptr = malloc(buf.length, 1) >>> 0;
70
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
71
+ WASM_VECTOR_LEN = buf.length;
72
+ return ptr;
73
+ }
74
+
75
+ let len = arg.length;
76
+ let ptr = malloc(len, 1) >>> 0;
77
+
78
+ const mem = getUint8ArrayMemory0();
79
+
80
+ let offset = 0;
81
+
82
+ for (; offset < len; offset++) {
83
+ const code = arg.charCodeAt(offset);
84
+ if (code > 0x7F) break;
85
+ mem[ptr + offset] = code;
86
+ }
87
+
88
+ if (offset !== len) {
89
+ if (offset !== 0) {
90
+ arg = arg.slice(offset);
91
+ }
92
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
93
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
94
+ const ret = cachedTextEncoder.encodeInto(arg, view);
95
+
96
+ offset += ret.written;
97
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
98
+ }
99
+
100
+ WASM_VECTOR_LEN = offset;
101
+ return ptr;
102
+ }
103
+
104
+ let cachedDataViewMemory0 = null;
105
+
106
+ function getDataViewMemory0() {
107
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
108
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
109
+ }
110
+ return cachedDataViewMemory0;
111
+ }
112
+
113
+ function dropObject(idx) {
114
+ if (idx < 132) return;
115
+ heap[idx] = heap_next;
116
+ heap_next = idx;
117
+ }
118
+
119
+ function takeObject(idx) {
120
+ const ret = getObject(idx);
121
+ dropObject(idx);
122
+ return ret;
123
+ }
124
+
125
+ function getArrayU8FromWasm0(ptr, len) {
126
+ ptr = ptr >>> 0;
127
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
128
+ }
129
+
130
+ let cachedUint32ArrayMemory0 = null;
131
+
132
+ function getUint32ArrayMemory0() {
133
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
134
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
135
+ }
136
+ return cachedUint32ArrayMemory0;
137
+ }
138
+
139
+ function getArrayU32FromWasm0(ptr, len) {
140
+ ptr = ptr >>> 0;
141
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
142
+ }
143
+
144
+ function passArray8ToWasm0(arg, malloc) {
145
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
146
+ getUint8ArrayMemory0().set(arg, ptr / 1);
147
+ WASM_VECTOR_LEN = arg.length;
148
+ return ptr;
149
+ }
150
+
151
+ function _assertClass(instance, klass) {
152
+ if (!(instance instanceof klass)) {
153
+ throw new Error(`expected instance of ${klass.name}`);
154
+ }
155
+ }
156
+ /**
157
+ * @param {Uint8Array} script
158
+ * @param {Config} config
159
+ * @returns {CompileResult}
160
+ */
161
+ export function compile_buffer(script, config) {
162
+ const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export_1);
163
+ const len0 = WASM_VECTOR_LEN;
164
+ _assertClass(config, Config);
165
+ const ret = wasm.compile_buffer(ptr0, len0, config.__wbg_ptr);
166
+ return CompileResult.__wrap(ret);
167
+ }
168
+
169
+ /**
170
+ * @param {string} script
171
+ * @param {Config} config
172
+ * @returns {CompileResult}
173
+ */
174
+ export function compile(script, config) {
175
+ const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
176
+ const len0 = WASM_VECTOR_LEN;
177
+ _assertClass(config, Config);
178
+ const ret = wasm.compile(ptr0, len0, config.__wbg_ptr);
179
+ return CompileResult.__wrap(ret);
180
+ }
181
+
182
+ /**
183
+ * @param {DiagnosticCode} code
184
+ * @returns {string | undefined}
185
+ */
186
+ export function get_diagnostic_message(code) {
187
+ try {
188
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
189
+ wasm.get_diagnostic_message(retptr, code);
190
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
191
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
192
+ let v1;
193
+ if (r0 !== 0) {
194
+ v1 = getStringFromWasm0(r0, r1).slice();
195
+ wasm.__wbindgen_export_0(r0, r1 * 1, 1);
196
+ }
197
+ return v1;
198
+ } finally {
199
+ wasm.__wbindgen_add_to_stack_pointer(16);
200
+ }
201
+ }
202
+
203
+ function getArrayJsValueFromWasm0(ptr, len) {
204
+ ptr = ptr >>> 0;
205
+ const mem = getDataViewMemory0();
206
+ const result = [];
207
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
208
+ result.push(takeObject(mem.getUint32(i, true)));
209
+ }
210
+ return result;
211
+ }
212
+ /**
213
+ * @returns {string[]}
214
+ */
215
+ export function keywords() {
216
+ try {
217
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
218
+ wasm.keywords(retptr);
219
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
220
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
221
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
222
+ wasm.__wbindgen_export_0(r0, r1 * 4, 4);
223
+ return v1;
224
+ } finally {
225
+ wasm.__wbindgen_add_to_stack_pointer(16);
226
+ }
227
+ }
228
+
229
+ /**
230
+ * @returns {string[]}
231
+ */
232
+ export function control_keywords() {
233
+ try {
234
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
235
+ wasm.control_keywords(retptr);
236
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
237
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
238
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
239
+ wasm.__wbindgen_export_0(r0, r1 * 4, 4);
240
+ return v1;
241
+ } finally {
242
+ wasm.__wbindgen_add_to_stack_pointer(16);
243
+ }
244
+ }
245
+
246
+ /**
247
+ * @returns {string[]}
248
+ */
249
+ export function numeric_keywords() {
250
+ try {
251
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
252
+ wasm.numeric_keywords(retptr);
253
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
254
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
255
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
256
+ wasm.__wbindgen_export_0(r0, r1 * 4, 4);
257
+ return v1;
258
+ } finally {
259
+ wasm.__wbindgen_add_to_stack_pointer(16);
260
+ }
261
+ }
262
+
263
+ /**
264
+ * @returns {string[]}
265
+ */
266
+ export function constant_keywords() {
267
+ try {
268
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
269
+ wasm.constant_keywords(retptr);
270
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
271
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
272
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
273
+ wasm.__wbindgen_export_0(r0, r1 * 4, 4);
274
+ return v1;
275
+ } finally {
276
+ wasm.__wbindgen_add_to_stack_pointer(16);
277
+ }
278
+ }
279
+
280
+ /**
281
+ * @returns {string[]}
282
+ */
283
+ export function reserved_keywords() {
284
+ try {
285
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
286
+ wasm.reserved_keywords(retptr);
287
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
288
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
289
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
290
+ wasm.__wbindgen_export_0(r0, r1 * 4, 4);
291
+ return v1;
292
+ } finally {
293
+ wasm.__wbindgen_add_to_stack_pointer(16);
294
+ }
295
+ }
296
+
297
+ export function main() {
298
+ wasm.main();
299
+ }
300
+
301
+ /**
302
+ * @enum {1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1999 | 2000 | 2001 | 2002 | 2003 | 2004 | 2999 | 3000 | 3999 | 4000 | 4001 | 4002 | 4999 | 5000 | 5001 | 5002 | 5003 | 5004 | 5005 | 5006 | 5999 | 10000 | 10001 | 10002 | 10003 | 10004 | 10005 | 10006 | 10007 | 10008 | 10009 | 10010 | 10011 | 10012 | 10013 | 10014 | 10015 | 10016 | 10017 | 10018 | 10019 | 10020 | 10021 | 10022 | 10023 | 10024 | 10025 | 10026 | 10027 | 10028 | 10029 | 10030 | 10031 | 10032 | 10033 | 10034 | 10035 | 10036 | 10037 | 10038 | 10039 | 10040 | 10041 | 10042 | 10999 | 11000 | 11001 | 11002 | 11003 | 11004 | 11005 | 11006 | 11007 | 11008 | 11009 | 11010 | 11011 | 11012 | 11013 | 11014 | 11015 | 11016 | 11017 | 11018 | 11019 | 11020 | 11021 | 11022 | 11023 | 11999}
303
+ */
304
+ export const DiagnosticCode = Object.freeze({
305
+ ErrorStart: 1000, "1000": "ErrorStart",
306
+ InternalError: 1001, "1001": "InternalError",
307
+ LexerError: 1002, "1002": "LexerError",
308
+ ParserError: 1003, "1003": "ParserError",
309
+ EmitterError: 1004, "1004": "EmitterError",
310
+ OptimizerError: 1005, "1005": "OptimizerError",
311
+ Unimplemented: 1006, "1006": "Unimplemented",
312
+ UnknownToken: 1007, "1007": "UnknownToken",
313
+ UnexpectedToken: 1008, "1008": "UnexpectedToken",
314
+ InvalidReservedKeyword: 1009, "1009": "InvalidReservedKeyword",
315
+ InvalidKeyword: 1010, "1010": "InvalidKeyword",
316
+ InvalidNumberLiteralUnderscore: 1011, "1011": "InvalidNumberLiteralUnderscore",
317
+ InvalidNumberLiteral: 1012, "1012": "InvalidNumberLiteral",
318
+ OverflowNumberLiteral: 1013, "1013": "OverflowNumberLiteral",
319
+ OverflowIntegerLiteral: 1014, "1014": "OverflowIntegerLiteral",
320
+ InvalidOrdinalLiteral: 1015, "1015": "InvalidOrdinalLiteral",
321
+ UnterminatedString: 1016, "1016": "UnterminatedString",
322
+ InvalidEscapeSequence: 1017, "1017": "InvalidEscapeSequence",
323
+ InvalidHexEscapeSequence: 1018, "1018": "InvalidHexEscapeSequence",
324
+ InvalidUnicodeEscapeSequence: 1019, "1019": "InvalidUnicodeEscapeSequence",
325
+ BadArraySpread: 1020, "1020": "BadArraySpread",
326
+ UnterminatedInterpolation: 1021, "1021": "UnterminatedInterpolation",
327
+ BadInterpolation: 1022, "1022": "BadInterpolation",
328
+ UnexpectedUnderscore: 1023, "1023": "UnexpectedUnderscore",
329
+ UnexpectedGlobal: 1024, "1024": "UnexpectedGlobal",
330
+ MissingComma: 1025, "1025": "MissingComma",
331
+ MissingCloseBracket: 1026, "1026": "MissingCloseBracket",
332
+ MissingOpenBrace: 1027, "1027": "MissingOpenBrace",
333
+ MissingCloseBrace: 1028, "1028": "MissingCloseBrace",
334
+ MissingCloseParen: 1029, "1029": "MissingCloseParen",
335
+ MissingSemicolon: 1030, "1030": "MissingSemicolon",
336
+ MissingBindOperator: 1031, "1031": "MissingBindOperator",
337
+ InvalidConstName: 1032, "1032": "InvalidConstName",
338
+ MissingFunctionName: 1033, "1033": "MissingFunctionName",
339
+ MissingOpenParenAfterExtension: 1034, "1034": "MissingOpenParenAfterExtension",
340
+ MissingOpenParenAfterType: 1035, "1035": "MissingOpenParenAfterType",
341
+ InvalidTypeCall: 1036, "1036": "InvalidTypeCall",
342
+ RecordLiteralInExtensionCaller: 1037, "1037": "RecordLiteralInExtensionCaller",
343
+ MissingCase: 1038, "1038": "MissingCase",
344
+ UnknownExpression: 1039, "1039": "UnknownExpression",
345
+ UnmatchedCloseBrace: 1040, "1040": "UnmatchedCloseBrace",
346
+ UnmatchedCloseBracket: 1041, "1041": "UnmatchedCloseBracket",
347
+ UnmatchedCloseParen: 1042, "1042": "UnmatchedCloseParen",
348
+ UnknownPattern: 1043, "1043": "UnknownPattern",
349
+ UnknownStatement: 1044, "1044": "UnknownStatement",
350
+ ExpressionExpected: 1045, "1045": "ExpressionExpected",
351
+ PatternExpected: 1046, "1046": "PatternExpected",
352
+ ExclamationInLiteralPattern: 1047, "1047": "ExclamationInLiteralPattern",
353
+ UnexpectedOperatorInLiteralPattern: 1048, "1048": "UnexpectedOperatorInLiteralPattern",
354
+ MutInRebindPattern: 1049, "1049": "MutInRebindPattern",
355
+ ConstantInBindPattern: 1050, "1050": "ConstantInBindPattern",
356
+ MutInDiscardPattern: 1051, "1051": "MutInDiscardPattern",
357
+ DiscardInSpreadPattern: 1052, "1052": "DiscardInSpreadPattern",
358
+ SpreadDiscardInRecordPattern: 1053, "1053": "SpreadDiscardInRecordPattern",
359
+ MispositionedSpreadInRecordPattern: 1054, "1054": "MispositionedSpreadInRecordPattern",
360
+ InterpolatedNameRecordPattern: 1055, "1055": "InterpolatedNameRecordPattern",
361
+ BadOmitKeyRecordPattern: 1056, "1056": "BadOmitKeyRecordPattern",
362
+ AmbiguousRangePattern: 1057, "1057": "AmbiguousRangePattern",
363
+ DuplicateSpreadPattern: 1058, "1058": "DuplicateSpreadPattern",
364
+ MispositionedRestParameter: 1059, "1059": "MispositionedRestParameter",
365
+ UndefinedVariableAssignment: 1060, "1060": "UndefinedVariableAssignment",
366
+ ImmutableVariableAssignment: 1061, "1061": "ImmutableVariableAssignment",
367
+ UninitializedVariable: 1062, "1062": "UninitializedVariable",
368
+ DuplicateVariableDeclaration: 1063, "1063": "DuplicateVariableDeclaration",
369
+ UnexpectedBreak: 1064, "1064": "UnexpectedBreak",
370
+ UnexpectedContinue: 1065, "1065": "UnexpectedContinue",
371
+ MisuseOfGlobalKeyword: 1066, "1066": "MisuseOfGlobalKeyword",
372
+ BadOmitKeyRecordExpression: 1067, "1067": "BadOmitKeyRecordExpression",
373
+ UnassignableExpression: 1068, "1068": "UnassignableExpression",
374
+ ErrorEnd: 1999, "1999": "ErrorEnd",
375
+ WarningStart: 2000, "2000": "WarningStart",
376
+ UnnecessaryParentheses: 2001, "2001": "UnnecessaryParentheses",
377
+ MisleadingNilVariable: 2002, "2002": "MisleadingNilVariable",
378
+ UnnecessaryIrrefutablePattern: 2003, "2003": "UnnecessaryIrrefutablePattern",
379
+ MisleadingOrInIrrefutablePattern: 2004, "2004": "MisleadingOrInIrrefutablePattern",
380
+ WarningEnd: 2999, "2999": "WarningEnd",
381
+ InfoStart: 3000, "3000": "InfoStart",
382
+ InfoEnd: 3999, "3999": "InfoEnd",
383
+ HintStart: 4000, "4000": "HintStart",
384
+ UnusedLocalVariable: 4001, "4001": "UnusedLocalVariable",
385
+ UnusedLocalFunction: 4002, "4002": "UnusedLocalFunction",
386
+ HintEnd: 4999, "4999": "HintEnd",
387
+ ReferenceStart: 5000, "5000": "ReferenceStart",
388
+ VariableDeclaredHere: 5001, "5001": "VariableDeclaredHere",
389
+ FunctionDeclaredHere: 5002, "5002": "FunctionDeclaredHere",
390
+ ParameterDeclaredHere: 5003, "5003": "ParameterDeclaredHere",
391
+ ParameterItDeclaredHere: 5004, "5004": "ParameterItDeclaredHere",
392
+ ParameterRestDeclaredHere: 5005, "5005": "ParameterRestDeclaredHere",
393
+ ParameterSubPatternDeclaredHere: 5006, "5006": "ParameterSubPatternDeclaredHere",
394
+ ReferenceEnd: 5999, "5999": "ReferenceEnd",
395
+ TagStart: 10000, "10000": "TagStart",
396
+ LocalConst: 10001, "10001": "LocalConst",
397
+ LocalImmutable: 10002, "10002": "LocalImmutable",
398
+ LocalMutable: 10003, "10003": "LocalMutable",
399
+ LocalFunction: 10004, "10004": "LocalFunction",
400
+ ParameterIt: 10005, "10005": "ParameterIt",
401
+ ParameterImmutable: 10006, "10006": "ParameterImmutable",
402
+ ParameterMutable: 10007, "10007": "ParameterMutable",
403
+ ParameterImmutableRest: 10008, "10008": "ParameterImmutableRest",
404
+ ParameterMutableRest: 10009, "10009": "ParameterMutableRest",
405
+ ParameterPattern: 10010, "10010": "ParameterPattern",
406
+ ParameterRestPattern: 10011, "10011": "ParameterRestPattern",
407
+ ParameterSubPatternImmutable: 10012, "10012": "ParameterSubPatternImmutable",
408
+ ParameterSubPatternMutable: 10013, "10013": "ParameterSubPatternMutable",
409
+ GlobalVariable: 10014, "10014": "GlobalVariable",
410
+ GlobalDynamicAccess: 10015, "10015": "GlobalDynamicAccess",
411
+ RecordFieldIdName: 10016, "10016": "RecordFieldIdName",
412
+ RecordFieldOrdinalName: 10017, "10017": "RecordFieldOrdinalName",
413
+ RecordFieldStringName: 10018, "10018": "RecordFieldStringName",
414
+ UnnamedRecordField0: 10019, "10019": "UnnamedRecordField0",
415
+ UnnamedRecordField1: 10020, "10020": "UnnamedRecordField1",
416
+ UnnamedRecordField2: 10021, "10021": "UnnamedRecordField2",
417
+ UnnamedRecordField3: 10022, "10022": "UnnamedRecordField3",
418
+ UnnamedRecordField4: 10023, "10023": "UnnamedRecordField4",
419
+ UnnamedRecordField5: 10024, "10024": "UnnamedRecordField5",
420
+ UnnamedRecordField6: 10025, "10025": "UnnamedRecordField6",
421
+ UnnamedRecordField7: 10026, "10026": "UnnamedRecordField7",
422
+ UnnamedRecordField8: 10027, "10027": "UnnamedRecordField8",
423
+ UnnamedRecordField9: 10028, "10028": "UnnamedRecordField9",
424
+ UnnamedRecordFieldN: 10029, "10029": "UnnamedRecordFieldN",
425
+ OmitNamedRecordField: 10030, "10030": "OmitNamedRecordField",
426
+ FunctionCall: 10031, "10031": "FunctionCall",
427
+ ExtensionCall: 10032, "10032": "ExtensionCall",
428
+ Scope: 10033, "10033": "Scope",
429
+ String: 10034, "10034": "String",
430
+ Interpolation: 10035, "10035": "Interpolation",
431
+ ForExpression: 10036, "10036": "ForExpression",
432
+ WhileExpression: 10037, "10037": "WhileExpression",
433
+ LoopExpression: 10038, "10038": "LoopExpression",
434
+ FnDeclaration: 10039, "10039": "FnDeclaration",
435
+ FnExpression: 10040, "10040": "FnExpression",
436
+ IfExpression: 10041, "10041": "IfExpression",
437
+ MatchExpression: 10042, "10042": "MatchExpression",
438
+ TagEnd: 10999, "10999": "TagEnd",
439
+ TagRefStart: 11000, "11000": "TagRefStart",
440
+ ReadLocal: 11001, "11001": "ReadLocal",
441
+ ReadWriteLocal: 11002, "11002": "ReadWriteLocal",
442
+ WriteLocal: 11003, "11003": "WriteLocal",
443
+ RedeclareLocal: 11004, "11004": "RedeclareLocal",
444
+ Callable: 11005, "11005": "Callable",
445
+ ArgumentExtension: 11006, "11006": "ArgumentExtension",
446
+ ArgumentStart: 11007, "11007": "ArgumentStart",
447
+ ArgumentEnd: 11008, "11008": "ArgumentEnd",
448
+ ArgumentComma: 11009, "11009": "ArgumentComma",
449
+ ArgumentSpread: 11010, "11010": "ArgumentSpread",
450
+ KeywordFor: 11011, "11011": "KeywordFor",
451
+ KeywordIn: 11012, "11012": "KeywordIn",
452
+ KeywordWhile: 11013, "11013": "KeywordWhile",
453
+ KeywordLoop: 11014, "11014": "KeywordLoop",
454
+ KeywordBreak: 11015, "11015": "KeywordBreak",
455
+ KeywordContinue: 11016, "11016": "KeywordContinue",
456
+ KeywordIf: 11017, "11017": "KeywordIf",
457
+ KeywordElse: 11018, "11018": "KeywordElse",
458
+ KeywordMatch: 11019, "11019": "KeywordMatch",
459
+ KeywordCase: 11020, "11020": "KeywordCase",
460
+ KeywordFn: 11021, "11021": "KeywordFn",
461
+ KeywordReturn: 11022, "11022": "KeywordReturn",
462
+ /**
463
+ * Work with [DiagnosticCode::OmitNamedRecordField]
464
+ */
465
+ OmitNamedRecordFieldName: 11023, "11023": "OmitNamedRecordFieldName",
466
+ TagRefEnd: 11999, "11999": "TagRefEnd",
467
+ });
468
+ /**
469
+ * Encoding for counting positions in diagnostics.
470
+ * @enum {0 | 1 | 2 | 3}
471
+ */
472
+ export const DiagnosticPositionEncoding = Object.freeze({
473
+ /**
474
+ * Use the default encoding (UTF-8) and
475
+ * 0-based indexing from the start of the file.
476
+ * Do not convert positions to line-column format.
477
+ */
478
+ None: 0, "0": "None",
479
+ /**
480
+ * Convert positions to 1-based UTF-8 line-column format.
481
+ */
482
+ Utf8: 1, "1": "Utf8",
483
+ /**
484
+ * Convert positions to 1-based UTF-16 line-column format.
485
+ */
486
+ Utf16: 2, "2": "Utf16",
487
+ /**
488
+ * Convert positions to 1-based UTF-32 line-column format.
489
+ */
490
+ Utf32: 3, "3": "Utf32",
491
+ });
492
+ /**
493
+ * Mode for reading input.
494
+ * @enum {0 | 1}
495
+ */
496
+ export const InputMode = Object.freeze({
497
+ Script: 0, "0": "Script",
498
+ Template: 1, "1": "Template",
499
+ });
500
+ /**
501
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98}
502
+ */
503
+ export const OpCode = Object.freeze({
504
+ /**
505
+ * No operation
506
+ */
507
+ Noop: 0, "0": "Noop",
508
+ /**
509
+ * ADD %ret %1 %2\
510
+ * %ret = %1 + %2
511
+ */
512
+ Add: 1, "1": "Add",
513
+ /**
514
+ * SUB %ret %1 %2\
515
+ * %ret = %1 - %2
516
+ */
517
+ Sub: 2, "2": "Sub",
518
+ /**
519
+ * MUL %ret %1 %2\
520
+ * %ret = %1 * %2
521
+ */
522
+ Mul: 3, "3": "Mul",
523
+ /**
524
+ * DIV %ret %1 %2\
525
+ * %ret = %1 / %2
526
+ */
527
+ Div: 4, "4": "Div",
528
+ /**
529
+ * MOD %ret %1 %2\
530
+ * %ret = %1 % %2
531
+ */
532
+ Mod: 5, "5": "Mod",
533
+ /**
534
+ * EXP %ret %1 %2\
535
+ * %ret = %1 ^ %2
536
+ */
537
+ Pow: 6, "6": "Pow",
538
+ /**
539
+ * POS %ret %1\
540
+ * %ret = +%1
541
+ */
542
+ Pos: 7, "7": "Pos",
543
+ /**
544
+ * NEG %ret %1\
545
+ * %ret = -%1
546
+ */
547
+ Neg: 8, "8": "Neg",
548
+ /**
549
+ * NOT %ret %1\
550
+ * %ret = !%1
551
+ */
552
+ Not: 9, "9": "Not",
553
+ /**
554
+ * PLUS %ret %1\
555
+ * %ret = +%1
556
+ */
557
+ Plus: 10, "10": "Plus",
558
+ /**
559
+ * EQ %ret %1 %2\
560
+ * %ret = %1 == %2
561
+ */
562
+ Eq: 11, "11": "Eq",
563
+ /**
564
+ * NEQ %ret %1 %2\
565
+ * %ret = %1 != %2
566
+ */
567
+ Neq: 12, "12": "Neq",
568
+ /**
569
+ * LT %ret %1 %2\
570
+ * %ret = %1 < %2
571
+ */
572
+ Lt: 13, "13": "Lt",
573
+ /**
574
+ * LTE %ret %1 %2\
575
+ * %ret = %1 <= %2
576
+ */
577
+ Lte: 14, "14": "Lte",
578
+ /**
579
+ * GT %ret %1 %2\
580
+ * %ret = %1 > %2
581
+ */
582
+ Gt: 15, "15": "Gt",
583
+ /**
584
+ * GTE %ret %1 %2\
585
+ * %ret = %1 >= %2
586
+ */
587
+ Gte: 16, "16": "Gte",
588
+ /**
589
+ * AEQ %ret %1 %2\
590
+ * %ret = %1 =~ %2
591
+ */
592
+ Aeq: 17, "17": "Aeq",
593
+ /**
594
+ * NAEQ %ret %1 %2\
595
+ * %ret = %1 !~ %2
596
+ */
597
+ Naeq: 18, "18": "Naeq",
598
+ /**
599
+ * SAME %ret %1 %2\
600
+ * %ret = %1 === %2 // Same value zero
601
+ */
602
+ Same: 19, "19": "Same",
603
+ /**
604
+ * Nsame %ret %1 %2\
605
+ * %ret = %1 !== %2
606
+ */
607
+ Nsame: 20, "20": "Nsame",
608
+ /**
609
+ * IN %ret %1 %2\
610
+ * %ret = %1 in %2
611
+ */
612
+ In: 21, "21": "In",
613
+ /**
614
+ * IN_GLOBAL %ret %1 %2\
615
+ * %ret = %1 in global
616
+ */
617
+ InGlobal: 22, "22": "InGlobal",
618
+ /**
619
+ * CONCAT %ret `n` %1 %2 ... %n\
620
+ * %ret = %1 .. %2 .. ... .. %n
621
+ */
622
+ Concat: 23, "23": "Concat",
623
+ /**
624
+ * FORMAT %ret %1 %2\
625
+ * %ret = format(%1, %2)
626
+ */
627
+ Format: 24, "24": "Format",
628
+ /**
629
+ * AND %ret %1 %2\
630
+ * %ret = %1 && %2
631
+ */
632
+ And: 25, "25": "And",
633
+ /**
634
+ * OR %ret %1 %2\
635
+ * %ret = %1 || %2
636
+ */
637
+ Or: 26, "26": "Or",
638
+ /**
639
+ * ASSERT_INIT %v\
640
+ * assert(%v != uninitialized)
641
+ */
642
+ AssertInit: 27, "27": "AssertInit",
643
+ /**
644
+ * ASSERT_NON_NIL %v\
645
+ * assert(%v != nil)
646
+ */
647
+ AssertNonNil: 28, "28": "AssertNonNil",
648
+ /**
649
+ * TYPE %ret %1\
650
+ * %ret = type(%1)
651
+ */
652
+ Type: 29, "29": "Type",
653
+ /**
654
+ * TO_BOOLEAN %ret %1\
655
+ * %ret = boolean(%1)
656
+ */
657
+ ToBoolean: 30, "30": "ToBoolean",
658
+ /**
659
+ * TO_NUMBER %ret %1\
660
+ * %ret = number(%1)
661
+ */
662
+ ToNumber: 31, "31": "ToNumber",
663
+ /**
664
+ * TO_STRING %ret %1\
665
+ * %ret = string(%1)
666
+ */
667
+ ToString: 32, "32": "ToString",
668
+ /**
669
+ * IS_BOOLEAN %ret %1\
670
+ * %ret = type(%1) == "boolean"
671
+ */
672
+ IsBoolean: 33, "33": "IsBoolean",
673
+ /**
674
+ * IS_NUMBER %ret %1\
675
+ * %ret = type(%1) == "number"
676
+ */
677
+ IsNumber: 34, "34": "IsNumber",
678
+ /**
679
+ * IS_STRING %ret %1\
680
+ * %ret = type(%1) == "string"
681
+ */
682
+ IsString: 35, "35": "IsString",
683
+ /**
684
+ * IS_RECORD %ret %1\
685
+ * %ret = type(%1) == "record"
686
+ */
687
+ IsRecord: 36, "36": "IsRecord",
688
+ /**
689
+ * IS_ARRAY %ret %1\
690
+ * %ret = type(%1) == "array"
691
+ */
692
+ IsArray: 37, "37": "IsArray",
693
+ /**
694
+ * CONSTANT %reg `index`\
695
+ * %reg = CONSTANTS\[index]
696
+ */
697
+ Constant: 38, "38": "Constant",
698
+ /**
699
+ * UNINIT %reg
700
+ * %reg = uninitialized
701
+ */
702
+ Uninit: 39, "39": "Uninit",
703
+ /**
704
+ * ASSIGN %ret %1\
705
+ * %ret = %1
706
+ */
707
+ Assign: 40, "40": "Assign",
708
+ /**
709
+ * SWAP %1 %2\
710
+ * (%1, %2) = (%2, %1)
711
+ */
712
+ Swap: 41, "41": "Swap",
713
+ /**
714
+ * GET_UPVALUE %ret `level` %%up\
715
+ * %ret = UPVALUES\[level]\[%%up]
716
+ */
717
+ GetUpvalue: 42, "42": "GetUpvalue",
718
+ /**
719
+ * SET_UPVALUE %value `level` %%up \
720
+ * UPVALUES\[level]\[%%up] = %value
721
+ */
722
+ SetUpvalue: 43, "43": "SetUpvalue",
723
+ /**
724
+ * GET_GLOBAL %ret `name` \
725
+ * %ret = GLOBALS\[CONSTANTS\[name]]
726
+ */
727
+ GetGlobal: 44, "44": "GetGlobal",
728
+ /**
729
+ * GET_GLOBAL_DYN %ret %name \
730
+ * %ret = GLOBALS\[%name]
731
+ */
732
+ GetGlobalDyn: 45, "45": "GetGlobalDyn",
733
+ /**
734
+ * RECORD %ret\
735
+ * %ret = (
736
+ */
737
+ Record: 46, "46": "Record",
738
+ /**
739
+ * FIELD `name` %field\
740
+ * \[CONSTANTS\[name]]: %field,
741
+ */
742
+ Field: 47, "47": "Field",
743
+ /**
744
+ * FIELD_DYN %name %field\
745
+ * \[%name]: %field,
746
+ */
747
+ FieldDyn: 48, "48": "FieldDyn",
748
+ /**
749
+ * FIELD_INDEX `index` %field\
750
+ * \[index]: %field,
751
+ */
752
+ FieldIndex: 49, "49": "FieldIndex",
753
+ /**
754
+ * FIELD_OPT `name` %field\
755
+ * \[CONSTANTS\[name]]?: %field,
756
+ */
757
+ FieldOpt: 50, "50": "FieldOpt",
758
+ /**
759
+ * FIELD_OPT_DYN %name %field\
760
+ * \[%name]?: %field,
761
+ */
762
+ FieldOptDyn: 51, "51": "FieldOptDyn",
763
+ /**
764
+ * FIELD_OPT_INDEX `index` %field\
765
+ * \[index]?: %field,
766
+ */
767
+ FieldOptIndex: 52, "52": "FieldOptIndex",
768
+ /**
769
+ * PICK %ret %var `n` `key_1` `key_2` ... `key_n`\
770
+ * %ret = %var pick keys CONSTANTS\[key_1], CONSTANTS\[key_2], ..., CONSTANTS\[key_n]
771
+ */
772
+ Pick: 53, "53": "Pick",
773
+ /**
774
+ * OMIT %ret %var `n` `key_1` `key_2` ... `key_n`\
775
+ * %ret = %var omit keys CONSTANTS\[key_1], CONSTANTS\[key_2], ..., CONSTANTS\[key_n]
776
+ */
777
+ Omit: 54, "54": "Omit",
778
+ /**
779
+ * ARRAY %ret\
780
+ * %ret = \[
781
+ */
782
+ Array: 55, "55": "Array",
783
+ /**
784
+ * ITEM %item\
785
+ * %item,
786
+ */
787
+ Item: 56, "56": "Item",
788
+ /**
789
+ * ITEM_RANGE `start` `end`\
790
+ * `start`..`end`,
791
+ */
792
+ ItemRange: 57, "57": "ItemRange",
793
+ /**
794
+ * ITEM_RANGE_DYN %start %end\
795
+ * %start..%end,
796
+ */
797
+ ItemRangeDyn: 58, "58": "ItemRangeDyn",
798
+ /**
799
+ * ITEM_RANGE_EXCLUSIVE_DYN %start %end\
800
+ * %start..<%end,
801
+ */
802
+ ItemRangeExclusiveDyn: 59, "59": "ItemRangeExclusiveDyn",
803
+ /**
804
+ * SPREAD %var\
805
+ * ..%var,
806
+ */
807
+ Spread: 60, "60": "Spread",
808
+ /**
809
+ * FREEZE\
810
+ * ) for record or ] for array
811
+ */
812
+ Freeze: 61, "61": "Freeze",
813
+ /**
814
+ * HAS %ret %var `key`\
815
+ * %ret = initialized(%var\[CONSTANTS\[key]])
816
+ */
817
+ Has: 62, "62": "Has",
818
+ /**
819
+ * HAS_DYN %ret %var %key\
820
+ * %ret = initialized(%var\[%key])
821
+ */
822
+ HasDyn: 63, "63": "HasDyn",
823
+ /**
824
+ * HAS_INDEX %ret %var `index`\
825
+ * %ret = initialized(%var\[index])
826
+ */
827
+ HasIndex: 64, "64": "HasIndex",
828
+ /**
829
+ * GET %ret %var `key`\
830
+ * %ret = %var\[CONSTANTS\[key]] ?? nil
831
+ */
832
+ Get: 65, "65": "Get",
833
+ /**
834
+ * GET_DYN %ret %var %key\
835
+ * %ret = %var\[%key] ?? nil
836
+ */
837
+ GetDyn: 66, "66": "GetDyn",
838
+ /**
839
+ * GET_INDEX %ret %var `index`\
840
+ * %ret = %var\[index] ?? nil
841
+ */
842
+ GetIndex: 67, "67": "GetIndex",
843
+ /**
844
+ * SET %value %var `key`\
845
+ * %var\[CONSTANTS\[key]] = %value
846
+ */
847
+ Set: 68, "68": "Set",
848
+ /**
849
+ * SET_DYN %value %var %key\
850
+ * %var\[%key] = %value
851
+ */
852
+ SetDyn: 69, "69": "SetDyn",
853
+ /**
854
+ * SET_INDEX %value %var `index`\
855
+ * %var\[index] = %value
856
+ */
857
+ SetIndex: 70, "70": "SetIndex",
858
+ /**
859
+ * SLICE %ret %var `start` `end`\
860
+ * %ret = %var\[start..end]
861
+ */
862
+ Slice: 71, "71": "Slice",
863
+ /**
864
+ * SLICE_START %ret %var `end`\
865
+ * %ret = %var\[..end]
866
+ */
867
+ SliceStart: 72, "72": "SliceStart",
868
+ /**
869
+ * SLICE_END %ret %var `start`\
870
+ * %ret = %var\[start..]
871
+ */
872
+ SliceEnd: 73, "73": "SliceEnd",
873
+ /**
874
+ * SLICE_DYN %ret %var %start %end\
875
+ * %ret = %var\[%start..%end]
876
+ */
877
+ SliceDyn: 74, "74": "SliceDyn",
878
+ /**
879
+ * SLICE_EXCLUSIVE_DYN %ret %var %start %end\
880
+ * %ret = %var\[%start..<%end]
881
+ */
882
+ SliceExclusiveDyn: 75, "75": "SliceExclusiveDyn",
883
+ /**
884
+ * LENGTH %ret %var\
885
+ * %ret = $Length(%var)
886
+ */
887
+ Length: 76, "76": "Length",
888
+ /**
889
+ * LOOP `regn`\
890
+ * loop { let %1, .. ,%regn;
891
+ */
892
+ Loop: 77, "77": "Loop",
893
+ /**
894
+ * LOOP_FOR `regn` %iterable\
895
+ * for %1 in %iterable { let %2, .. ,%regn;
896
+ */
897
+ LoopFor: 78, "78": "LoopFor",
898
+ /**
899
+ * LOOP_RANGE `regn` %start %end\
900
+ * for %1 in %start..%end { let %2, .. ,%regn;
901
+ */
902
+ LoopRange: 79, "79": "LoopRange",
903
+ /**
904
+ * LOOP_RANGE_EXCLUSIVE `regn` %start %end\
905
+ * for %1 in %start..<%end { let %2, .. ,%regn;
906
+ */
907
+ LoopRangeExclusive: 80, "80": "LoopRangeExclusive",
908
+ /**
909
+ * LOOP_END\
910
+ * }
911
+ */
912
+ LoopEnd: 81, "81": "LoopEnd",
913
+ /**
914
+ * BREAK\
915
+ * break;
916
+ */
917
+ Break: 82, "82": "Break",
918
+ /**
919
+ * CONTINUE\
920
+ * continue;
921
+ */
922
+ Continue: 83, "83": "Continue",
923
+ /**
924
+ * IF %cond\
925
+ * if (%cond) {
926
+ */
927
+ If: 84, "84": "If",
928
+ /**
929
+ * IF_NOT %cond\
930
+ * if (!%cond) {
931
+ */
932
+ IfNot: 85, "85": "IfNot",
933
+ /**
934
+ * IF_INIT %var\
935
+ * if (initialized(%var)) {
936
+ */
937
+ IfInit: 86, "86": "IfInit",
938
+ /**
939
+ * IF_NOT_INIT %var\
940
+ * if (!initialized(%var)) {
941
+ */
942
+ IfNotInit: 87, "87": "IfNotInit",
943
+ /**
944
+ * IF_NIL %var\
945
+ * if (%var == nil) {
946
+ */
947
+ IfNil: 88, "88": "IfNil",
948
+ /**
949
+ * IF_NOT_NIL %var\
950
+ * if (%var != nil) {
951
+ */
952
+ IfNotNil: 89, "89": "IfNotNil",
953
+ /**
954
+ * ELSE\
955
+ * } else {
956
+ */
957
+ Else: 90, "90": "Else",
958
+ /**
959
+ * EL_IF IF*\
960
+ * } else if *** {\
961
+ * This instruction must be followed by an `IF*` instruction\
962
+ */
963
+ ElIf: 91, "91": "ElIf",
964
+ /**
965
+ * IF_END\
966
+ * }
967
+ */
968
+ IfEnd: 92, "92": "IfEnd",
969
+ /**
970
+ * FUNC %f `argn` `regn`\
971
+ * %f = (%1, %2, ... , %argn) => { let %argn+1, ... , %regn;
972
+ */
973
+ Func: 93, "93": "Func",
974
+ /**
975
+ * FUNC_VARG %f `argn` `regn`\
976
+ * %f = (%1, %2, ... , %argn-1, ...%argn) => { let %argn+1, ... , %regn;
977
+ */
978
+ FuncVarg: 94, "94": "FuncVarg",
979
+ /**
980
+ * FUNC_END\
981
+ * }
982
+ */
983
+ FuncEnd: 95, "95": "FuncEnd",
984
+ /**
985
+ * RETURN %value\
986
+ * return %value;
987
+ */
988
+ Return: 96, "96": "Return",
989
+ /**
990
+ * CALL %ret `f` `argn` %1 %2 ... %argn `spread_n` `spread_arg_a` ...\
991
+ * %ret = GLOBAL[CONSTANTS[f]](%1, %2, ... , %argn);
992
+ *
993
+ * If spread_arg_a is present, arg at that index will be spread
994
+ */
995
+ Call: 97, "97": "Call",
996
+ /**
997
+ * CALL_DYN %ret %f `argn` %1 %2 ... %argn `spread_n` `spread_arg_a` ...\
998
+ * %ret = %f(%1, %2, ... , %argn);
999
+ *
1000
+ * If spread_arg_a is present, arg at that index will be spread
1001
+ */
1002
+ CallDyn: 98, "98": "CallDyn",
1003
+ });
1004
+
1005
+ const CompileResultFinalization = (typeof FinalizationRegistry === 'undefined')
1006
+ ? { register: () => {}, unregister: () => {} }
1007
+ : new FinalizationRegistry(ptr => wasm.__wbg_compileresult_free(ptr >>> 0, 1));
1008
+
1009
+ export class CompileResult {
1010
+
1011
+ static __wrap(ptr) {
1012
+ ptr = ptr >>> 0;
1013
+ const obj = Object.create(CompileResult.prototype);
1014
+ obj.__wbg_ptr = ptr;
1015
+ CompileResultFinalization.register(obj, obj.__wbg_ptr, obj);
1016
+ return obj;
1017
+ }
1018
+
1019
+ __destroy_into_raw() {
1020
+ const ptr = this.__wbg_ptr;
1021
+ this.__wbg_ptr = 0;
1022
+ CompileResultFinalization.unregister(this);
1023
+ return ptr;
1024
+ }
1025
+
1026
+ free() {
1027
+ const ptr = this.__destroy_into_raw();
1028
+ wasm.__wbg_compileresult_free(ptr, 0);
1029
+ }
1030
+ /**
1031
+ * @returns {Uint8Array | undefined}
1032
+ */
1033
+ chunk() {
1034
+ try {
1035
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1036
+ wasm.compileresult_chunk(retptr, this.__wbg_ptr);
1037
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1038
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1039
+ let v1;
1040
+ if (r0 !== 0) {
1041
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
1042
+ wasm.__wbindgen_export_0(r0, r1 * 1, 1);
1043
+ }
1044
+ return v1;
1045
+ } finally {
1046
+ wasm.__wbindgen_add_to_stack_pointer(16);
1047
+ }
1048
+ }
1049
+ /**
1050
+ * @returns {Uint32Array}
1051
+ */
1052
+ diagnostics() {
1053
+ try {
1054
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1055
+ wasm.compileresult_diagnostics(retptr, this.__wbg_ptr);
1056
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1057
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1058
+ var v1 = getArrayU32FromWasm0(r0, r1).slice();
1059
+ wasm.__wbindgen_export_0(r0, r1 * 4, 4);
1060
+ return v1;
1061
+ } finally {
1062
+ wasm.__wbindgen_add_to_stack_pointer(16);
1063
+ }
1064
+ }
1065
+ }
1066
+ if (Symbol.dispose) CompileResult.prototype[Symbol.dispose] = CompileResult.prototype.free;
1067
+
1068
+ const ConfigFinalization = (typeof FinalizationRegistry === 'undefined')
1069
+ ? { register: () => {}, unregister: () => {} }
1070
+ : new FinalizationRegistry(ptr => wasm.__wbg_config_free(ptr >>> 0, 1));
1071
+
1072
+ export class Config {
1073
+
1074
+ __destroy_into_raw() {
1075
+ const ptr = this.__wbg_ptr;
1076
+ this.__wbg_ptr = 0;
1077
+ ConfigFinalization.unregister(this);
1078
+ return ptr;
1079
+ }
1080
+
1081
+ free() {
1082
+ const ptr = this.__destroy_into_raw();
1083
+ wasm.__wbg_config_free(ptr, 0);
1084
+ }
1085
+ /**
1086
+ * @returns {boolean}
1087
+ */
1088
+ get track_references() {
1089
+ const ret = wasm.__wbg_get_config_track_references(this.__wbg_ptr);
1090
+ return ret !== 0;
1091
+ }
1092
+ /**
1093
+ * @param {boolean} arg0
1094
+ */
1095
+ set track_references(arg0) {
1096
+ wasm.__wbg_set_config_track_references(this.__wbg_ptr, arg0);
1097
+ }
1098
+ /**
1099
+ * @returns {boolean}
1100
+ */
1101
+ get trivia() {
1102
+ const ret = wasm.__wbg_get_config_trivia(this.__wbg_ptr);
1103
+ return ret !== 0;
1104
+ }
1105
+ /**
1106
+ * @param {boolean} arg0
1107
+ */
1108
+ set trivia(arg0) {
1109
+ wasm.__wbg_set_config_trivia(this.__wbg_ptr, arg0);
1110
+ }
1111
+ /**
1112
+ * @returns {InputMode}
1113
+ */
1114
+ get input_mode() {
1115
+ const ret = wasm.__wbg_get_config_input_mode(this.__wbg_ptr);
1116
+ return ret;
1117
+ }
1118
+ /**
1119
+ * @param {InputMode} arg0
1120
+ */
1121
+ set input_mode(arg0) {
1122
+ wasm.__wbg_set_config_input_mode(this.__wbg_ptr, arg0);
1123
+ }
1124
+ /**
1125
+ * @returns {DiagnosticPositionEncoding}
1126
+ */
1127
+ get diagnostic_position_encoding() {
1128
+ const ret = wasm.__wbg_get_config_diagnostic_position_encoding(this.__wbg_ptr);
1129
+ return ret;
1130
+ }
1131
+ /**
1132
+ * @param {DiagnosticPositionEncoding} arg0
1133
+ */
1134
+ set diagnostic_position_encoding(arg0) {
1135
+ wasm.__wbg_set_config_diagnostic_position_encoding(this.__wbg_ptr, arg0);
1136
+ }
1137
+ /**
1138
+ * @returns {boolean}
1139
+ */
1140
+ get diagnostic_error() {
1141
+ const ret = wasm.__wbg_get_config_diagnostic_error(this.__wbg_ptr);
1142
+ return ret !== 0;
1143
+ }
1144
+ /**
1145
+ * @param {boolean} arg0
1146
+ */
1147
+ set diagnostic_error(arg0) {
1148
+ wasm.__wbg_set_config_diagnostic_error(this.__wbg_ptr, arg0);
1149
+ }
1150
+ /**
1151
+ * @returns {boolean}
1152
+ */
1153
+ get diagnostic_warning() {
1154
+ const ret = wasm.__wbg_get_config_diagnostic_warning(this.__wbg_ptr);
1155
+ return ret !== 0;
1156
+ }
1157
+ /**
1158
+ * @param {boolean} arg0
1159
+ */
1160
+ set diagnostic_warning(arg0) {
1161
+ wasm.__wbg_set_config_diagnostic_warning(this.__wbg_ptr, arg0);
1162
+ }
1163
+ /**
1164
+ * @returns {boolean}
1165
+ */
1166
+ get diagnostic_info() {
1167
+ const ret = wasm.__wbg_get_config_diagnostic_info(this.__wbg_ptr);
1168
+ return ret !== 0;
1169
+ }
1170
+ /**
1171
+ * @param {boolean} arg0
1172
+ */
1173
+ set diagnostic_info(arg0) {
1174
+ wasm.__wbg_set_config_diagnostic_info(this.__wbg_ptr, arg0);
1175
+ }
1176
+ /**
1177
+ * @returns {boolean}
1178
+ */
1179
+ get diagnostic_hint() {
1180
+ const ret = wasm.__wbg_get_config_diagnostic_hint(this.__wbg_ptr);
1181
+ return ret !== 0;
1182
+ }
1183
+ /**
1184
+ * @param {boolean} arg0
1185
+ */
1186
+ set diagnostic_hint(arg0) {
1187
+ wasm.__wbg_set_config_diagnostic_hint(this.__wbg_ptr, arg0);
1188
+ }
1189
+ /**
1190
+ * @returns {boolean}
1191
+ */
1192
+ get diagnostic_reference() {
1193
+ const ret = wasm.__wbg_get_config_diagnostic_reference(this.__wbg_ptr);
1194
+ return ret !== 0;
1195
+ }
1196
+ /**
1197
+ * @param {boolean} arg0
1198
+ */
1199
+ set diagnostic_reference(arg0) {
1200
+ wasm.__wbg_set_config_diagnostic_reference(this.__wbg_ptr, arg0);
1201
+ }
1202
+ /**
1203
+ * @returns {boolean}
1204
+ */
1205
+ get diagnostic_other() {
1206
+ const ret = wasm.__wbg_get_config_diagnostic_other(this.__wbg_ptr);
1207
+ return ret !== 0;
1208
+ }
1209
+ /**
1210
+ * @param {boolean} arg0
1211
+ */
1212
+ set diagnostic_other(arg0) {
1213
+ wasm.__wbg_set_config_diagnostic_other(this.__wbg_ptr, arg0);
1214
+ }
1215
+ constructor() {
1216
+ const ret = wasm.config_new();
1217
+ this.__wbg_ptr = ret >>> 0;
1218
+ ConfigFinalization.register(this, this.__wbg_ptr, this);
1219
+ return this;
1220
+ }
1221
+ }
1222
+ if (Symbol.dispose) Config.prototype[Symbol.dispose] = Config.prototype.free;
1223
+
1224
+ const MonacoCompilerFinalization = (typeof FinalizationRegistry === 'undefined')
1225
+ ? { register: () => {}, unregister: () => {} }
1226
+ : new FinalizationRegistry(ptr => wasm.__wbg_monacocompiler_free(ptr >>> 0, 1));
1227
+
1228
+ export class MonacoCompiler {
1229
+
1230
+ __destroy_into_raw() {
1231
+ const ptr = this.__wbg_ptr;
1232
+ this.__wbg_ptr = 0;
1233
+ MonacoCompilerFinalization.unregister(this);
1234
+ return ptr;
1235
+ }
1236
+
1237
+ free() {
1238
+ const ptr = this.__destroy_into_raw();
1239
+ wasm.__wbg_monacocompiler_free(ptr, 0);
1240
+ }
1241
+ /**
1242
+ * @param {string} input
1243
+ * @param {Config} config
1244
+ */
1245
+ constructor(input, config) {
1246
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
1247
+ const len0 = WASM_VECTOR_LEN;
1248
+ _assertClass(config, Config);
1249
+ const ret = wasm.monacocompiler_new(ptr0, len0, config.__wbg_ptr);
1250
+ this.__wbg_ptr = ret >>> 0;
1251
+ MonacoCompilerFinalization.register(this, this.__wbg_ptr, this);
1252
+ return this;
1253
+ }
1254
+ /**
1255
+ * @returns {boolean}
1256
+ */
1257
+ parse() {
1258
+ const ret = wasm.monacocompiler_parse(this.__wbg_ptr);
1259
+ return ret !== 0;
1260
+ }
1261
+ /**
1262
+ * @returns {Uint8Array | undefined}
1263
+ */
1264
+ emit() {
1265
+ try {
1266
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1267
+ wasm.monacocompiler_emit(retptr, this.__wbg_ptr);
1268
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1269
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1270
+ let v1;
1271
+ if (r0 !== 0) {
1272
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
1273
+ wasm.__wbindgen_export_0(r0, r1 * 1, 1);
1274
+ }
1275
+ return v1;
1276
+ } finally {
1277
+ wasm.__wbindgen_add_to_stack_pointer(16);
1278
+ }
1279
+ }
1280
+ /**
1281
+ * @returns {string | undefined}
1282
+ */
1283
+ format() {
1284
+ try {
1285
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1286
+ wasm.monacocompiler_format(retptr, this.__wbg_ptr);
1287
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1288
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1289
+ let v1;
1290
+ if (r0 !== 0) {
1291
+ v1 = getStringFromWasm0(r0, r1).slice();
1292
+ wasm.__wbindgen_export_0(r0, r1 * 1, 1);
1293
+ }
1294
+ return v1;
1295
+ } finally {
1296
+ wasm.__wbindgen_add_to_stack_pointer(16);
1297
+ }
1298
+ }
1299
+ /**
1300
+ * @returns {Uint32Array}
1301
+ */
1302
+ diagnostics() {
1303
+ try {
1304
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1305
+ wasm.monacocompiler_diagnostics(retptr, this.__wbg_ptr);
1306
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1307
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1308
+ var v1 = getArrayU32FromWasm0(r0, r1).slice();
1309
+ wasm.__wbindgen_export_0(r0, r1 * 4, 4);
1310
+ return v1;
1311
+ } finally {
1312
+ wasm.__wbindgen_add_to_stack_pointer(16);
1313
+ }
1314
+ }
1315
+ }
1316
+ if (Symbol.dispose) MonacoCompiler.prototype[Symbol.dispose] = MonacoCompiler.prototype.free;
1317
+
1318
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
1319
+
1320
+ async function __wbg_load(module, imports) {
1321
+ if (typeof Response === 'function' && module instanceof Response) {
1322
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1323
+ try {
1324
+ return await WebAssembly.instantiateStreaming(module, imports);
1325
+
1326
+ } catch (e) {
1327
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
1328
+
1329
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1330
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1331
+
1332
+ } else {
1333
+ throw e;
1334
+ }
1335
+ }
1336
+ }
1337
+
1338
+ const bytes = await module.arrayBuffer();
1339
+ return await WebAssembly.instantiate(bytes, imports);
1340
+
1341
+ } else {
1342
+ const instance = await WebAssembly.instantiate(module, imports);
1343
+
1344
+ if (instance instanceof WebAssembly.Instance) {
1345
+ return { instance, module };
1346
+
1347
+ } else {
1348
+ return instance;
1349
+ }
1350
+ }
1351
+ }
1352
+
1353
+ function __wbg_get_imports() {
1354
+ const imports = {};
1355
+ imports.wbg = {};
1356
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
1357
+ let deferred0_0;
1358
+ let deferred0_1;
1359
+ try {
1360
+ deferred0_0 = arg0;
1361
+ deferred0_1 = arg1;
1362
+ console.error(getStringFromWasm0(arg0, arg1));
1363
+ } finally {
1364
+ wasm.__wbindgen_export_0(deferred0_0, deferred0_1, 1);
1365
+ }
1366
+ };
1367
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
1368
+ const ret = new Error();
1369
+ return addHeapObject(ret);
1370
+ };
1371
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
1372
+ const ret = getObject(arg1).stack;
1373
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
1374
+ const len1 = WASM_VECTOR_LEN;
1375
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1376
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1377
+ };
1378
+ imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
1379
+ throw new Error(getStringFromWasm0(arg0, arg1));
1380
+ };
1381
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1382
+ // Cast intrinsic for `Ref(String) -> Externref`.
1383
+ const ret = getStringFromWasm0(arg0, arg1);
1384
+ return addHeapObject(ret);
1385
+ };
1386
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
1387
+ takeObject(arg0);
1388
+ };
1389
+
1390
+ return imports;
1391
+ }
1392
+
1393
+ function __wbg_init_memory(imports, memory) {
1394
+
1395
+ }
1396
+
1397
+ function __wbg_finalize_init(instance, module) {
1398
+ wasm = instance.exports;
1399
+ __wbg_init.__wbindgen_wasm_module = module;
1400
+ cachedDataViewMemory0 = null;
1401
+ cachedUint32ArrayMemory0 = null;
1402
+ cachedUint8ArrayMemory0 = null;
1403
+
1404
+
1405
+ wasm.__wbindgen_start();
1406
+ return wasm;
1407
+ }
1408
+
1409
+ function initSync(module) {
1410
+ if (wasm !== undefined) return wasm;
1411
+
1412
+
1413
+ if (typeof module !== 'undefined') {
1414
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1415
+ ({module} = module)
1416
+ } else {
1417
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1418
+ }
1419
+ }
1420
+
1421
+ const imports = __wbg_get_imports();
1422
+
1423
+ __wbg_init_memory(imports);
1424
+
1425
+ if (!(module instanceof WebAssembly.Module)) {
1426
+ module = new WebAssembly.Module(module);
1427
+ }
1428
+
1429
+ const instance = new WebAssembly.Instance(module, imports);
1430
+
1431
+ return __wbg_finalize_init(instance, module);
1432
+ }
1433
+
1434
+ async function __wbg_init(module_or_path) {
1435
+ if (wasm !== undefined) return wasm;
1436
+
1437
+
1438
+ if (typeof module_or_path !== 'undefined') {
1439
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1440
+ ({module_or_path} = module_or_path)
1441
+ } else {
1442
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1443
+ }
1444
+ }
1445
+
1446
+ if (typeof module_or_path === 'undefined') {
1447
+ module_or_path = new URL('wasm_bg.wasm', import.meta.url);
1448
+ }
1449
+ const imports = __wbg_get_imports();
1450
+
1451
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1452
+ module_or_path = fetch(module_or_path);
1453
+ }
1454
+
1455
+ __wbg_init_memory(imports);
1456
+
1457
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1458
+
1459
+ return __wbg_finalize_init(instance, module);
1460
+ }
1461
+
1462
+ export { initSync };
1463
+ export default __wbg_init;