qsharp-lang 0.1.0-dev.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.
Files changed (55) hide show
  1. package/LICENSE.txt +21 -0
  2. package/README.md +74 -0
  3. package/dist/browser.d.ts +26 -0
  4. package/dist/browser.js +156 -0
  5. package/dist/cancellation.d.ts +10 -0
  6. package/dist/cancellation.js +31 -0
  7. package/dist/compiler/common.d.ts +31 -0
  8. package/dist/compiler/common.js +47 -0
  9. package/dist/compiler/compiler.d.ts +28 -0
  10. package/dist/compiler/compiler.js +62 -0
  11. package/dist/compiler/events.d.ts +54 -0
  12. package/dist/compiler/events.js +92 -0
  13. package/dist/compiler/worker-browser.d.ts +1 -0
  14. package/dist/compiler/worker-browser.js +43 -0
  15. package/dist/compiler/worker-node.d.ts +1 -0
  16. package/dist/compiler/worker-node.js +41 -0
  17. package/dist/compiler/worker-proxy.d.ts +7 -0
  18. package/dist/compiler/worker-proxy.js +16 -0
  19. package/dist/debug-service/debug-service.d.ts +35 -0
  20. package/dist/debug-service/debug-service.js +136 -0
  21. package/dist/debug-service/worker-browser.d.ts +1 -0
  22. package/dist/debug-service/worker-browser.js +32 -0
  23. package/dist/debug-service/worker-node.d.ts +1 -0
  24. package/dist/debug-service/worker-node.js +30 -0
  25. package/dist/debug-service/worker-proxy.d.ts +7 -0
  26. package/dist/debug-service/worker-proxy.js +22 -0
  27. package/dist/katas-content.generated.d.ts +61 -0
  28. package/dist/katas-content.generated.js +2499 -0
  29. package/dist/katas.d.ts +55 -0
  30. package/dist/katas.js +16 -0
  31. package/dist/language-service/language-service.d.ts +48 -0
  32. package/dist/language-service/language-service.js +85 -0
  33. package/dist/language-service/worker-browser.d.ts +1 -0
  34. package/dist/language-service/worker-browser.js +32 -0
  35. package/dist/language-service/worker-node.d.ts +1 -0
  36. package/dist/language-service/worker-node.js +30 -0
  37. package/dist/language-service/worker-proxy.d.ts +6 -0
  38. package/dist/language-service/worker-proxy.js +20 -0
  39. package/dist/log.d.ts +33 -0
  40. package/dist/log.js +92 -0
  41. package/dist/main.d.ts +11 -0
  42. package/dist/main.js +82 -0
  43. package/dist/samples.generated.d.ts +6 -0
  44. package/dist/samples.generated.js +62 -0
  45. package/dist/vsdiagnostic.d.ts +27 -0
  46. package/dist/vsdiagnostic.js +117 -0
  47. package/dist/worker-proxy.d.ts +95 -0
  48. package/dist/worker-proxy.js +226 -0
  49. package/lib/node/qsc_wasm.cjs +1010 -0
  50. package/lib/node/qsc_wasm.d.cts +266 -0
  51. package/lib/node/qsc_wasm_bg.wasm +0 -0
  52. package/lib/web/qsc_wasm.d.ts +328 -0
  53. package/lib/web/qsc_wasm.js +1026 -0
  54. package/lib/web/qsc_wasm_bg.wasm +0 -0
  55. package/package.json +35 -0
@@ -0,0 +1,1026 @@
1
+ let wasm;
2
+
3
+ const heap = new Array(128).fill(undefined);
4
+
5
+ heap.push(undefined, null, true, false);
6
+
7
+ function getObject(idx) { return heap[idx]; }
8
+
9
+ let heap_next = heap.length;
10
+
11
+ function dropObject(idx) {
12
+ if (idx < 132) return;
13
+ heap[idx] = heap_next;
14
+ heap_next = idx;
15
+ }
16
+
17
+ function takeObject(idx) {
18
+ const ret = getObject(idx);
19
+ dropObject(idx);
20
+ return ret;
21
+ }
22
+
23
+ const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
24
+
25
+ cachedTextDecoder.decode();
26
+
27
+ let cachedUint8Memory0 = null;
28
+
29
+ function getUint8Memory0() {
30
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
31
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
32
+ }
33
+ return cachedUint8Memory0;
34
+ }
35
+
36
+ function getStringFromWasm0(ptr, len) {
37
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
38
+ }
39
+
40
+ function addHeapObject(obj) {
41
+ if (heap_next === heap.length) heap.push(heap.length + 1);
42
+ const idx = heap_next;
43
+ heap_next = heap[idx];
44
+
45
+ heap[idx] = obj;
46
+ return idx;
47
+ }
48
+
49
+ let WASM_VECTOR_LEN = 0;
50
+
51
+ const cachedTextEncoder = new TextEncoder('utf-8');
52
+
53
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
54
+ ? function (arg, view) {
55
+ return cachedTextEncoder.encodeInto(arg, view);
56
+ }
57
+ : function (arg, view) {
58
+ const buf = cachedTextEncoder.encode(arg);
59
+ view.set(buf);
60
+ return {
61
+ read: arg.length,
62
+ written: buf.length
63
+ };
64
+ });
65
+
66
+ function passStringToWasm0(arg, malloc, realloc) {
67
+
68
+ if (realloc === undefined) {
69
+ const buf = cachedTextEncoder.encode(arg);
70
+ const ptr = malloc(buf.length);
71
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
72
+ WASM_VECTOR_LEN = buf.length;
73
+ return ptr;
74
+ }
75
+
76
+ let len = arg.length;
77
+ let ptr = malloc(len);
78
+
79
+ const mem = getUint8Memory0();
80
+
81
+ let offset = 0;
82
+
83
+ for (; offset < len; offset++) {
84
+ const code = arg.charCodeAt(offset);
85
+ if (code > 0x7F) break;
86
+ mem[ptr + offset] = code;
87
+ }
88
+
89
+ if (offset !== len) {
90
+ if (offset !== 0) {
91
+ arg = arg.slice(offset);
92
+ }
93
+ ptr = realloc(ptr, len, len = offset + arg.length * 3);
94
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
95
+ const ret = encodeString(arg, view);
96
+
97
+ offset += ret.written;
98
+ }
99
+
100
+ WASM_VECTOR_LEN = offset;
101
+ return ptr;
102
+ }
103
+
104
+ function isLikeNone(x) {
105
+ return x === undefined || x === null;
106
+ }
107
+
108
+ let cachedInt32Memory0 = null;
109
+
110
+ function getInt32Memory0() {
111
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
112
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
113
+ }
114
+ return cachedInt32Memory0;
115
+ }
116
+
117
+ let cachedFloat64Memory0 = null;
118
+
119
+ function getFloat64Memory0() {
120
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
121
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
122
+ }
123
+ return cachedFloat64Memory0;
124
+ }
125
+
126
+ function debugString(val) {
127
+ // primitive types
128
+ const type = typeof val;
129
+ if (type == 'number' || type == 'boolean' || val == null) {
130
+ return `${val}`;
131
+ }
132
+ if (type == 'string') {
133
+ return `"${val}"`;
134
+ }
135
+ if (type == 'symbol') {
136
+ const description = val.description;
137
+ if (description == null) {
138
+ return 'Symbol';
139
+ } else {
140
+ return `Symbol(${description})`;
141
+ }
142
+ }
143
+ if (type == 'function') {
144
+ const name = val.name;
145
+ if (typeof name == 'string' && name.length > 0) {
146
+ return `Function(${name})`;
147
+ } else {
148
+ return 'Function';
149
+ }
150
+ }
151
+ // objects
152
+ if (Array.isArray(val)) {
153
+ const length = val.length;
154
+ let debug = '[';
155
+ if (length > 0) {
156
+ debug += debugString(val[0]);
157
+ }
158
+ for(let i = 1; i < length; i++) {
159
+ debug += ', ' + debugString(val[i]);
160
+ }
161
+ debug += ']';
162
+ return debug;
163
+ }
164
+ // Test for built-in
165
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
166
+ let className;
167
+ if (builtInMatches.length > 1) {
168
+ className = builtInMatches[1];
169
+ } else {
170
+ // Failed to match the standard '[object ClassName]'
171
+ return toString.call(val);
172
+ }
173
+ if (className == 'Object') {
174
+ // we're a user defined class or Object
175
+ // JSON.stringify avoids problems with cycles, and is generally much
176
+ // easier than looping through ownProperties of `val`.
177
+ try {
178
+ return 'Object(' + JSON.stringify(val) + ')';
179
+ } catch (_) {
180
+ return 'Object';
181
+ }
182
+ }
183
+ // errors
184
+ if (val instanceof Error) {
185
+ return `${val.name}: ${val.message}\n${val.stack}`;
186
+ }
187
+ // TODO we could test for more things here, like `Set`s and `Map`s.
188
+ return className;
189
+ }
190
+ /**
191
+ * @param {any} callback
192
+ * @param {number} level
193
+ */
194
+ export function initLogging(callback, level) {
195
+ try {
196
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
197
+ wasm.initLogging(retptr, addHeapObject(callback), level);
198
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
199
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
200
+ if (r1) {
201
+ throw takeObject(r0);
202
+ }
203
+ } finally {
204
+ wasm.__wbindgen_add_to_stack_pointer(16);
205
+ }
206
+ }
207
+
208
+ /**
209
+ * @param {number} level
210
+ */
211
+ export function setLogLevel(level) {
212
+ wasm.setLogLevel(level);
213
+ }
214
+
215
+ /**
216
+ * @returns {any}
217
+ */
218
+ export function git_hash() {
219
+ const ret = wasm.git_hash();
220
+ return takeObject(ret);
221
+ }
222
+
223
+ /**
224
+ * @param {string} name
225
+ * @returns {any}
226
+ */
227
+ export function get_library_source_content(name) {
228
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
229
+ const len0 = WASM_VECTOR_LEN;
230
+ const ret = wasm.get_library_source_content(ptr0, len0);
231
+ return takeObject(ret);
232
+ }
233
+
234
+ /**
235
+ * @param {string} code
236
+ * @returns {any}
237
+ */
238
+ export function get_hir(code) {
239
+ try {
240
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
241
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
242
+ const len0 = WASM_VECTOR_LEN;
243
+ wasm.get_hir(retptr, ptr0, len0);
244
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
245
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
246
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
247
+ if (r2) {
248
+ throw takeObject(r1);
249
+ }
250
+ return takeObject(r0);
251
+ } finally {
252
+ wasm.__wbindgen_add_to_stack_pointer(16);
253
+ }
254
+ }
255
+
256
+ let stack_pointer = 128;
257
+
258
+ function addBorrowedObject(obj) {
259
+ if (stack_pointer == 1) throw new Error('out of js stack');
260
+ heap[--stack_pointer] = obj;
261
+ return stack_pointer;
262
+ }
263
+ /**
264
+ * @param {string} code
265
+ * @param {string} expr
266
+ * @param {Function} event_cb
267
+ * @param {number} shots
268
+ * @returns {any}
269
+ */
270
+ export function run(code, expr, event_cb, shots) {
271
+ try {
272
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
273
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
274
+ const len0 = WASM_VECTOR_LEN;
275
+ const ptr1 = passStringToWasm0(expr, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
276
+ const len1 = WASM_VECTOR_LEN;
277
+ wasm.run(retptr, ptr0, len0, ptr1, len1, addBorrowedObject(event_cb), shots);
278
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
279
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
280
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
281
+ if (r2) {
282
+ throw takeObject(r1);
283
+ }
284
+ return takeObject(r0);
285
+ } finally {
286
+ wasm.__wbindgen_add_to_stack_pointer(16);
287
+ heap[stack_pointer++] = undefined;
288
+ }
289
+ }
290
+
291
+ /**
292
+ * @param {string} solution_code
293
+ * @param {any} exercise_sources_js
294
+ * @param {Function} event_cb
295
+ * @returns {any}
296
+ */
297
+ export function check_exercise_solution(solution_code, exercise_sources_js, event_cb) {
298
+ try {
299
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
300
+ const ptr0 = passStringToWasm0(solution_code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
301
+ const len0 = WASM_VECTOR_LEN;
302
+ wasm.check_exercise_solution(retptr, ptr0, len0, addHeapObject(exercise_sources_js), addBorrowedObject(event_cb));
303
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
304
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
305
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
306
+ if (r2) {
307
+ throw takeObject(r1);
308
+ }
309
+ return takeObject(r0);
310
+ } finally {
311
+ wasm.__wbindgen_add_to_stack_pointer(16);
312
+ heap[stack_pointer++] = undefined;
313
+ }
314
+ }
315
+
316
+ let cachedUint32Memory0 = null;
317
+
318
+ function getUint32Memory0() {
319
+ if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
320
+ cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
321
+ }
322
+ return cachedUint32Memory0;
323
+ }
324
+
325
+ function passArray32ToWasm0(arg, malloc) {
326
+ const ptr = malloc(arg.length * 4);
327
+ getUint32Memory0().set(arg, ptr / 4);
328
+ WASM_VECTOR_LEN = arg.length;
329
+ return ptr;
330
+ }
331
+
332
+ function handleError(f, args) {
333
+ try {
334
+ return f.apply(this, args);
335
+ } catch (e) {
336
+ wasm.__wbindgen_export_3(addHeapObject(e));
337
+ }
338
+ }
339
+
340
+ function getArrayU8FromWasm0(ptr, len) {
341
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
342
+ }
343
+ /**
344
+ */
345
+ export const StepResultId = Object.freeze({ BreakpointHit:0,"0":"BreakpointHit",Next:1,"1":"Next",StepIn:2,"2":"StepIn",StepOut:3,"3":"StepOut",Return:4,"4":"Return", });
346
+ /**
347
+ */
348
+ export class DebugService {
349
+
350
+ static __wrap(ptr) {
351
+ const obj = Object.create(DebugService.prototype);
352
+ obj.ptr = ptr;
353
+
354
+ return obj;
355
+ }
356
+
357
+ __destroy_into_raw() {
358
+ const ptr = this.ptr;
359
+ this.ptr = 0;
360
+
361
+ return ptr;
362
+ }
363
+
364
+ free() {
365
+ const ptr = this.__destroy_into_raw();
366
+ wasm.__wbg_debugservice_free(ptr);
367
+ }
368
+ /**
369
+ */
370
+ constructor() {
371
+ const ret = wasm.debugservice_new();
372
+ return DebugService.__wrap(ret);
373
+ }
374
+ /**
375
+ * @param {string} path
376
+ * @param {string} source
377
+ * @param {string | undefined} entry
378
+ * @returns {string}
379
+ */
380
+ load_source(path, source, entry) {
381
+ try {
382
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
384
+ const len0 = WASM_VECTOR_LEN;
385
+ const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
386
+ const len1 = WASM_VECTOR_LEN;
387
+ var ptr2 = isLikeNone(entry) ? 0 : passStringToWasm0(entry, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
388
+ var len2 = WASM_VECTOR_LEN;
389
+ wasm.debugservice_load_source(retptr, this.ptr, ptr0, len0, ptr1, len1, ptr2, len2);
390
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
391
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
392
+ return getStringFromWasm0(r0, r1);
393
+ } finally {
394
+ wasm.__wbindgen_add_to_stack_pointer(16);
395
+ wasm.__wbindgen_export_2(r0, r1);
396
+ }
397
+ }
398
+ /**
399
+ * @returns {any}
400
+ */
401
+ capture_quantum_state() {
402
+ const ret = wasm.debugservice_capture_quantum_state(this.ptr);
403
+ return takeObject(ret);
404
+ }
405
+ /**
406
+ * @returns {any}
407
+ */
408
+ get_stack_frames() {
409
+ const ret = wasm.debugservice_get_stack_frames(this.ptr);
410
+ return takeObject(ret);
411
+ }
412
+ /**
413
+ * @param {Function} event_cb
414
+ * @param {Uint32Array} ids
415
+ * @returns {any}
416
+ */
417
+ eval_next(event_cb, ids) {
418
+ try {
419
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
420
+ const ptr0 = passArray32ToWasm0(ids, wasm.__wbindgen_export_0);
421
+ const len0 = WASM_VECTOR_LEN;
422
+ wasm.debugservice_eval_next(retptr, this.ptr, addBorrowedObject(event_cb), ptr0, len0);
423
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
424
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
425
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
426
+ if (r2) {
427
+ throw takeObject(r1);
428
+ }
429
+ return takeObject(r0);
430
+ } finally {
431
+ wasm.__wbindgen_add_to_stack_pointer(16);
432
+ heap[stack_pointer++] = undefined;
433
+ }
434
+ }
435
+ /**
436
+ * @param {Function} event_cb
437
+ * @param {Uint32Array} ids
438
+ * @returns {any}
439
+ */
440
+ eval_continue(event_cb, ids) {
441
+ try {
442
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
443
+ const ptr0 = passArray32ToWasm0(ids, wasm.__wbindgen_export_0);
444
+ const len0 = WASM_VECTOR_LEN;
445
+ wasm.debugservice_eval_continue(retptr, this.ptr, addBorrowedObject(event_cb), ptr0, len0);
446
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
447
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
448
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
449
+ if (r2) {
450
+ throw takeObject(r1);
451
+ }
452
+ return takeObject(r0);
453
+ } finally {
454
+ wasm.__wbindgen_add_to_stack_pointer(16);
455
+ heap[stack_pointer++] = undefined;
456
+ }
457
+ }
458
+ /**
459
+ * @param {Function} event_cb
460
+ * @param {Uint32Array} ids
461
+ * @returns {any}
462
+ */
463
+ eval_step_in(event_cb, ids) {
464
+ try {
465
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
466
+ const ptr0 = passArray32ToWasm0(ids, wasm.__wbindgen_export_0);
467
+ const len0 = WASM_VECTOR_LEN;
468
+ wasm.debugservice_eval_step_in(retptr, this.ptr, addBorrowedObject(event_cb), ptr0, len0);
469
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
470
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
471
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
472
+ if (r2) {
473
+ throw takeObject(r1);
474
+ }
475
+ return takeObject(r0);
476
+ } finally {
477
+ wasm.__wbindgen_add_to_stack_pointer(16);
478
+ heap[stack_pointer++] = undefined;
479
+ }
480
+ }
481
+ /**
482
+ * @param {Function} event_cb
483
+ * @param {Uint32Array} ids
484
+ * @returns {any}
485
+ */
486
+ eval_step_out(event_cb, ids) {
487
+ try {
488
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
489
+ const ptr0 = passArray32ToWasm0(ids, wasm.__wbindgen_export_0);
490
+ const len0 = WASM_VECTOR_LEN;
491
+ wasm.debugservice_eval_step_out(retptr, this.ptr, addBorrowedObject(event_cb), ptr0, len0);
492
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
493
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
494
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
495
+ if (r2) {
496
+ throw takeObject(r1);
497
+ }
498
+ return takeObject(r0);
499
+ } finally {
500
+ wasm.__wbindgen_add_to_stack_pointer(16);
501
+ heap[stack_pointer++] = undefined;
502
+ }
503
+ }
504
+ /**
505
+ * @param {string} path
506
+ * @returns {any}
507
+ */
508
+ get_breakpoints(path) {
509
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
510
+ const len0 = WASM_VECTOR_LEN;
511
+ const ret = wasm.debugservice_get_breakpoints(this.ptr, ptr0, len0);
512
+ return takeObject(ret);
513
+ }
514
+ /**
515
+ * @returns {any}
516
+ */
517
+ get_locals() {
518
+ const ret = wasm.debugservice_get_locals(this.ptr);
519
+ return takeObject(ret);
520
+ }
521
+ }
522
+ /**
523
+ */
524
+ export class LanguageService {
525
+
526
+ static __wrap(ptr) {
527
+ const obj = Object.create(LanguageService.prototype);
528
+ obj.ptr = ptr;
529
+
530
+ return obj;
531
+ }
532
+
533
+ __destroy_into_raw() {
534
+ const ptr = this.ptr;
535
+ this.ptr = 0;
536
+
537
+ return ptr;
538
+ }
539
+
540
+ free() {
541
+ const ptr = this.__destroy_into_raw();
542
+ wasm.__wbg_languageservice_free(ptr);
543
+ }
544
+ /**
545
+ * @param {Function} diagnostics_callback
546
+ */
547
+ constructor(diagnostics_callback) {
548
+ try {
549
+ const ret = wasm.languageservice_new(addBorrowedObject(diagnostics_callback));
550
+ return LanguageService.__wrap(ret);
551
+ } finally {
552
+ heap[stack_pointer++] = undefined;
553
+ }
554
+ }
555
+ /**
556
+ * @param {string} uri
557
+ * @param {number} version
558
+ * @param {string} text
559
+ * @param {boolean} is_exe
560
+ */
561
+ update_document(uri, version, text, is_exe) {
562
+ const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
563
+ const len0 = WASM_VECTOR_LEN;
564
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
565
+ const len1 = WASM_VECTOR_LEN;
566
+ wasm.languageservice_update_document(this.ptr, ptr0, len0, version, ptr1, len1, is_exe);
567
+ }
568
+ /**
569
+ * @param {string} uri
570
+ */
571
+ close_document(uri) {
572
+ const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
573
+ const len0 = WASM_VECTOR_LEN;
574
+ wasm.languageservice_close_document(this.ptr, ptr0, len0);
575
+ }
576
+ /**
577
+ * @param {string} uri
578
+ * @param {number} offset
579
+ * @returns {any}
580
+ */
581
+ get_completions(uri, offset) {
582
+ try {
583
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
584
+ const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
585
+ const len0 = WASM_VECTOR_LEN;
586
+ wasm.languageservice_get_completions(retptr, this.ptr, ptr0, len0, offset);
587
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
588
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
589
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
590
+ if (r2) {
591
+ throw takeObject(r1);
592
+ }
593
+ return takeObject(r0);
594
+ } finally {
595
+ wasm.__wbindgen_add_to_stack_pointer(16);
596
+ }
597
+ }
598
+ /**
599
+ * @param {string} uri
600
+ * @param {number} offset
601
+ * @returns {any}
602
+ */
603
+ get_definition(uri, offset) {
604
+ try {
605
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
606
+ const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
607
+ const len0 = WASM_VECTOR_LEN;
608
+ wasm.languageservice_get_definition(retptr, this.ptr, ptr0, len0, offset);
609
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
610
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
611
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
612
+ if (r2) {
613
+ throw takeObject(r1);
614
+ }
615
+ return takeObject(r0);
616
+ } finally {
617
+ wasm.__wbindgen_add_to_stack_pointer(16);
618
+ }
619
+ }
620
+ /**
621
+ * @param {string} uri
622
+ * @param {number} offset
623
+ * @returns {any}
624
+ */
625
+ get_hover(uri, offset) {
626
+ try {
627
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
628
+ const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
629
+ const len0 = WASM_VECTOR_LEN;
630
+ wasm.languageservice_get_hover(retptr, this.ptr, ptr0, len0, offset);
631
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
632
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
633
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
634
+ if (r2) {
635
+ throw takeObject(r1);
636
+ }
637
+ return takeObject(r0);
638
+ } finally {
639
+ wasm.__wbindgen_add_to_stack_pointer(16);
640
+ }
641
+ }
642
+ }
643
+ /**
644
+ */
645
+ export class StructStepResult {
646
+
647
+ static __wrap(ptr) {
648
+ const obj = Object.create(StructStepResult.prototype);
649
+ obj.ptr = ptr;
650
+
651
+ return obj;
652
+ }
653
+
654
+ __destroy_into_raw() {
655
+ const ptr = this.ptr;
656
+ this.ptr = 0;
657
+
658
+ return ptr;
659
+ }
660
+
661
+ free() {
662
+ const ptr = this.__destroy_into_raw();
663
+ wasm.__wbg_structstepresult_free(ptr);
664
+ }
665
+ /**
666
+ * @returns {number}
667
+ */
668
+ get id() {
669
+ const ret = wasm.__wbg_get_structstepresult_id(this.ptr);
670
+ return ret >>> 0;
671
+ }
672
+ /**
673
+ * @param {number} arg0
674
+ */
675
+ set id(arg0) {
676
+ wasm.__wbg_set_structstepresult_id(this.ptr, arg0);
677
+ }
678
+ /**
679
+ * @returns {number}
680
+ */
681
+ get value() {
682
+ const ret = wasm.__wbg_get_structstepresult_value(this.ptr);
683
+ return ret >>> 0;
684
+ }
685
+ /**
686
+ * @param {number} arg0
687
+ */
688
+ set value(arg0) {
689
+ wasm.__wbg_set_structstepresult_value(this.ptr, arg0);
690
+ }
691
+ }
692
+
693
+ async function load(module, imports) {
694
+ if (typeof Response === 'function' && module instanceof Response) {
695
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
696
+ try {
697
+ return await WebAssembly.instantiateStreaming(module, imports);
698
+
699
+ } catch (e) {
700
+ if (module.headers.get('Content-Type') != 'application/wasm') {
701
+ 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);
702
+
703
+ } else {
704
+ throw e;
705
+ }
706
+ }
707
+ }
708
+
709
+ const bytes = await module.arrayBuffer();
710
+ return await WebAssembly.instantiate(bytes, imports);
711
+
712
+ } else {
713
+ const instance = await WebAssembly.instantiate(module, imports);
714
+
715
+ if (instance instanceof WebAssembly.Instance) {
716
+ return { instance, module };
717
+
718
+ } else {
719
+ return instance;
720
+ }
721
+ }
722
+ }
723
+
724
+ function getImports() {
725
+ const imports = {};
726
+ imports.wbg = {};
727
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
728
+ takeObject(arg0);
729
+ };
730
+ imports.wbg.__wbg_new_0232637a3cb0b1a7 = function() {
731
+ const ret = new Error();
732
+ return addHeapObject(ret);
733
+ };
734
+ imports.wbg.__wbg_stack_3090cd8fd3702c6e = function(arg0, arg1) {
735
+ const ret = getObject(arg1).stack;
736
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
737
+ const len0 = WASM_VECTOR_LEN;
738
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
739
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
740
+ };
741
+ imports.wbg.__wbindgen_is_function = function(arg0) {
742
+ const ret = typeof(getObject(arg0)) === 'function';
743
+ return ret;
744
+ };
745
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
746
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
747
+ return addHeapObject(ret);
748
+ };
749
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
750
+ const ret = getStringFromWasm0(arg0, arg1);
751
+ return addHeapObject(ret);
752
+ };
753
+ imports.wbg.__wbg_structstepresult_new = function(arg0) {
754
+ const ret = StructStepResult.__wrap(arg0);
755
+ return addHeapObject(ret);
756
+ };
757
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
758
+ const obj = getObject(arg1);
759
+ const ret = typeof(obj) === 'string' ? obj : undefined;
760
+ var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
761
+ var len0 = WASM_VECTOR_LEN;
762
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
763
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
764
+ };
765
+ imports.wbg.__wbindgen_number_new = function(arg0) {
766
+ const ret = arg0;
767
+ return addHeapObject(ret);
768
+ };
769
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
770
+ const ret = getObject(arg0);
771
+ return addHeapObject(ret);
772
+ };
773
+ imports.wbg.__wbindgen_is_object = function(arg0) {
774
+ const val = getObject(arg0);
775
+ const ret = typeof(val) === 'object' && val !== null;
776
+ return ret;
777
+ };
778
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
779
+ const ret = getObject(arg0) == getObject(arg1);
780
+ return ret;
781
+ };
782
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
783
+ const v = getObject(arg0);
784
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
785
+ return ret;
786
+ };
787
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
788
+ const obj = getObject(arg1);
789
+ const ret = typeof(obj) === 'number' ? obj : undefined;
790
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
791
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
792
+ };
793
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
794
+ const ret = BigInt.asUintN(64, arg0);
795
+ return addHeapObject(ret);
796
+ };
797
+ imports.wbg.__wbg_set_841ac57cff3d672b = function(arg0, arg1, arg2) {
798
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
799
+ };
800
+ imports.wbg.__wbg_crypto_e1d53a1d73fb10b8 = function(arg0) {
801
+ const ret = getObject(arg0).crypto;
802
+ return addHeapObject(ret);
803
+ };
804
+ imports.wbg.__wbg_process_038c26bf42b093f8 = function(arg0) {
805
+ const ret = getObject(arg0).process;
806
+ return addHeapObject(ret);
807
+ };
808
+ imports.wbg.__wbg_versions_ab37218d2f0b24a8 = function(arg0) {
809
+ const ret = getObject(arg0).versions;
810
+ return addHeapObject(ret);
811
+ };
812
+ imports.wbg.__wbg_node_080f4b19d15bc1fe = function(arg0) {
813
+ const ret = getObject(arg0).node;
814
+ return addHeapObject(ret);
815
+ };
816
+ imports.wbg.__wbindgen_is_string = function(arg0) {
817
+ const ret = typeof(getObject(arg0)) === 'string';
818
+ return ret;
819
+ };
820
+ imports.wbg.__wbg_msCrypto_6e7d3e1f92610cbb = function(arg0) {
821
+ const ret = getObject(arg0).msCrypto;
822
+ return addHeapObject(ret);
823
+ };
824
+ imports.wbg.__wbg_require_78a3dcfbdba9cbce = function() { return handleError(function () {
825
+ const ret = module.require;
826
+ return addHeapObject(ret);
827
+ }, arguments) };
828
+ imports.wbg.__wbg_randomFillSync_6894564c2c334c42 = function() { return handleError(function (arg0, arg1, arg2) {
829
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
830
+ }, arguments) };
831
+ imports.wbg.__wbg_getRandomValues_805f1c3d65988a5a = function() { return handleError(function (arg0, arg1) {
832
+ getObject(arg0).getRandomValues(getObject(arg1));
833
+ }, arguments) };
834
+ imports.wbg.__wbg_get_27fe3dac1c4d0224 = function(arg0, arg1) {
835
+ const ret = getObject(arg0)[arg1 >>> 0];
836
+ return addHeapObject(ret);
837
+ };
838
+ imports.wbg.__wbg_length_e498fbc24f9c1d4f = function(arg0) {
839
+ const ret = getObject(arg0).length;
840
+ return ret;
841
+ };
842
+ imports.wbg.__wbg_new_b525de17f44a8943 = function() {
843
+ const ret = new Array();
844
+ return addHeapObject(ret);
845
+ };
846
+ imports.wbg.__wbg_newnoargs_2b8b6bd7753c76ba = function(arg0, arg1) {
847
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
848
+ return addHeapObject(ret);
849
+ };
850
+ imports.wbg.__wbg_next_b7d530c04fd8b217 = function(arg0) {
851
+ const ret = getObject(arg0).next;
852
+ return addHeapObject(ret);
853
+ };
854
+ imports.wbg.__wbg_next_88560ec06a094dea = function() { return handleError(function (arg0) {
855
+ const ret = getObject(arg0).next();
856
+ return addHeapObject(ret);
857
+ }, arguments) };
858
+ imports.wbg.__wbg_done_1ebec03bbd919843 = function(arg0) {
859
+ const ret = getObject(arg0).done;
860
+ return ret;
861
+ };
862
+ imports.wbg.__wbg_value_6ac8da5cc5b3efda = function(arg0) {
863
+ const ret = getObject(arg0).value;
864
+ return addHeapObject(ret);
865
+ };
866
+ imports.wbg.__wbg_iterator_55f114446221aa5a = function() {
867
+ const ret = Symbol.iterator;
868
+ return addHeapObject(ret);
869
+ };
870
+ imports.wbg.__wbg_get_baf4855f9a986186 = function() { return handleError(function (arg0, arg1) {
871
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
872
+ return addHeapObject(ret);
873
+ }, arguments) };
874
+ imports.wbg.__wbg_call_95d1ea488d03e4e8 = function() { return handleError(function (arg0, arg1) {
875
+ const ret = getObject(arg0).call(getObject(arg1));
876
+ return addHeapObject(ret);
877
+ }, arguments) };
878
+ imports.wbg.__wbg_new_f9876326328f45ed = function() {
879
+ const ret = new Object();
880
+ return addHeapObject(ret);
881
+ };
882
+ imports.wbg.__wbg_self_e7c1f827057f6584 = function() { return handleError(function () {
883
+ const ret = self.self;
884
+ return addHeapObject(ret);
885
+ }, arguments) };
886
+ imports.wbg.__wbg_window_a09ec664e14b1b81 = function() { return handleError(function () {
887
+ const ret = window.window;
888
+ return addHeapObject(ret);
889
+ }, arguments) };
890
+ imports.wbg.__wbg_globalThis_87cbb8506fecf3a9 = function() { return handleError(function () {
891
+ const ret = globalThis.globalThis;
892
+ return addHeapObject(ret);
893
+ }, arguments) };
894
+ imports.wbg.__wbg_global_c85a9259e621f3db = function() { return handleError(function () {
895
+ const ret = global.global;
896
+ return addHeapObject(ret);
897
+ }, arguments) };
898
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
899
+ const ret = getObject(arg0) === undefined;
900
+ return ret;
901
+ };
902
+ imports.wbg.__wbg_set_17224bc548dd1d7b = function(arg0, arg1, arg2) {
903
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
904
+ };
905
+ imports.wbg.__wbg_isArray_39d28997bf6b96b4 = function(arg0) {
906
+ const ret = Array.isArray(getObject(arg0));
907
+ return ret;
908
+ };
909
+ imports.wbg.__wbg_instanceof_ArrayBuffer_a69f02ee4c4f5065 = function(arg0) {
910
+ let result;
911
+ try {
912
+ result = getObject(arg0) instanceof ArrayBuffer;
913
+ } catch {
914
+ result = false;
915
+ }
916
+ const ret = result;
917
+ return ret;
918
+ };
919
+ imports.wbg.__wbg_call_9495de66fdbe016b = function() { return handleError(function (arg0, arg1, arg2) {
920
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
921
+ return addHeapObject(ret);
922
+ }, arguments) };
923
+ imports.wbg.__wbg_call_99043a1e2a9e5916 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
924
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3), getObject(arg4));
925
+ return addHeapObject(ret);
926
+ }, arguments) };
927
+ imports.wbg.__wbg_buffer_cf65c07de34b9a08 = function(arg0) {
928
+ const ret = getObject(arg0).buffer;
929
+ return addHeapObject(ret);
930
+ };
931
+ imports.wbg.__wbg_new_537b7341ce90bb31 = function(arg0) {
932
+ const ret = new Uint8Array(getObject(arg0));
933
+ return addHeapObject(ret);
934
+ };
935
+ imports.wbg.__wbg_set_17499e8aa4003ebd = function(arg0, arg1, arg2) {
936
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
937
+ };
938
+ imports.wbg.__wbg_length_27a2afe8ab42b09f = function(arg0) {
939
+ const ret = getObject(arg0).length;
940
+ return ret;
941
+ };
942
+ imports.wbg.__wbg_instanceof_Uint8Array_01cebe79ca606cca = function(arg0) {
943
+ let result;
944
+ try {
945
+ result = getObject(arg0) instanceof Uint8Array;
946
+ } catch {
947
+ result = false;
948
+ }
949
+ const ret = result;
950
+ return ret;
951
+ };
952
+ imports.wbg.__wbg_newwithlength_b56c882b57805732 = function(arg0) {
953
+ const ret = new Uint8Array(arg0 >>> 0);
954
+ return addHeapObject(ret);
955
+ };
956
+ imports.wbg.__wbg_subarray_7526649b91a252a6 = function(arg0, arg1, arg2) {
957
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
958
+ return addHeapObject(ret);
959
+ };
960
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
961
+ const ret = debugString(getObject(arg1));
962
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
963
+ const len0 = WASM_VECTOR_LEN;
964
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
965
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
966
+ };
967
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
968
+ throw new Error(getStringFromWasm0(arg0, arg1));
969
+ };
970
+ imports.wbg.__wbindgen_memory = function() {
971
+ const ret = wasm.memory;
972
+ return addHeapObject(ret);
973
+ };
974
+
975
+ return imports;
976
+ }
977
+
978
+ function initMemory(imports, maybe_memory) {
979
+
980
+ }
981
+
982
+ function finalizeInit(instance, module) {
983
+ wasm = instance.exports;
984
+ init.__wbindgen_wasm_module = module;
985
+ cachedFloat64Memory0 = null;
986
+ cachedInt32Memory0 = null;
987
+ cachedUint32Memory0 = null;
988
+ cachedUint8Memory0 = null;
989
+
990
+
991
+ return wasm;
992
+ }
993
+
994
+ function initSync(module) {
995
+ const imports = getImports();
996
+
997
+ initMemory(imports);
998
+
999
+ if (!(module instanceof WebAssembly.Module)) {
1000
+ module = new WebAssembly.Module(module);
1001
+ }
1002
+
1003
+ const instance = new WebAssembly.Instance(module, imports);
1004
+
1005
+ return finalizeInit(instance, module);
1006
+ }
1007
+
1008
+ async function init(input) {
1009
+ if (typeof input === 'undefined') {
1010
+ input = new URL('qsc_wasm_bg.wasm', import.meta.url);
1011
+ }
1012
+ const imports = getImports();
1013
+
1014
+ if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
1015
+ input = fetch(input);
1016
+ }
1017
+
1018
+ initMemory(imports);
1019
+
1020
+ const { instance, module } = await load(await input, imports);
1021
+
1022
+ return finalizeInit(instance, module);
1023
+ }
1024
+
1025
+ export { initSync }
1026
+ export default init;