@fable-org/fable-library-js 2.10.0 → 2.11.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/Long.js CHANGED
@@ -1,6 +1,7 @@
1
- import { getPrefix, isValid } from "./Int32.js";
1
+ import { getPrefix, isValid, parseOverflow } from "./Int32.js";
2
2
  import { fromString } from "./BigInt.js";
3
3
  import { Exception } from "./Util.js";
4
+ import { ArgumentNullException_$ctor_Z721C83C5, FormatException_$ctor_Z721C83C5 } from "./System.js";
4
5
  function getRange(unsigned, bitsize) {
5
6
  switch (bitsize) {
6
7
  case 64: return unsigned ?
@@ -10,6 +11,9 @@ function getRange(unsigned, bitsize) {
10
11
  }
11
12
  }
12
13
  export function parse(str, style, unsigned, bitsize, radix) {
14
+ if (str == null) {
15
+ throw ArgumentNullException_$ctor_Z721C83C5("s");
16
+ }
13
17
  const res = isValid(str, style, radix);
14
18
  if (res != null) {
15
19
  let v = fromString(getPrefix(res.radix) + res.digits);
@@ -24,8 +28,9 @@ export function parse(str, style, unsigned, bitsize, radix) {
24
28
  if (v >= min && v <= max) {
25
29
  return v;
26
30
  }
31
+ throw parseOverflow(unsigned, bitsize);
27
32
  }
28
- throw new Exception(`The input string ${str} was not in a correct format.`);
33
+ throw FormatException_$ctor_Z721C83C5(`The input string '${str}' was not in a correct format.`);
29
34
  }
30
35
  export function tryParse(str, style, unsigned, bitsize, defValue) {
31
36
  try {
package/Map.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { record_type, bool_type, list_type, option_type, class_type } from "./Reflection.js";
2
2
  import { some, value as value_1 } from "./Option.js";
3
- import { structuralHash, compare, toIterator, equals, disposeSafe, getEnumerator, isArrayLike, Exception } from "./Util.js";
3
+ import { structuralHash, compare, toIterator, equals, physicalHash, disposeSafe, getEnumerator, isArrayLike, Exception } from "./Util.js";
4
4
  import { KeyNotFoundException_$ctor } from "./System.Collections.Generic.js";
5
5
  import { singleton, ofArrayWithTail, head, tail, isEmpty as isEmpty_1, fold as fold_1, empty as empty_1, FSharpList, cons } from "./List.js";
6
6
  import { map as map_2, item, fill, setItem } from "./Array.js";
7
7
  import { Record } from "./Types.js";
8
+ import { Operators_InvalidOp } from "./FSharp.Core.js";
8
9
  import { tryPick as tryPick_1, pick as pick_1, iterate as iterate_1, compareWith, map as map_1, unfold } from "./Seq.js";
9
10
  import { format, join } from "./String.js";
10
11
  import { NotSupportedException_$ctor_Z721C83C5 } from "./System.js";
@@ -56,7 +57,7 @@ export function MapTreeModule_sizeAux(acc_mut, m_mut) {
56
57
  MapTreeModule_sizeAux: while (true) {
57
58
  const acc = acc_mut, m = m_mut;
58
59
  if (m != null) {
59
- const m2 = value_1(m);
60
+ const m2 = m;
60
61
  if (m2 instanceof MapTreeNode$2) {
61
62
  const mn = m2;
62
63
  acc_mut = MapTreeModule_sizeAux(acc + 1, MapTreeNode$2__get_Left(mn));
@@ -81,7 +82,7 @@ export function MapTreeModule_mk(l, k, v, r) {
81
82
  let hl;
82
83
  const m = l;
83
84
  if (m != null) {
84
- const m2 = value_1(m);
85
+ const m2 = m;
85
86
  hl = ((m2 instanceof MapTreeNode$2) ? ((mn = m2, MapTreeNode$2__get_Height(mn))) : 1);
86
87
  }
87
88
  else {
@@ -90,7 +91,7 @@ export function MapTreeModule_mk(l, k, v, r) {
90
91
  let hr;
91
92
  const m_1 = r;
92
93
  if (m_1 != null) {
93
- const m2_1 = value_1(m_1);
94
+ const m2_1 = m_1;
94
95
  hr = ((m2_1 instanceof MapTreeNode$2) ? ((mn_1 = m2_1, MapTreeNode$2__get_Height(mn_1))) : 1);
95
96
  }
96
97
  else {
@@ -109,7 +110,7 @@ export function MapTreeModule_rebalance(t1, k, v, t2) {
109
110
  let t1h;
110
111
  const m = t1;
111
112
  if (m != null) {
112
- const m2 = value_1(m);
113
+ const m2 = m;
113
114
  t1h = ((m2 instanceof MapTreeNode$2) ? ((mn = m2, MapTreeNode$2__get_Height(mn))) : 1);
114
115
  }
115
116
  else {
@@ -118,7 +119,7 @@ export function MapTreeModule_rebalance(t1, k, v, t2) {
118
119
  let t2h;
119
120
  const m_1 = t2;
120
121
  if (m_1 != null) {
121
- const m2_1 = value_1(m_1);
122
+ const m2_1 = m_1;
122
123
  t2h = ((m2_1 instanceof MapTreeNode$2) ? ((mn_1 = m2_1, MapTreeNode$2__get_Height(mn_1))) : 1);
123
124
  }
124
125
  else {
@@ -128,7 +129,7 @@ export function MapTreeModule_rebalance(t1, k, v, t2) {
128
129
  const matchValue = value_1(t2);
129
130
  if (matchValue instanceof MapTreeNode$2) {
130
131
  const t2$0027 = matchValue;
131
- if (((m_2 = MapTreeNode$2__get_Left(t2$0027), (m_2 != null) ? ((m2_2 = value_1(m_2), (m2_2 instanceof MapTreeNode$2) ? ((mn_2 = m2_2, MapTreeNode$2__get_Height(mn_2))) : 1)) : 0)) > (t1h + 1)) {
132
+ if (((m_2 = MapTreeNode$2__get_Left(t2$0027), (m_2 != null) ? ((m2_2 = m_2, (m2_2 instanceof MapTreeNode$2) ? ((mn_2 = m2_2, MapTreeNode$2__get_Height(mn_2))) : 1)) : 0)) > (t1h + 1)) {
132
133
  const matchValue_1 = value_1(MapTreeNode$2__get_Left(t2$0027));
133
134
  if (matchValue_1 instanceof MapTreeNode$2) {
134
135
  const t2l = matchValue_1;
@@ -150,7 +151,7 @@ export function MapTreeModule_rebalance(t1, k, v, t2) {
150
151
  const matchValue_2 = value_1(t1);
151
152
  if (matchValue_2 instanceof MapTreeNode$2) {
152
153
  const t1$0027 = matchValue_2;
153
- if (((m_3 = MapTreeNode$2__get_Right(t1$0027), (m_3 != null) ? ((m2_3 = value_1(m_3), (m2_3 instanceof MapTreeNode$2) ? ((mn_3 = m2_3, MapTreeNode$2__get_Height(mn_3))) : 1)) : 0)) > (t2h + 1)) {
154
+ if (((m_3 = MapTreeNode$2__get_Right(t1$0027), (m_3 != null) ? ((m2_3 = m_3, (m2_3 instanceof MapTreeNode$2) ? ((mn_3 = m2_3, MapTreeNode$2__get_Height(mn_3))) : 1)) : 0)) > (t2h + 1)) {
154
155
  const matchValue_3 = value_1(MapTreeNode$2__get_Right(t1$0027));
155
156
  if (matchValue_3 instanceof MapTreeNode$2) {
156
157
  const t1r = matchValue_3;
@@ -174,7 +175,7 @@ export function MapTreeModule_rebalance(t1, k, v, t2) {
174
175
  }
175
176
  export function MapTreeModule_add(comparer, k, v, m) {
176
177
  if (m != null) {
177
- const m2 = value_1(m);
178
+ const m2 = m;
178
179
  const c = comparer.Compare(k, MapTreeLeaf$2__get_Key(m2)) | 0;
179
180
  if (m2 instanceof MapTreeNode$2) {
180
181
  const mn = m2;
@@ -206,7 +207,7 @@ export function MapTreeModule_tryFind(comparer_mut, k_mut, m_mut) {
206
207
  MapTreeModule_tryFind: while (true) {
207
208
  const comparer = comparer_mut, k = k_mut, m = m_mut;
208
209
  if (m != null) {
209
- const m2 = value_1(m);
210
+ const m2 = m;
210
211
  const c = comparer.Compare(k, MapTreeLeaf$2__get_Key(m2)) | 0;
211
212
  if (c === 0) {
212
213
  return some(MapTreeLeaf$2__get_Value(m2));
@@ -250,7 +251,7 @@ export function MapTreeModule_partitionAux(comparer_mut, f_mut, m_mut, acc__mut,
250
251
  const comparer = comparer_mut, f = f_mut, m = m_mut, acc_ = acc__mut, acc__1 = acc__1_mut;
251
252
  const acc = [acc_, acc__1];
252
253
  if (m != null) {
253
- const m2 = value_1(m);
254
+ const m2 = m;
254
255
  if (m2 instanceof MapTreeNode$2) {
255
256
  const mn = m2;
256
257
  const acc_1 = MapTreeModule_partitionAux(comparer, f, MapTreeNode$2__get_Right(mn), acc[0], acc[1]);
@@ -287,7 +288,7 @@ export function MapTreeModule_filterAux(comparer_mut, f_mut, m_mut, acc_mut) {
287
288
  MapTreeModule_filterAux: while (true) {
288
289
  const comparer = comparer_mut, f = f_mut, m = m_mut, acc = acc_mut;
289
290
  if (m != null) {
290
- const m2 = value_1(m);
291
+ const m2 = m;
291
292
  if (m2 instanceof MapTreeNode$2) {
292
293
  const mn = m2;
293
294
  const acc_1 = MapTreeModule_filterAux(comparer, f, MapTreeNode$2__get_Left(mn), acc);
@@ -313,7 +314,7 @@ export function MapTreeModule_filter(comparer, f, m) {
313
314
  }
314
315
  export function MapTreeModule_spliceOutSuccessor(m) {
315
316
  if (m != null) {
316
- const m2 = value_1(m);
317
+ const m2 = m;
317
318
  if (m2 instanceof MapTreeNode$2) {
318
319
  const mn = m2;
319
320
  if (MapTreeNode$2__get_Left(mn) == null) {
@@ -334,7 +335,7 @@ export function MapTreeModule_spliceOutSuccessor(m) {
334
335
  }
335
336
  export function MapTreeModule_remove(comparer, k, m) {
336
337
  if (m != null) {
337
- const m2 = value_1(m);
338
+ const m2 = m;
338
339
  const c = comparer.Compare(k, MapTreeLeaf$2__get_Key(m2)) | 0;
339
340
  if (m2 instanceof MapTreeNode$2) {
340
341
  const mn = m2;
@@ -370,7 +371,7 @@ export function MapTreeModule_remove(comparer, k, m) {
370
371
  }
371
372
  export function MapTreeModule_change(comparer, k, u, m) {
372
373
  if (m != null) {
373
- const m2 = value_1(m);
374
+ const m2 = m;
374
375
  if (m2 instanceof MapTreeNode$2) {
375
376
  const mn = m2;
376
377
  const c = comparer.Compare(k, MapTreeLeaf$2__get_Key(mn)) | 0;
@@ -442,7 +443,7 @@ export function MapTreeModule_mem(comparer_mut, k_mut, m_mut) {
442
443
  MapTreeModule_mem: while (true) {
443
444
  const comparer = comparer_mut, k = k_mut, m = m_mut;
444
445
  if (m != null) {
445
- const m2 = value_1(m);
446
+ const m2 = m;
446
447
  const c = comparer.Compare(k, MapTreeLeaf$2__get_Key(m2)) | 0;
447
448
  if (m2 instanceof MapTreeNode$2) {
448
449
  const mn = m2;
@@ -476,7 +477,7 @@ export function MapTreeModule_iterOpt(f_mut, m_mut) {
476
477
  MapTreeModule_iterOpt: while (true) {
477
478
  const f = f_mut, m = m_mut;
478
479
  if (m != null) {
479
- const m2 = value_1(m);
480
+ const m2 = m;
480
481
  if (m2 instanceof MapTreeNode$2) {
481
482
  const mn = m2;
482
483
  MapTreeModule_iterOpt(f, MapTreeNode$2__get_Left(mn));
@@ -499,7 +500,7 @@ export function MapTreeModule_tryPickOpt(f_mut, m_mut) {
499
500
  MapTreeModule_tryPickOpt: while (true) {
500
501
  const f = f_mut, m = m_mut;
501
502
  if (m != null) {
502
- const m2 = value_1(m);
503
+ const m2 = m;
503
504
  if (m2 instanceof MapTreeNode$2) {
504
505
  const mn = m2;
505
506
  const matchValue = MapTreeModule_tryPickOpt(f, MapTreeNode$2__get_Left(mn));
@@ -535,7 +536,7 @@ export function MapTreeModule_existsOpt(f_mut, m_mut) {
535
536
  MapTreeModule_existsOpt: while (true) {
536
537
  const f = f_mut, m = m_mut;
537
538
  if (m != null) {
538
- const m2 = value_1(m);
539
+ const m2 = m;
539
540
  if (m2 instanceof MapTreeNode$2) {
540
541
  const mn = m2;
541
542
  if (MapTreeModule_existsOpt(f, MapTreeNode$2__get_Left(mn)) ? true : f(MapTreeLeaf$2__get_Key(mn), MapTreeLeaf$2__get_Value(mn))) {
@@ -564,7 +565,7 @@ export function MapTreeModule_forallOpt(f_mut, m_mut) {
564
565
  MapTreeModule_forallOpt: while (true) {
565
566
  const f = f_mut, m = m_mut;
566
567
  if (m != null) {
567
- const m2 = value_1(m);
568
+ const m2 = m;
568
569
  if (m2 instanceof MapTreeNode$2) {
569
570
  const mn = m2;
570
571
  if (MapTreeModule_forallOpt(f, MapTreeNode$2__get_Left(mn)) && f(MapTreeLeaf$2__get_Key(mn), MapTreeLeaf$2__get_Value(mn))) {
@@ -591,7 +592,7 @@ export function MapTreeModule_forall(f, m) {
591
592
  }
592
593
  export function MapTreeModule_map(f, m) {
593
594
  if (m != null) {
594
- const m2 = value_1(m);
595
+ const m2 = m;
595
596
  if (m2 instanceof MapTreeNode$2) {
596
597
  const mn = m2;
597
598
  const l2 = MapTreeModule_map(f, MapTreeNode$2__get_Left(mn));
@@ -609,7 +610,7 @@ export function MapTreeModule_map(f, m) {
609
610
  }
610
611
  export function MapTreeModule_mapiOpt(f, m) {
611
612
  if (m != null) {
612
- const m2 = value_1(m);
613
+ const m2 = m;
613
614
  if (m2 instanceof MapTreeNode$2) {
614
615
  const mn = m2;
615
616
  const l2 = MapTreeModule_mapiOpt(f, MapTreeNode$2__get_Left(mn));
@@ -632,7 +633,7 @@ export function MapTreeModule_foldBackOpt(f_mut, m_mut, x_mut) {
632
633
  MapTreeModule_foldBackOpt: while (true) {
633
634
  const f = f_mut, m = m_mut, x = x_mut;
634
635
  if (m != null) {
635
- const m2 = value_1(m);
636
+ const m2 = m;
636
637
  if (m2 instanceof MapTreeNode$2) {
637
638
  const mn = m2;
638
639
  const x_1 = MapTreeModule_foldBackOpt(f, MapTreeNode$2__get_Right(mn), x);
@@ -659,7 +660,7 @@ export function MapTreeModule_foldOpt(f_mut, x_mut, m_mut) {
659
660
  MapTreeModule_foldOpt: while (true) {
660
661
  const f = f_mut, x = x_mut, m = m_mut;
661
662
  if (m != null) {
662
- const m2 = value_1(m);
663
+ const m2 = m;
663
664
  if (m2 instanceof MapTreeNode$2) {
664
665
  const mn = m2;
665
666
  f_mut = f;
@@ -685,7 +686,7 @@ export function MapTreeModule_foldSectionOpt(comparer, lo, hi, f, m, x) {
685
686
  foldFromTo: while (true) {
686
687
  const f_1 = f_1_mut, m_1 = m_1_mut, x_1 = x_1_mut;
687
688
  if (m_1 != null) {
688
- const m2 = value_1(m_1);
689
+ const m2 = m_1;
689
690
  if (m2 instanceof MapTreeNode$2) {
690
691
  const mn = m2;
691
692
  const cLoKey = comparer.Compare(lo, MapTreeLeaf$2__get_Key(mn)) | 0;
@@ -734,7 +735,7 @@ export function MapTreeModule_toList(m) {
734
735
  loop: while (true) {
735
736
  const m_1 = m_1_mut, acc = acc_mut;
736
737
  if (m_1 != null) {
737
- const m2 = value_1(m_1);
738
+ const m2 = m_1;
738
739
  if (m2 instanceof MapTreeNode$2) {
739
740
  const mn = m2;
740
741
  m_1_mut = MapTreeNode$2__get_Left(mn);
@@ -819,6 +820,12 @@ export class MapTreeModule_MapIterator$2 extends Record {
819
820
  this.stack = stack;
820
821
  this.started = started;
821
822
  }
823
+ Equals(other) {
824
+ return this === other;
825
+ }
826
+ GetHashCode() {
827
+ return physicalHash(this);
828
+ }
822
829
  }
823
830
  export function MapTreeModule_MapIterator$2_$reflection(gen0, gen1) {
824
831
  return record_type("Map.MapTreeModule.MapIterator`2", [gen0, gen1], MapTreeModule_MapIterator$2, () => [["stack", list_type(option_type(MapTreeLeaf$2_$reflection(gen0, gen1)))], ["started", bool_type]]);
@@ -830,7 +837,7 @@ export function MapTreeModule_collapseLHS(stack_mut) {
830
837
  const rest = tail(stack);
831
838
  const m = head(stack);
832
839
  if (m != null) {
833
- const m2 = value_1(m);
840
+ const m2 = m;
834
841
  if (m2 instanceof MapTreeNode$2) {
835
842
  const mn = m2;
836
843
  stack_mut = ofArrayWithTail([MapTreeNode$2__get_Left(mn), MapTreeLeaf$2_$ctor_5BDDA1(MapTreeLeaf$2__get_Key(mn), MapTreeLeaf$2__get_Value(mn)), MapTreeNode$2__get_Right(mn)], rest);
@@ -855,17 +862,17 @@ export function MapTreeModule_mkIterator(m) {
855
862
  return new MapTreeModule_MapIterator$2(MapTreeModule_collapseLHS(singleton(m)), false);
856
863
  }
857
864
  export function MapTreeModule_notStarted() {
858
- throw new Exception("enumeration not started");
865
+ throw Operators_InvalidOp("Enumeration has not started. Call MoveNext.");
859
866
  }
860
867
  export function MapTreeModule_alreadyFinished() {
861
- throw new Exception("enumeration already finished");
868
+ throw Operators_InvalidOp("Enumeration already finished.");
862
869
  }
863
870
  export function MapTreeModule_current(i) {
864
871
  if (i.started) {
865
872
  const matchValue = i.stack;
866
873
  if (!isEmpty_1(matchValue)) {
867
874
  if (head(matchValue) != null) {
868
- const m = value_1(head(matchValue));
875
+ const m = head(matchValue);
869
876
  if (m instanceof MapTreeNode$2) {
870
877
  throw new Exception("Please report error: Map iterator, unexpected stack for current");
871
878
  }
@@ -890,7 +897,7 @@ export function MapTreeModule_moveNext(i) {
890
897
  const matchValue = i.stack;
891
898
  if (!isEmpty_1(matchValue)) {
892
899
  if (head(matchValue) != null) {
893
- const m = value_1(head(matchValue));
900
+ const m = head(matchValue);
894
901
  if (m instanceof MapTreeNode$2) {
895
902
  throw new Exception("Please report error: Map iterator, unexpected stack for moveNext");
896
903
  }
@@ -945,7 +952,7 @@ export function MapTreeModule_leftmost(m_mut) {
945
952
  MapTreeModule_leftmost: while (true) {
946
953
  const m = m_mut;
947
954
  if (m != null) {
948
- const m2 = value_1(m);
955
+ const m2 = m;
949
956
  let matchResult = undefined, nd_1 = undefined;
950
957
  if (m2 instanceof MapTreeNode$2) {
951
958
  if (MapTreeNode$2__get_Height(m2) > 1) {
@@ -982,7 +989,7 @@ export function MapTreeModule_rightmost(m_mut) {
982
989
  MapTreeModule_rightmost: while (true) {
983
990
  const m = m_mut;
984
991
  if (m != null) {
985
- const m2 = value_1(m);
992
+ const m2 = m;
986
993
  let matchResult = undefined, nd_1 = undefined;
987
994
  if (m2 instanceof MapTreeNode$2) {
988
995
  if (MapTreeNode$2__get_Height(m2) > 1) {
@@ -1098,13 +1105,13 @@ export class FSharpMap {
1098
1105
  }, this$, that))) : 1) | 0;
1099
1106
  }
1100
1107
  "System.Collections.Generic.ICollection`1.Add2B595"(x) {
1101
- throw NotSupportedException_$ctor_Z721C83C5("Map cannot be mutated");
1108
+ throw NotSupportedException_$ctor_Z721C83C5("Map values cannot be mutated.");
1102
1109
  }
1103
1110
  "System.Collections.Generic.ICollection`1.Clear"() {
1104
- throw NotSupportedException_$ctor_Z721C83C5("Map cannot be mutated");
1111
+ throw NotSupportedException_$ctor_Z721C83C5("Map values cannot be mutated.");
1105
1112
  }
1106
1113
  "System.Collections.Generic.ICollection`1.Remove2B595"(x) {
1107
- throw NotSupportedException_$ctor_Z721C83C5("Map cannot be mutated");
1114
+ throw NotSupportedException_$ctor_Z721C83C5("Map values cannot be mutated.");
1108
1115
  }
1109
1116
  "System.Collections.Generic.ICollection`1.Contains2B595"(x) {
1110
1117
  const m = this;
@@ -1130,10 +1137,10 @@ export class FSharpMap {
1130
1137
  return FSharpMap__get_Count(m) | 0;
1131
1138
  }
1132
1139
  clear() {
1133
- throw new Exception("Map cannot be mutated");
1140
+ throw NotSupportedException_$ctor_Z721C83C5("Map values cannot be mutated.");
1134
1141
  }
1135
1142
  delete(_arg) {
1136
- throw new Exception("Map cannot be mutated");
1143
+ throw NotSupportedException_$ctor_Z721C83C5("Map values cannot be mutated.");
1137
1144
  return false;
1138
1145
  }
1139
1146
  entries() {
@@ -1154,7 +1161,7 @@ export class FSharpMap {
1154
1161
  }
1155
1162
  set(k, v) {
1156
1163
  const m = this;
1157
- throw new Exception("Map cannot be mutated");
1164
+ throw NotSupportedException_$ctor_Z721C83C5("Map values cannot be mutated.");
1158
1165
  return m;
1159
1166
  }
1160
1167
  values() {
package/MutableMap.js CHANGED
@@ -1,10 +1,9 @@
1
1
  import { disposeSafe, defaultOf, equals, toIterator, getEnumerator } from "./Util.js";
2
2
  import { iterate, map, delay, toArray, iterateIndexed, concat } from "./Seq.js";
3
- import { value as value_1 } from "./Option.js";
4
3
  import { item as item_1, setItem } from "./Array.js";
5
4
  import { FSharpRef } from "./Types.js";
6
5
  import { class_type } from "./Reflection.js";
7
- import { getItemFromDict, tryGetValue } from "./MapUtil.js";
6
+ import { getItemFromDict } from "./MapUtil.js";
8
7
  import { KeyNotFoundException_$ctor_Z721C83C5 } from "./System.Collections.Generic.js";
9
8
  import { ArgumentException_$ctor_Z721C83C5 } from "./System.js";
10
9
  import { format } from "./String.js";
@@ -14,6 +13,7 @@ export class Dictionary {
14
13
  this.comparer = comparer;
15
14
  this$.contents = this;
16
15
  this.hashMap = (new Map([]));
16
+ this.count = 0;
17
17
  this["init@9"] = 1;
18
18
  const enumerator = getEnumerator(pairs);
19
19
  try {
@@ -57,9 +57,9 @@ export class Dictionary {
57
57
  const matchValue = Dictionary__TryFind_2B595(this$, item[0]);
58
58
  let matchResult = undefined, pair_1 = undefined;
59
59
  if (matchValue != null) {
60
- if (equals(value_1(matchValue)[1], item[1])) {
60
+ if (equals(matchValue[1], item[1])) {
61
61
  matchResult = 0;
62
- pair_1 = value_1(matchValue);
62
+ pair_1 = matchValue;
63
63
  }
64
64
  else {
65
65
  matchResult = 1;
@@ -93,9 +93,9 @@ export class Dictionary {
93
93
  const matchValue = Dictionary__TryFind_2B595(this$, item[0]);
94
94
  let matchResult = undefined, pair_1 = undefined;
95
95
  if (matchValue != null) {
96
- if (equals(value_1(matchValue)[1], item[1])) {
96
+ if (equals(matchValue[1], item[1])) {
97
97
  matchResult = 0;
98
- pair_1 = value_1(matchValue);
98
+ pair_1 = matchValue;
99
99
  }
100
100
  else {
101
101
  matchResult = 1;
@@ -139,7 +139,7 @@ export class Dictionary {
139
139
  const this$ = this;
140
140
  const matchValue = Dictionary__TryFind_2B595(this$, key);
141
141
  if (matchValue != null) {
142
- const pair = value_1(matchValue);
142
+ const pair = matchValue;
143
143
  value.contents = pair[1];
144
144
  return true;
145
145
  }
@@ -201,39 +201,39 @@ export function Dictionary_$reflection(gen0, gen1) {
201
201
  export function Dictionary_$ctor_6623D9B3(pairs, comparer) {
202
202
  return new Dictionary(pairs, comparer);
203
203
  }
204
- function Dictionary__TryFindIndex_2B595(this$, k) {
205
- const h = this$.comparer.GetHashCode(k) | 0;
206
- let matchValue;
207
- let outArg = defaultOf();
208
- matchValue = [tryGetValue(this$.hashMap, h, new FSharpRef(() => outArg, (v) => {
209
- outArg = v;
210
- })), outArg];
211
- if (matchValue[0]) {
212
- return [true, h, matchValue[1].findIndex((pair) => this$.comparer.Equals(k, pair[0]))];
204
+ function Dictionary__TryFindBucket_Z524259A4(this$, h) {
205
+ if (this$.hashMap.has(h)) {
206
+ return getItemFromDict(this$.hashMap, h);
213
207
  }
214
208
  else {
215
- return [false, h, -1];
209
+ return undefined;
216
210
  }
217
211
  }
218
- export function Dictionary__TryFind_2B595(this$, k) {
219
- const matchValue = Dictionary__TryFindIndex_2B595(this$, k);
220
- let matchResult = undefined;
221
- if (matchValue[0]) {
222
- if (matchValue[2] > -1) {
223
- matchResult = 0;
224
- }
225
- else {
226
- matchResult = 1;
212
+ function Dictionary__FindIndex_Z61A8C007(this$, k, bucket) {
213
+ let i = 0;
214
+ let found = -1;
215
+ while ((found < 0) && (i < bucket.length)) {
216
+ if (this$.comparer.Equals(k, item_1(i, bucket)[0])) {
217
+ found = (i | 0);
227
218
  }
219
+ i = ((i + 1) | 0);
228
220
  }
229
- else {
230
- matchResult = 1;
221
+ return found | 0;
222
+ }
223
+ export function Dictionary__TryFind_2B595(this$, k) {
224
+ const matchValue = Dictionary__TryFindBucket_Z524259A4(this$, this$.comparer.GetHashCode(k));
225
+ if (matchValue == null) {
226
+ return undefined;
231
227
  }
232
- switch (matchResult) {
233
- case 0:
234
- return item_1(matchValue[2], getItemFromDict(this$.hashMap, matchValue[1]));
235
- default:
228
+ else {
229
+ const bucket = matchValue;
230
+ const i = Dictionary__FindIndex_Z61A8C007(this$, k, bucket) | 0;
231
+ if (i > -1) {
232
+ return item_1(i, bucket);
233
+ }
234
+ else {
236
235
  return undefined;
236
+ }
237
237
  }
238
238
  }
239
239
  export function Dictionary__get_Comparer(this$) {
@@ -241,103 +241,83 @@ export function Dictionary__get_Comparer(this$) {
241
241
  }
242
242
  export function Dictionary__Clear(this$) {
243
243
  this$.hashMap.clear();
244
+ this$.count = 0;
244
245
  }
245
246
  export function Dictionary__get_Count(this$) {
246
- let count = 0;
247
- let enumerator = getEnumerator(this$.hashMap.values());
248
- try {
249
- while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
250
- const pairs = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
251
- count = ((count + pairs.length) | 0);
252
- }
253
- }
254
- finally {
255
- disposeSafe(enumerator);
256
- }
257
- return count | 0;
247
+ return this$.count | 0;
258
248
  }
259
249
  export function Dictionary__get_Item_2B595(this$, k) {
260
250
  const matchValue = Dictionary__TryFind_2B595(this$, k);
261
251
  if (matchValue != null) {
262
- return value_1(matchValue)[1];
252
+ return matchValue[1];
263
253
  }
264
254
  else {
265
255
  throw KeyNotFoundException_$ctor_Z721C83C5("The item was not found in collection");
266
256
  }
267
257
  }
268
258
  export function Dictionary__set_Item_5BDDA1(this$, k, v) {
269
- const matchValue = Dictionary__TryFindIndex_2B595(this$, k);
270
- if (matchValue[0]) {
271
- if (matchValue[2] > -1) {
272
- setItem(getItemFromDict(this$.hashMap, matchValue[1]), matchValue[2], [k, v]);
259
+ const h = this$.comparer.GetHashCode(k) | 0;
260
+ const matchValue = Dictionary__TryFindBucket_Z524259A4(this$, h);
261
+ if (matchValue == null) {
262
+ this$.hashMap.set(h, [[k, v]]);
263
+ this$.count = ((this$.count + 1) | 0);
264
+ }
265
+ else {
266
+ const bucket = matchValue;
267
+ const i = Dictionary__FindIndex_Z61A8C007(this$, k, bucket) | 0;
268
+ if (i > -1) {
269
+ setItem(bucket, i, [k, v]);
273
270
  }
274
271
  else {
275
- void (getItemFromDict(this$.hashMap, matchValue[1]).push([k, v]));
272
+ void (bucket.push([k, v]));
273
+ this$.count = ((this$.count + 1) | 0);
276
274
  }
277
275
  }
278
- else {
279
- this$.hashMap.set(matchValue[1], [[k, v]]);
280
- }
281
276
  }
282
277
  export function Dictionary__Add_5BDDA1(this$, k, v) {
283
- const matchValue = Dictionary__TryFindIndex_2B595(this$, k);
284
- if (matchValue[0]) {
285
- if (matchValue[2] > -1) {
286
- throw ArgumentException_$ctor_Z721C83C5(format("An item with the same key has already been added. Key: {0}", k));
287
- }
288
- else {
289
- void (getItemFromDict(this$.hashMap, matchValue[1]).push([k, v]));
290
- }
278
+ const h = this$.comparer.GetHashCode(k) | 0;
279
+ const matchValue = Dictionary__TryFindBucket_Z524259A4(this$, h);
280
+ if (matchValue == null) {
281
+ this$.hashMap.set(h, [[k, v]]);
282
+ this$.count = ((this$.count + 1) | 0);
291
283
  }
292
284
  else {
293
- this$.hashMap.set(matchValue[1], [[k, v]]);
285
+ const bucket = matchValue;
286
+ if (Dictionary__FindIndex_Z61A8C007(this$, k, bucket) > -1) {
287
+ throw ArgumentException_$ctor_Z721C83C5(format("An item with the same key has already been added. Key: {0}", k));
288
+ }
289
+ void (bucket.push([k, v]));
290
+ this$.count = ((this$.count + 1) | 0);
294
291
  }
295
292
  }
296
293
  export function Dictionary__ContainsKey_2B595(this$, k) {
297
- const matchValue = Dictionary__TryFindIndex_2B595(this$, k);
298
- let matchResult = undefined;
299
- if (matchValue[0]) {
300
- if (matchValue[2] > -1) {
301
- matchResult = 0;
302
- }
303
- else {
304
- matchResult = 1;
305
- }
294
+ const matchValue = Dictionary__TryFindBucket_Z524259A4(this$, this$.comparer.GetHashCode(k));
295
+ if (matchValue == null) {
296
+ return false;
306
297
  }
307
298
  else {
308
- matchResult = 1;
309
- }
310
- switch (matchResult) {
311
- case 0:
312
- return true;
313
- default:
314
- return false;
299
+ return Dictionary__FindIndex_Z61A8C007(this$, k, matchValue) > -1;
315
300
  }
316
301
  }
317
302
  export function Dictionary__Remove_2B595(this$, k) {
318
- const matchValue = Dictionary__TryFindIndex_2B595(this$, k);
319
- let matchResult = undefined;
320
- if (matchValue[0]) {
321
- if (matchValue[2] > -1) {
322
- matchResult = 0;
323
- }
324
- else {
325
- matchResult = 1;
326
- }
303
+ const h = this$.comparer.GetHashCode(k) | 0;
304
+ const matchValue = Dictionary__TryFindBucket_Z524259A4(this$, h);
305
+ if (matchValue == null) {
306
+ return false;
327
307
  }
328
308
  else {
329
- matchResult = 1;
330
- }
331
- switch (matchResult) {
332
- case 0: {
333
- const h_1 = matchValue[1] | 0;
334
- getItemFromDict(this$.hashMap, h_1).splice(matchValue[2], 1);
335
- if (getItemFromDict(this$.hashMap, h_1).length === 0) {
336
- this$.hashMap.delete(h_1);
309
+ const bucket = matchValue;
310
+ const i = Dictionary__FindIndex_Z61A8C007(this$, k, bucket) | 0;
311
+ if (i > -1) {
312
+ bucket.splice(i, 1);
313
+ this$.count = ((this$.count - 1) | 0);
314
+ if (bucket.length === 0) {
315
+ this$.hashMap.delete(h);
337
316
  }
338
317
  return true;
339
318
  }
340
- default:
319
+ else {
341
320
  return false;
321
+ }
342
322
  }
343
323
  }