qsharp-lang 1.0.27-dev → 1.0.29-dev

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.
@@ -6,32 +6,7 @@ heap.push(undefined, null, true, false);
6
6
 
7
7
  function getObject(idx) { return heap[idx]; }
8
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
- function addHeapObject(obj) {
24
- if (heap_next === heap.length) heap.push(heap.length + 1);
25
- const idx = heap_next;
26
- heap_next = heap[idx];
27
-
28
- heap[idx] = obj;
29
- return idx;
30
- }
31
-
32
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
33
-
34
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
9
+ let WASM_VECTOR_LEN = 0;
35
10
 
36
11
  let cachedUint8Memory0 = null;
37
12
 
@@ -42,13 +17,6 @@ function getUint8Memory0() {
42
17
  return cachedUint8Memory0;
43
18
  }
44
19
 
45
- function getStringFromWasm0(ptr, len) {
46
- ptr = ptr >>> 0;
47
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
48
- }
49
-
50
- let WASM_VECTOR_LEN = 0;
51
-
52
20
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
53
21
 
54
22
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -124,6 +92,38 @@ function getFloat64Memory0() {
124
92
  return cachedFloat64Memory0;
125
93
  }
126
94
 
95
+ let heap_next = heap.length;
96
+
97
+ function dropObject(idx) {
98
+ if (idx < 132) return;
99
+ heap[idx] = heap_next;
100
+ heap_next = idx;
101
+ }
102
+
103
+ function takeObject(idx) {
104
+ const ret = getObject(idx);
105
+ dropObject(idx);
106
+ return ret;
107
+ }
108
+
109
+ function addHeapObject(obj) {
110
+ if (heap_next === heap.length) heap.push(heap.length + 1);
111
+ const idx = heap_next;
112
+ heap_next = heap[idx];
113
+
114
+ heap[idx] = obj;
115
+ return idx;
116
+ }
117
+
118
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
119
+
120
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
121
+
122
+ function getStringFromWasm0(ptr, len) {
123
+ ptr = ptr >>> 0;
124
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
125
+ }
126
+
127
127
  function debugString(val) {
128
128
  // primitive types
129
129
  const type = typeof val;
@@ -189,12 +189,32 @@ function debugString(val) {
189
189
  return className;
190
190
  }
191
191
 
192
- let stack_pointer = 128;
192
+ function makeMutClosure(arg0, arg1, dtor, f) {
193
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
194
+ const real = (...args) => {
195
+ // First up with a closure we increment the internal reference
196
+ // count. This ensures that the Rust closure environment won't
197
+ // be deallocated while we're invoking it.
198
+ state.cnt++;
199
+ const a = state.a;
200
+ state.a = 0;
201
+ try {
202
+ return f(a, state.b, ...args);
203
+ } finally {
204
+ if (--state.cnt === 0) {
205
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
193
206
 
194
- function addBorrowedObject(obj) {
195
- if (stack_pointer == 1) throw new Error('out of js stack');
196
- heap[--stack_pointer] = obj;
197
- return stack_pointer;
207
+ } else {
208
+ state.a = a;
209
+ }
210
+ }
211
+ };
212
+ real.original = state;
213
+
214
+ return real;
215
+ }
216
+ function __wbg_adapter_44(arg0, arg1, arg2) {
217
+ wasm.__wbindgen_export_3(arg0, arg1, addHeapObject(arg2));
198
218
  }
199
219
 
200
220
  let cachedUint32Memory0 = null;
@@ -206,13 +226,6 @@ function getUint32Memory0() {
206
226
  return cachedUint32Memory0;
207
227
  }
208
228
 
209
- function passArray32ToWasm0(arg, malloc) {
210
- const ptr = malloc(arg.length * 4, 4) >>> 0;
211
- getUint32Memory0().set(arg, ptr / 4);
212
- WASM_VECTOR_LEN = arg.length;
213
- return ptr;
214
- }
215
-
216
229
  function passArrayJsValueToWasm0(array, malloc) {
217
230
  const ptr = malloc(array.length * 4, 4) >>> 0;
218
231
  const mem = getUint32Memory0();
@@ -223,6 +236,21 @@ function passArrayJsValueToWasm0(array, malloc) {
223
236
  return ptr;
224
237
  }
225
238
 
239
+ let stack_pointer = 128;
240
+
241
+ function addBorrowedObject(obj) {
242
+ if (stack_pointer == 1) throw new Error('out of js stack');
243
+ heap[--stack_pointer] = obj;
244
+ return stack_pointer;
245
+ }
246
+
247
+ function passArray32ToWasm0(arg, malloc) {
248
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
249
+ getUint32Memory0().set(arg, ptr / 4);
250
+ WASM_VECTOR_LEN = arg.length;
251
+ return ptr;
252
+ }
253
+
226
254
  function getArrayJsValueFromWasm0(ptr, len) {
227
255
  ptr = ptr >>> 0;
228
256
  const mem = getUint32Memory0();
@@ -274,20 +302,20 @@ export function git_hash() {
274
302
  return getStringFromWasm0(r0, r1);
275
303
  } finally {
276
304
  wasm.__wbindgen_add_to_stack_pointer(16);
277
- wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
305
+ wasm.__wbindgen_export_4(deferred1_0, deferred1_1, 1);
278
306
  }
279
307
  }
280
308
 
281
309
  /**
282
- * @param {string} code
310
+ * @param {(Array<any>)[]} sources
283
311
  * @returns {string}
284
312
  */
285
- export function get_qir(code) {
313
+ export function get_qir(sources) {
286
314
  let deferred3_0;
287
315
  let deferred3_1;
288
316
  try {
289
317
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
290
- const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
318
+ const ptr0 = passArrayJsValueToWasm0(sources, wasm.__wbindgen_export_0);
291
319
  const len0 = WASM_VECTOR_LEN;
292
320
  wasm.get_qir(retptr, ptr0, len0);
293
321
  var r0 = getInt32Memory0()[retptr / 4 + 0];
@@ -305,21 +333,21 @@ export function get_qir(code) {
305
333
  return getStringFromWasm0(ptr2, len2);
306
334
  } finally {
307
335
  wasm.__wbindgen_add_to_stack_pointer(16);
308
- wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
336
+ wasm.__wbindgen_export_4(deferred3_0, deferred3_1, 1);
309
337
  }
310
338
  }
311
339
 
312
340
  /**
313
- * @param {string} code
341
+ * @param {(Array<any>)[]} sources
314
342
  * @param {string} params
315
343
  * @returns {string}
316
344
  */
317
- export function get_estimates(code, params) {
345
+ export function get_estimates(sources, params) {
318
346
  let deferred4_0;
319
347
  let deferred4_1;
320
348
  try {
321
349
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
322
- const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
350
+ const ptr0 = passArrayJsValueToWasm0(sources, wasm.__wbindgen_export_0);
323
351
  const len0 = WASM_VECTOR_LEN;
324
352
  const ptr1 = passStringToWasm0(params, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
325
353
  const len1 = WASM_VECTOR_LEN;
@@ -339,7 +367,7 @@ export function get_estimates(code, params) {
339
367
  return getStringFromWasm0(ptr3, len3);
340
368
  } finally {
341
369
  wasm.__wbindgen_add_to_stack_pointer(16);
342
- wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
370
+ wasm.__wbindgen_export_4(deferred4_0, deferred4_1, 1);
343
371
  }
344
372
  }
345
373
 
@@ -358,7 +386,7 @@ export function get_library_source_content(name) {
358
386
  let v2;
359
387
  if (r0 !== 0) {
360
388
  v2 = getStringFromWasm0(r0, r1).slice();
361
- wasm.__wbindgen_export_2(r0, r1 * 1);
389
+ wasm.__wbindgen_export_4(r0, r1 * 1);
362
390
  }
363
391
  return v2;
364
392
  } finally {
@@ -385,21 +413,21 @@ export function get_hir(code) {
385
413
  return getStringFromWasm0(r0, r1);
386
414
  } finally {
387
415
  wasm.__wbindgen_add_to_stack_pointer(16);
388
- wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
416
+ wasm.__wbindgen_export_4(deferred2_0, deferred2_1, 1);
389
417
  }
390
418
  }
391
419
 
392
420
  /**
393
- * @param {string} code
421
+ * @param {(Array<any>)[]} sources
394
422
  * @param {string} expr
395
423
  * @param {Function} event_cb
396
424
  * @param {number} shots
397
425
  * @returns {boolean}
398
426
  */
399
- export function run(code, expr, event_cb, shots) {
427
+ export function run(sources, expr, event_cb, shots) {
400
428
  try {
401
429
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
402
- const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
430
+ const ptr0 = passArrayJsValueToWasm0(sources, wasm.__wbindgen_export_0);
403
431
  const len0 = WASM_VECTOR_LEN;
404
432
  const ptr1 = passStringToWasm0(expr, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
405
433
  const len1 = WASM_VECTOR_LEN;
@@ -438,9 +466,13 @@ function handleError(f, args) {
438
466
  try {
439
467
  return f.apply(this, args);
440
468
  } catch (e) {
441
- wasm.__wbindgen_export_3(addHeapObject(e));
469
+ wasm.__wbindgen_export_5(addHeapObject(e));
442
470
  }
443
471
  }
472
+ function __wbg_adapter_145(arg0, arg1, arg2, arg3) {
473
+ wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
474
+ }
475
+
444
476
  /**
445
477
  */
446
478
  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", });
@@ -474,34 +506,31 @@ export class DebugService {
474
506
  return DebugService.__wrap(ret);
475
507
  }
476
508
  /**
477
- * @param {string} path
478
- * @param {string} source
509
+ * @param {(Array<any>)[]} sources
479
510
  * @param {string} target_profile
480
511
  * @param {string | undefined} entry
481
512
  * @returns {string}
482
513
  */
483
- load_source(path, source, target_profile, entry) {
484
- let deferred5_0;
485
- let deferred5_1;
514
+ load_source(sources, target_profile, entry) {
515
+ let deferred4_0;
516
+ let deferred4_1;
486
517
  try {
487
518
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
488
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
519
+ const ptr0 = passArrayJsValueToWasm0(sources, wasm.__wbindgen_export_0);
489
520
  const len0 = WASM_VECTOR_LEN;
490
- const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
521
+ const ptr1 = passStringToWasm0(target_profile, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
491
522
  const len1 = WASM_VECTOR_LEN;
492
- const ptr2 = passStringToWasm0(target_profile, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
493
- const len2 = WASM_VECTOR_LEN;
494
- var ptr3 = isLikeNone(entry) ? 0 : passStringToWasm0(entry, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
495
- var len3 = WASM_VECTOR_LEN;
496
- wasm.debugservice_load_source(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
523
+ var ptr2 = isLikeNone(entry) ? 0 : passStringToWasm0(entry, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
524
+ var len2 = WASM_VECTOR_LEN;
525
+ wasm.debugservice_load_source(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
497
526
  var r0 = getInt32Memory0()[retptr / 4 + 0];
498
527
  var r1 = getInt32Memory0()[retptr / 4 + 1];
499
- deferred5_0 = r0;
500
- deferred5_1 = r1;
528
+ deferred4_0 = r0;
529
+ deferred4_1 = r1;
501
530
  return getStringFromWasm0(r0, r1);
502
531
  } finally {
503
532
  wasm.__wbindgen_add_to_stack_pointer(16);
504
- wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
533
+ wasm.__wbindgen_export_4(deferred4_0, deferred4_1, 1);
505
534
  }
506
535
  }
507
536
  /**
@@ -652,13 +681,28 @@ export class LanguageService {
652
681
  wasm.__wbg_languageservice_free(ptr);
653
682
  }
654
683
  /**
655
- * @param {(uri: string, version: number | undefined, diagnostics: VSDiagnostic[]) => void} diagnostics_callback
656
684
  */
657
- constructor(diagnostics_callback) {
658
- const ret = wasm.languageservice_new(addHeapObject(diagnostics_callback));
685
+ constructor() {
686
+ const ret = wasm.languageservice_new();
659
687
  return LanguageService.__wrap(ret);
660
688
  }
661
689
  /**
690
+ * @param {(uri: string, version: number | undefined, diagnostics: VSDiagnostic[]) => void} diagnostics_callback
691
+ * @param {(uri: string) => Promise<string | null>} read_file
692
+ * @param {(uri: string) => Promise<[string, number][]>} list_directory
693
+ * @param {(uri: string) => Promise<{ manifestDirectory: string }| null>} get_manifest
694
+ * @returns {Promise<any>}
695
+ */
696
+ start_background_work(diagnostics_callback, read_file, list_directory, get_manifest) {
697
+ const ret = wasm.languageservice_start_background_work(this.__wbg_ptr, addHeapObject(diagnostics_callback), addHeapObject(read_file), addHeapObject(list_directory), addHeapObject(get_manifest));
698
+ return takeObject(ret);
699
+ }
700
+ /**
701
+ */
702
+ stop_background_work() {
703
+ wasm.languageservice_stop_background_work(this.__wbg_ptr);
704
+ }
705
+ /**
662
706
  * @param {IWorkspaceConfiguration} config
663
707
  */
664
708
  update_configuration(config) {
@@ -744,7 +788,7 @@ export class LanguageService {
744
788
  var r0 = getInt32Memory0()[retptr / 4 + 0];
745
789
  var r1 = getInt32Memory0()[retptr / 4 + 1];
746
790
  var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
747
- wasm.__wbindgen_export_2(r0, r1 * 4);
791
+ wasm.__wbindgen_export_4(r0, r1 * 4);
748
792
  return v2;
749
793
  } finally {
750
794
  wasm.__wbindgen_add_to_stack_pointer(16);
@@ -798,6 +842,49 @@ export class LanguageService {
798
842
  return takeObject(ret);
799
843
  }
800
844
  }
845
+ /**
846
+ * a minimal implementation for interacting with async JS filesystem callbacks to
847
+ * load project files
848
+ */
849
+ export class ProjectLoader {
850
+
851
+ static __wrap(ptr) {
852
+ ptr = ptr >>> 0;
853
+ const obj = Object.create(ProjectLoader.prototype);
854
+ obj.__wbg_ptr = ptr;
855
+
856
+ return obj;
857
+ }
858
+
859
+ __destroy_into_raw() {
860
+ const ptr = this.__wbg_ptr;
861
+ this.__wbg_ptr = 0;
862
+
863
+ return ptr;
864
+ }
865
+
866
+ free() {
867
+ const ptr = this.__destroy_into_raw();
868
+ wasm.__wbg_projectloader_free(ptr);
869
+ }
870
+ /**
871
+ * @param {(uri: string) => Promise<string | null>} read_file
872
+ * @param {(uri: string) => Promise<[string, number][]>} list_directory
873
+ * @param {(uri: string) => Promise<{ manifestDirectory: string }| null>} get_manifest
874
+ */
875
+ constructor(read_file, list_directory, get_manifest) {
876
+ const ret = wasm.projectloader_new(addHeapObject(read_file), addHeapObject(list_directory), addHeapObject(get_manifest));
877
+ return ProjectLoader.__wrap(ret);
878
+ }
879
+ /**
880
+ * @param {{ manifestDirectory: string }} manifest
881
+ * @returns {Promise<[string, string][]>}
882
+ */
883
+ load_project(manifest) {
884
+ const ret = wasm.projectloader_load_project(this.__wbg_ptr, addHeapObject(manifest));
885
+ return takeObject(ret);
886
+ }
887
+ }
801
888
 
802
889
  async function __wbg_load(module, imports) {
803
890
  if (typeof Response === 'function' && module instanceof Response) {
@@ -833,9 +920,32 @@ async function __wbg_load(module, imports) {
833
920
  function __wbg_get_imports() {
834
921
  const imports = {};
835
922
  imports.wbg = {};
923
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
924
+ const obj = getObject(arg1);
925
+ const ret = typeof(obj) === 'string' ? obj : undefined;
926
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
927
+ var len1 = WASM_VECTOR_LEN;
928
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
929
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
930
+ };
931
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
932
+ const obj = getObject(arg1);
933
+ const ret = typeof(obj) === 'number' ? obj : undefined;
934
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
935
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
936
+ };
836
937
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
837
938
  takeObject(arg0);
838
939
  };
940
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
941
+ const obj = takeObject(arg0).original;
942
+ if (obj.cnt-- == 1) {
943
+ obj.a = 0;
944
+ return true;
945
+ }
946
+ const ret = false;
947
+ return ret;
948
+ };
839
949
  imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
840
950
  const ret = BigInt.asUintN(64, arg0);
841
951
  return addHeapObject(ret);
@@ -857,14 +967,6 @@ function __wbg_get_imports() {
857
967
  const ret = getObject(arg0) in getObject(arg1);
858
968
  return ret;
859
969
  };
860
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
861
- const obj = getObject(arg1);
862
- const ret = typeof(obj) === 'string' ? obj : undefined;
863
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
864
- var len1 = WASM_VECTOR_LEN;
865
- getInt32Memory0()[arg0 / 4 + 1] = len1;
866
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
867
- };
868
970
  imports.wbg.__wbindgen_number_new = function(arg0) {
869
971
  const ret = arg0;
870
972
  return addHeapObject(ret);
@@ -884,10 +986,18 @@ function __wbg_get_imports() {
884
986
  getInt32Memory0()[arg0 / 4 + 1] = len1;
885
987
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
886
988
  };
989
+ imports.wbg.__wbindgen_is_null = function(arg0) {
990
+ const ret = getObject(arg0) === null;
991
+ return ret;
992
+ };
887
993
  imports.wbg.__wbindgen_is_function = function(arg0) {
888
994
  const ret = typeof(getObject(arg0)) === 'function';
889
995
  return ret;
890
996
  };
997
+ imports.wbg.__wbindgen_typeof = function(arg0) {
998
+ const ret = typeof getObject(arg0);
999
+ return addHeapObject(ret);
1000
+ };
891
1001
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
892
1002
  const ret = getObject(arg0);
893
1003
  return addHeapObject(ret);
@@ -901,12 +1011,6 @@ function __wbg_get_imports() {
901
1011
  const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
902
1012
  return ret;
903
1013
  };
904
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
905
- const obj = getObject(arg1);
906
- const ret = typeof(obj) === 'number' ? obj : undefined;
907
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
908
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
909
- };
910
1014
  imports.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea = function(arg0, arg1) {
911
1015
  const ret = getObject(arg0)[getObject(arg1)];
912
1016
  return addHeapObject(ret);
@@ -1003,6 +1107,10 @@ function __wbg_get_imports() {
1003
1107
  const ret = Array.isArray(getObject(arg0));
1004
1108
  return ret;
1005
1109
  };
1110
+ imports.wbg.__wbg_push_ca1c26067ef907ac = function(arg0, arg1) {
1111
+ const ret = getObject(arg0).push(getObject(arg1));
1112
+ return ret;
1113
+ };
1006
1114
  imports.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb = function(arg0) {
1007
1115
  let result;
1008
1116
  try {
@@ -1029,6 +1137,36 @@ function __wbg_get_imports() {
1029
1137
  const ret = getObject(arg0).buffer;
1030
1138
  return addHeapObject(ret);
1031
1139
  };
1140
+ imports.wbg.__wbg_new_43f1b47c28813cbd = function(arg0, arg1) {
1141
+ try {
1142
+ var state0 = {a: arg0, b: arg1};
1143
+ var cb0 = (arg0, arg1) => {
1144
+ const a = state0.a;
1145
+ state0.a = 0;
1146
+ try {
1147
+ return __wbg_adapter_145(a, state0.b, arg0, arg1);
1148
+ } finally {
1149
+ state0.a = a;
1150
+ }
1151
+ };
1152
+ const ret = new Promise(cb0);
1153
+ return addHeapObject(ret);
1154
+ } finally {
1155
+ state0.a = state0.b = 0;
1156
+ }
1157
+ };
1158
+ imports.wbg.__wbg_resolve_53698b95aaf7fcf8 = function(arg0) {
1159
+ const ret = Promise.resolve(getObject(arg0));
1160
+ return addHeapObject(ret);
1161
+ };
1162
+ imports.wbg.__wbg_then_f7e06ee3c11698eb = function(arg0, arg1) {
1163
+ const ret = getObject(arg0).then(getObject(arg1));
1164
+ return addHeapObject(ret);
1165
+ };
1166
+ imports.wbg.__wbg_then_b2267541e2a73865 = function(arg0, arg1, arg2) {
1167
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1168
+ return addHeapObject(ret);
1169
+ };
1032
1170
  imports.wbg.__wbg_self_1ff1d729e9aae938 = function() { return handleError(function () {
1033
1171
  const ret = self.self;
1034
1172
  return addHeapObject(ret);
@@ -1092,6 +1230,10 @@ function __wbg_get_imports() {
1092
1230
  const ret = wasm.memory;
1093
1231
  return addHeapObject(ret);
1094
1232
  };
1233
+ imports.wbg.__wbindgen_closure_wrapper536 = function(arg0, arg1, arg2) {
1234
+ const ret = makeMutClosure(arg0, arg1, 156, __wbg_adapter_44);
1235
+ return addHeapObject(ret);
1236
+ };
1095
1237
 
1096
1238
  return imports;
1097
1239
  }
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qsharp-lang",
3
3
  "description": "qsharp language package for quantum development",
4
- "version": "1.0.27-dev",
4
+ "version": "1.0.29-dev",
5
5
  "license": "MIT",
6
6
  "engines": {
7
7
  "node": ">=16.17.0"
package/ux/index.ts CHANGED
@@ -8,4 +8,4 @@ import "./qsharp-ux.css";
8
8
  export { Histogram } from "./histogram.js";
9
9
  export { ReTable, type ReData } from "./reTable.js";
10
10
  export { SpaceChart } from "./spaceChart.js";
11
- export { ResultsTable, type CellValue } from "./resultsTable.js";
11
+ export { ResultsTable } from "./resultsTable.js";
package/ux/reTable.tsx CHANGED
@@ -25,6 +25,7 @@ export type ReData = {
25
25
  }[];
26
26
  assumptions: string[];
27
27
  };
28
+ new: boolean;
28
29
  };
29
30
 
30
31
  export function ReTable(props: {
@@ -2,13 +2,14 @@
2
2
  // Licensed under the MIT License.
3
3
 
4
4
  import { useRef, useState } from "preact/hooks";
5
+ import { type ReData } from "./reTable.js";
5
6
 
6
- export type CellValue = string | number | { value: string; sortBy: number };
7
+ type CellValue = string | number | { value: string; sortBy: number };
7
8
 
8
9
  // Note: column 0 is expected to be unique amongst all rows
9
10
  export function ResultsTable(props: {
10
11
  columnNames: string[];
11
- rows: CellValue[][];
12
+ data: ReData[];
12
13
  initialColumns: number[];
13
14
  ensureSelected: boolean;
14
15
  onRowSelected(rowId: string): void;
@@ -23,8 +24,20 @@ export function ResultsTable(props: {
23
24
  const [showColumnMenu, setShowColumnMenu] = useState(false);
24
25
  const [showRowMenu, setShowRowMenu] = useState("");
25
26
 
26
- if (!selectedRow && props.ensureSelected && props.rows.length > 0) {
27
- const rowId = props.rows[0][0].toString();
27
+ const rows = props.data.map(ReDataToRow);
28
+
29
+ // Find the first row that is new in the current sort order
30
+ const newest = getSortedRows(rows).find(
31
+ (row) => (row[row.length - 1] as string) === "New",
32
+ );
33
+
34
+ // Select the first of the newest rows, otherwise preserve the existing selection
35
+ if (newest && props.ensureSelected) {
36
+ const rowId = newest[0].toString();
37
+ setSelectedRow(rowId);
38
+ props.onRowSelected(rowId);
39
+ } else if (!selectedRow && props.ensureSelected && rows.length > 0) {
40
+ const rowId = rows[0][0].toString();
28
41
  setSelectedRow(rowId);
29
42
  props.onRowSelected(rowId);
30
43
  }
@@ -331,7 +344,7 @@ export function ResultsTable(props: {
331
344
  </tr>
332
345
  </thead>
333
346
  <tbody>
334
- {getSortedRows(props.rows).map((row) => {
347
+ {getSortedRows(rows).map((row) => {
335
348
  const rowId = row[0].toString();
336
349
  return (
337
350
  <tr
@@ -383,3 +396,25 @@ export function ResultsTable(props: {
383
396
  </table>
384
397
  );
385
398
  }
399
+
400
+ function ReDataToRow(data: ReData): CellValue[] {
401
+ return [
402
+ data.jobParams.runName,
403
+ data.jobParams.qubitParams.name,
404
+ data.jobParams.qecScheme.name,
405
+ data.jobParams.errorBudget,
406
+ data.physicalCounts.breakdown.algorithmicLogicalQubits,
407
+ data.physicalCounts.breakdown.algorithmicLogicalDepth,
408
+ data.logicalQubit.codeDistance,
409
+ data.physicalCounts.breakdown.numTstates,
410
+ data.physicalCounts.breakdown.numTfactories,
411
+ data.physicalCountsFormatted.physicalQubitsForTfactoriesPercentage,
412
+ {
413
+ value: data.physicalCountsFormatted.runtime,
414
+ sortBy: data.physicalCounts.runtime,
415
+ },
416
+ data.physicalCounts.rqops,
417
+ data.physicalCounts.physicalQubits,
418
+ data.new ? "New" : "Cached",
419
+ ];
420
+ }