firefly-compiler 0.4.17 → 0.4.19

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 (115) hide show
  1. package/compiler/Builder.ff +1 -1
  2. package/compiler/Compiler.ff +6 -5
  3. package/compiler/Inference.ff +31 -19
  4. package/compiler/JsEmitter.ff +98 -71
  5. package/compiler/JsImporter.ff +1 -1
  6. package/compiler/LspHook.ff +4 -4
  7. package/compiler/Main.ff +6 -6
  8. package/compiler/Parser.ff +39 -39
  9. package/compiler/Patterns.ff +2 -0
  10. package/compiler/Syntax.ff +1 -1
  11. package/compiler/Tokenizer.ff +2 -2
  12. package/compiler/Workspace.ff +2 -2
  13. package/core/Array.ff +135 -294
  14. package/core/Buffer.ff +3 -3
  15. package/core/BuildSystem.ff +1 -1
  16. package/core/Equal.ff +36 -52
  17. package/core/HttpClient.ff +1 -1
  18. package/core/IntMap.ff +14 -18
  19. package/core/JsSystem.ff +1 -1
  20. package/core/JsValue.ff +6 -12
  21. package/core/Json.ff +19 -28
  22. package/core/List.ff +281 -312
  23. package/core/Map.ff +4 -8
  24. package/core/NodeSystem.ff +2 -2
  25. package/core/Option.ff +0 -4
  26. package/core/Ordering.ff +10 -6
  27. package/core/Pair.ff +0 -4
  28. package/core/Random.ff +12 -26
  29. package/core/RbMap.ff +216 -216
  30. package/core/Serializable.ff +9 -18
  31. package/core/Set.ff +0 -1
  32. package/core/SourceLocation.ff +1 -1
  33. package/core/Stack.ff +32 -45
  34. package/core/Stream.ff +10 -14
  35. package/core/String.ff +24 -6
  36. package/core/StringMap.ff +15 -19
  37. package/guide/Main.ff +20 -2
  38. package/lsp/CompletionHandler.ff +4 -4
  39. package/lsp/Handler.ff +45 -34
  40. package/lsp/HoverHandler.ff +2 -2
  41. package/lsp/LanguageServer.ff +2 -2
  42. package/lsp/SignatureHelpHandler.ff +1 -1
  43. package/lsp/SymbolHandler.ff +1 -1
  44. package/lux/Lux.ff +3 -3
  45. package/output/js/ff/compiler/Builder.mjs +19 -21
  46. package/output/js/ff/compiler/Compiler.mjs +18 -20
  47. package/output/js/ff/compiler/Dependencies.mjs +8 -10
  48. package/output/js/ff/compiler/Deriver.mjs +234 -236
  49. package/output/js/ff/compiler/Dictionaries.mjs +6 -8
  50. package/output/js/ff/compiler/Environment.mjs +42 -44
  51. package/output/js/ff/compiler/Inference.mjs +346 -304
  52. package/output/js/ff/compiler/JsEmitter.mjs +907 -833
  53. package/output/js/ff/compiler/JsImporter.mjs +0 -2
  54. package/output/js/ff/compiler/LspHook.mjs +10 -12
  55. package/output/js/ff/compiler/Main.mjs +109 -111
  56. package/output/js/ff/compiler/Parser.mjs +405 -407
  57. package/output/js/ff/compiler/Patterns.mjs +64 -50
  58. package/output/js/ff/compiler/Resolver.mjs +36 -38
  59. package/output/js/ff/compiler/Substitution.mjs +4 -6
  60. package/output/js/ff/compiler/Syntax.mjs +160 -162
  61. package/output/js/ff/compiler/Token.mjs +52 -54
  62. package/output/js/ff/compiler/Tokenizer.mjs +16 -18
  63. package/output/js/ff/compiler/Unification.mjs +24 -26
  64. package/output/js/ff/compiler/Wildcards.mjs +0 -2
  65. package/output/js/ff/compiler/Workspace.mjs +18 -20
  66. package/output/js/ff/core/Any.mjs +0 -2
  67. package/output/js/ff/core/Array.mjs +216 -613
  68. package/output/js/ff/core/AssetSystem.mjs +2 -4
  69. package/output/js/ff/core/Atomic.mjs +0 -2
  70. package/output/js/ff/core/Bool.mjs +0 -2
  71. package/output/js/ff/core/Box.mjs +0 -2
  72. package/output/js/ff/core/BrowserSystem.mjs +0 -2
  73. package/output/js/ff/core/Buffer.mjs +0 -2
  74. package/output/js/ff/core/BuildSystem.mjs +12 -14
  75. package/output/js/ff/core/Channel.mjs +0 -2
  76. package/output/js/ff/core/Char.mjs +0 -2
  77. package/output/js/ff/core/Core.mjs +0 -2
  78. package/output/js/ff/core/Duration.mjs +0 -2
  79. package/output/js/ff/core/Equal.mjs +0 -22
  80. package/output/js/ff/core/Error.mjs +0 -2
  81. package/output/js/ff/core/FileHandle.mjs +0 -2
  82. package/output/js/ff/core/Float.mjs +0 -2
  83. package/output/js/ff/core/HttpClient.mjs +2 -4
  84. package/output/js/ff/core/Instant.mjs +0 -2
  85. package/output/js/ff/core/Int.mjs +8 -10
  86. package/output/js/ff/core/IntMap.mjs +32 -42
  87. package/output/js/ff/core/JsSystem.mjs +1 -3
  88. package/output/js/ff/core/JsValue.mjs +5 -12
  89. package/output/js/ff/core/Json.mjs +23 -56
  90. package/output/js/ff/core/List.mjs +648 -1989
  91. package/output/js/ff/core/Lock.mjs +0 -2
  92. package/output/js/ff/core/Log.mjs +0 -2
  93. package/output/js/ff/core/Map.mjs +10 -20
  94. package/output/js/ff/core/NodeSystem.mjs +6 -8
  95. package/output/js/ff/core/Nothing.mjs +0 -2
  96. package/output/js/ff/core/Option.mjs +8 -18
  97. package/output/js/ff/core/Ordering.mjs +20 -98
  98. package/output/js/ff/core/Pair.mjs +6 -16
  99. package/output/js/ff/core/Path.mjs +12 -14
  100. package/output/js/ff/core/Random.mjs +24 -54
  101. package/output/js/ff/core/RbMap.mjs +54 -56
  102. package/output/js/ff/core/Serializable.mjs +19 -36
  103. package/output/js/ff/core/Set.mjs +0 -14
  104. package/output/js/ff/core/Show.mjs +0 -2
  105. package/output/js/ff/core/SourceLocation.mjs +0 -2
  106. package/output/js/ff/core/Stream.mjs +34 -44
  107. package/output/js/ff/core/String.mjs +31 -5
  108. package/output/js/ff/core/StringMap.mjs +32 -42
  109. package/output/js/ff/core/Task.mjs +0 -2
  110. package/output/js/ff/core/Try.mjs +0 -2
  111. package/output/js/ff/core/Unit.mjs +0 -2
  112. package/package.json +1 -1
  113. package/vscode/package.json +1 -1
  114. package/webserver/WebServer.ff +8 -8
  115. package/output/js/ff/core/Stack.mjs +0 -603
@@ -78,8 +78,6 @@ import * as ff_core_Show from "../../ff/core/Show.mjs"
78
78
 
79
79
  import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
80
80
 
81
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
82
-
83
81
  import * as ff_core_Stream from "../../ff/core/Stream.mjs"
84
82
 
85
83
  import * as ff_core_String from "../../ff/core/String.mjs"
@@ -447,7 +445,7 @@ return
447
445
  {
448
446
  if(_1.Some) {
449
447
  const x_ = _1.value_;
450
- let list_ = ff_core_List.Link(x_, ff_core_List.Empty());
448
+ let list_ = [x_];
451
449
  remaining_ -= 1;
452
450
  while((remaining_ > 0)) {
453
451
  remaining_ -= 1;
@@ -462,7 +460,7 @@ break
462
460
  {
463
461
  if(_1.Some) {
464
462
  const x_ = _1.value_;
465
- list_ = ff_core_List.Link(x_, list_)
463
+ list_ = [x_, ...list_]
466
464
  break
467
465
  }
468
466
  }
@@ -663,20 +661,16 @@ result_ = body_(result_, _w1)
663
661
  return result_
664
662
  }
665
663
 
666
- export function Stream_toStack(self_) {
667
- const stack_ = ff_core_Stack.make_();
664
+ export function Stream_toArray(self_) {
665
+ const array_ = ff_core_Array.make_();
668
666
  ff_core_Stream.Stream_each(self_, ((_w1) => {
669
- ff_core_Stack.Stack_push(stack_, _w1)
667
+ ff_core_Array.Array_push(array_, _w1)
670
668
  }));
671
- return stack_
672
- }
673
-
674
- export function Stream_toArray(self_) {
675
- return ff_core_Stack.Stack_drain(ff_core_Stream.Stream_toStack(self_))
669
+ return array_
676
670
  }
677
671
 
678
672
  export function Stream_toList(self_) {
679
- return ff_core_Stack.Stack_toList(ff_core_Stream.Stream_toStack(self_), 0, 9007199254740991)
673
+ return ff_core_Array.Array_drain(ff_core_Stream.Stream_toArray(self_))
680
674
  }
681
675
 
682
676
  export async function Stream_addAll$(self_, that_, $task) {
@@ -973,7 +967,7 @@ return
973
967
  {
974
968
  if(_1.Some) {
975
969
  const x_ = _1.value_;
976
- let list_ = ff_core_List.Link(x_, ff_core_List.Empty());
970
+ let list_ = [x_];
977
971
  remaining_ -= 1;
978
972
  while((remaining_ > 0)) {
979
973
  remaining_ -= 1;
@@ -988,7 +982,7 @@ break
988
982
  {
989
983
  if(_1.Some) {
990
984
  const x_ = _1.value_;
991
- list_ = ff_core_List.Link(x_, list_)
985
+ list_ = [x_, ...list_]
992
986
  break
993
987
  }
994
988
  }
@@ -1189,20 +1183,16 @@ result_ = (await body_(result_, _w1, $task))
1189
1183
  return result_
1190
1184
  }
1191
1185
 
1192
- export async function Stream_toStack$(self_, $task) {
1193
- const stack_ = ff_core_Stack.make_();
1186
+ export async function Stream_toArray$(self_, $task) {
1187
+ const array_ = ff_core_Array.make_();
1194
1188
  (await ff_core_Stream.Stream_each$(self_, (async (_w1, $task) => {
1195
- ff_core_Stack.Stack_push(stack_, _w1)
1189
+ ff_core_Array.Array_push(array_, _w1)
1196
1190
  }), $task));
1197
- return stack_
1198
- }
1199
-
1200
- export async function Stream_toArray$(self_, $task) {
1201
- return ff_core_Stack.Stack_drain((await ff_core_Stream.Stream_toStack$(self_, $task)))
1191
+ return array_
1202
1192
  }
1203
1193
 
1204
1194
  export async function Stream_toList$(self_, $task) {
1205
- return ff_core_Stack.Stack_toList((await ff_core_Stream.Stream_toStack$(self_, $task)), 0, 9007199254740991)
1195
+ return ff_core_Array.Array_drain((await ff_core_Stream.Stream_toArray$(self_, $task)))
1206
1196
  }
1207
1197
 
1208
1198
  export function Stream_flatten(self_) {
@@ -1218,27 +1208,27 @@ return _w1
1218
1208
  }
1219
1209
 
1220
1210
  export function Stream_toSet(self_, ff_core_Ordering_Order$T) {
1221
- return ff_core_Array.Array_toSet(ff_core_Stream.Stream_toArray(self_), ff_core_Ordering_Order$T)
1211
+ return ff_core_List.List_toSet(ff_core_Stream.Stream_toList(self_), ff_core_Ordering_Order$T)
1222
1212
  }
1223
1213
 
1224
1214
  export async function Stream_toSet$(self_, ff_core_Ordering_Order$T, $task) {
1225
- return ff_core_Array.Array_toSet((await ff_core_Stream.Stream_toArray$(self_, $task)), ff_core_Ordering_Order$T)
1215
+ return ff_core_List.List_toSet((await ff_core_Stream.Stream_toList$(self_, $task)), ff_core_Ordering_Order$T)
1226
1216
  }
1227
1217
 
1228
1218
  export function Stream_toMap(self_, ff_core_Ordering_Order$K) {
1229
- return ff_core_Array.Array_toMap(ff_core_Stream.Stream_toArray(self_), ff_core_Ordering_Order$K)
1219
+ return ff_core_List.List_toMap(ff_core_Stream.Stream_toList(self_), ff_core_Ordering_Order$K)
1230
1220
  }
1231
1221
 
1232
1222
  export async function Stream_toMap$(self_, ff_core_Ordering_Order$K, $task) {
1233
- return ff_core_Array.Array_toMap((await ff_core_Stream.Stream_toArray$(self_, $task)), ff_core_Ordering_Order$K)
1223
+ return ff_core_List.List_toMap((await ff_core_Stream.Stream_toList$(self_, $task)), ff_core_Ordering_Order$K)
1234
1224
  }
1235
1225
 
1236
1226
  export function Stream_toBuffer(self_) {
1237
- const builder_ = ff_core_Stack.make_();
1227
+ const builder_ = ff_core_Array.make_();
1238
1228
  ff_core_Stream.Stream_each(self_, ((_w1) => {
1239
- ff_core_Stack.Stack_push(builder_, _w1)
1229
+ ff_core_Array.Array_push(builder_, _w1)
1240
1230
  }));
1241
- return ff_core_Buffer.fromBufferArray_(ff_core_Stack.Stack_drain(builder_))
1231
+ return ff_core_Buffer.fromBufferArray_(ff_core_Array.Array_drain(builder_))
1242
1232
  }
1243
1233
 
1244
1234
  export function Stream_toString(self_, encoding_ = "utf8") {
@@ -1247,33 +1237,33 @@ return ff_core_Buffer.Buffer_toString(ff_core_Stream.Stream_toBuffer(self_), enc
1247
1237
 
1248
1238
  export function Stream_readBytes(self_, bytes_) {
1249
1239
  if((bytes_ <= 0)) {
1250
- return ff_core_Pair.Pair(ff_core_List.List_toArray(ff_core_List.Empty()), self_)
1240
+ return ff_core_Pair.Pair([], self_)
1251
1241
  } else {
1252
- const buffers_ = ff_core_Stack.make_();
1242
+ const buffers_ = ff_core_Array.make_();
1253
1243
  let buffer_ = ff_core_Option.Option_grab(self_.next_());
1254
1244
  let taken_ = 0;
1255
1245
  let remainder_ = ff_core_Option.None();
1256
1246
  while(ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Buffer.ff_core_Equal_Equal$ff_core_Buffer_Buffer).equals_(remainder_, ff_core_Option.None())) {
1257
1247
  const needed_ = (bytes_ - taken_);
1258
1248
  if((needed_ > ff_core_Buffer.Buffer_size(buffer_))) {
1259
- ff_core_Stack.Stack_push(buffers_, buffer_);
1249
+ ff_core_Array.Array_push(buffers_, buffer_);
1260
1250
  taken_ += ff_core_Buffer.Buffer_size(buffer_);
1261
1251
  buffer_ = ff_core_Option.Option_grab(self_.next_())
1262
1252
  } else {
1263
- ff_core_Stack.Stack_push(buffers_, ff_core_Buffer.Buffer_view(buffer_, 0, needed_));
1253
+ ff_core_Array.Array_push(buffers_, ff_core_Buffer.Buffer_view(buffer_, 0, needed_));
1264
1254
  remainder_ = ff_core_Option.Some(ff_core_Buffer.Buffer_view(buffer_, needed_, ff_core_Buffer.Buffer_size(buffer_)))
1265
1255
  }
1266
1256
  };
1267
- return ff_core_Pair.Pair(ff_core_Stack.Stack_drain(buffers_), ff_core_Stream.Stream_addAll(ff_core_Option.Option_toStream(remainder_, false), self_))
1257
+ return ff_core_Pair.Pair(ff_core_Array.Array_drain(buffers_), ff_core_Stream.Stream_addAll(ff_core_Option.Option_toStream(remainder_, false), self_))
1268
1258
  }
1269
1259
  }
1270
1260
 
1271
1261
  export async function Stream_toBuffer$(self_, $task) {
1272
- const builder_ = ff_core_Stack.make_();
1262
+ const builder_ = ff_core_Array.make_();
1273
1263
  (await ff_core_Stream.Stream_each$(self_, (async (_w1, $task) => {
1274
- ff_core_Stack.Stack_push(builder_, _w1)
1264
+ ff_core_Array.Array_push(builder_, _w1)
1275
1265
  }), $task));
1276
- return ff_core_Buffer.fromBufferArray_(ff_core_Stack.Stack_drain(builder_))
1266
+ return ff_core_Buffer.fromBufferArray_(ff_core_Array.Array_drain(builder_))
1277
1267
  }
1278
1268
 
1279
1269
  export async function Stream_toString$(self_, encoding_ = "utf8", $task) {
@@ -1282,24 +1272,24 @@ return ff_core_Buffer.Buffer_toString((await ff_core_Stream.Stream_toBuffer$(sel
1282
1272
 
1283
1273
  export async function Stream_readBytes$(self_, bytes_, $task) {
1284
1274
  if((bytes_ <= 0)) {
1285
- return ff_core_Pair.Pair(ff_core_List.List_toArray(ff_core_List.Empty()), self_)
1275
+ return ff_core_Pair.Pair([], self_)
1286
1276
  } else {
1287
- const buffers_ = ff_core_Stack.make_();
1277
+ const buffers_ = ff_core_Array.make_();
1288
1278
  let buffer_ = ff_core_Option.Option_grab((await self_.next_($task)));
1289
1279
  let taken_ = 0;
1290
1280
  let remainder_ = ff_core_Option.None();
1291
1281
  while(ff_core_Option.ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Buffer.ff_core_Equal_Equal$ff_core_Buffer_Buffer).equals_(remainder_, ff_core_Option.None())) {
1292
1282
  const needed_ = (bytes_ - taken_);
1293
1283
  if((needed_ > ff_core_Buffer.Buffer_size(buffer_))) {
1294
- ff_core_Stack.Stack_push(buffers_, buffer_);
1284
+ ff_core_Array.Array_push(buffers_, buffer_);
1295
1285
  taken_ += ff_core_Buffer.Buffer_size(buffer_);
1296
1286
  buffer_ = ff_core_Option.Option_grab((await self_.next_($task)))
1297
1287
  } else {
1298
- ff_core_Stack.Stack_push(buffers_, ff_core_Buffer.Buffer_view(buffer_, 0, needed_));
1288
+ ff_core_Array.Array_push(buffers_, ff_core_Buffer.Buffer_view(buffer_, 0, needed_));
1299
1289
  remainder_ = ff_core_Option.Some(ff_core_Buffer.Buffer_view(buffer_, needed_, ff_core_Buffer.Buffer_size(buffer_)))
1300
1290
  }
1301
1291
  };
1302
- return ff_core_Pair.Pair(ff_core_Stack.Stack_drain(buffers_), (await ff_core_Stream.Stream_addAll$((await ff_core_Option.Option_toStream$(remainder_, false, $task)), self_, $task)))
1292
+ return ff_core_Pair.Pair(ff_core_Array.Array_drain(buffers_), (await ff_core_Stream.Stream_addAll$((await ff_core_Option.Option_toStream$(remainder_, false, $task)), self_, $task)))
1303
1293
  }
1304
1294
  }
1305
1295
 
@@ -78,8 +78,6 @@ import * as ff_core_Show from "../../ff/core/Show.mjs"
78
78
 
79
79
  import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
80
80
 
81
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
82
-
83
81
  import * as ff_core_Stream from "../../ff/core/Stream.mjs"
84
82
 
85
83
  import * as ff_core_String from "../../ff/core/String.mjs"
@@ -185,9 +183,9 @@ export function String_splitFirst(self_, char_) {
185
183
 
186
184
  export function String_lines(self_) {
187
185
 
188
- return ff_core_Array.Array_toList(self_.split(
186
+ return self_.split(
189
187
  new RegExp("[" + String.fromCharCode(13) + "]?[" + String.fromCharCode(10) + "]", "g")
190
- ))
188
+ )
191
189
 
192
190
  }
193
191
 
@@ -206,12 +204,22 @@ export function String_getInt(self_) {
206
204
  }
207
205
  for(let i = 0; i < self_.length; i++) {
208
206
  const c = self_.codePointAt(i)
209
- if(c < 48 || c > 57) ff_core_Option.None()
207
+ if(c < 48 || c > 57) return ff_core_Option.None()
210
208
  }
211
209
  return ff_core_Option.Some(parseInt(self_, 10));
212
210
 
213
211
  }
214
212
 
213
+ export function String_getFloat(self_) {
214
+
215
+ const result = parseFloat(self_, 10);
216
+ if(!isFinite(result)) {
217
+ return ff_core_Option.None()
218
+ }
219
+ return ff_core_Option.Some(result);
220
+
221
+ }
222
+
215
223
  export function String_grabInt(self_) {
216
224
 
217
225
  if(self_.length == 0) {
@@ -225,6 +233,16 @@ export function String_grabInt(self_) {
225
233
 
226
234
  }
227
235
 
236
+ export function String_grabFloat(self_) {
237
+
238
+ const result = parseFloat(self_, 10);
239
+ if(!isFinite(result)) {
240
+ ff_core_Try.internalThrowGrabException_()
241
+ }
242
+ return result;
243
+
244
+ }
245
+
228
246
  export function String_first(self_) {
229
247
 
230
248
  return self_.length > 0
@@ -406,10 +424,18 @@ export async function String_getInt$(self_, $task) {
406
424
  throw new Error('Function String_getInt is missing on this target in async context.');
407
425
  }
408
426
 
427
+ export async function String_getFloat$(self_, $task) {
428
+ throw new Error('Function String_getFloat is missing on this target in async context.');
429
+ }
430
+
409
431
  export async function String_grabInt$(self_, $task) {
410
432
  throw new Error('Function String_grabInt is missing on this target in async context.');
411
433
  }
412
434
 
435
+ export async function String_grabFloat$(self_, $task) {
436
+ throw new Error('Function String_grabFloat is missing on this target in async context.');
437
+ }
438
+
413
439
  export async function String_first$(self_, $task) {
414
440
  throw new Error('Function String_first is missing on this target in async context.');
415
441
  }
@@ -78,8 +78,6 @@ import * as ff_core_Show from "../../ff/core/Show.mjs"
78
78
 
79
79
  import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
80
80
 
81
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
82
-
83
81
  import * as ff_core_Stream from "../../ff/core/Stream.mjs"
84
82
 
85
83
  import * as ff_core_String from "../../ff/core/String.mjs"
@@ -147,44 +145,40 @@ export function StringMap_eachWhile(self_, body_) {
147
145
  for(const [k, v] of self_) if(!body_(k, v)) break
148
146
  }
149
147
 
150
- export function StringMap_toStack(self_) {
151
- const stack_ = ff_core_Stack.make_();
148
+ export function StringMap_toArray(self_) {
149
+ const array_ = ff_core_Array.make_();
152
150
  ff_core_StringMap.StringMap_each(self_, ((k_, v_) => {
153
- ff_core_Stack.Stack_push(stack_, ff_core_Pair.Pair(k_, v_))
151
+ ff_core_Array.Array_push(array_, ff_core_Pair.Pair(k_, v_))
154
152
  }));
155
- return stack_
156
- }
157
-
158
- export function StringMap_toArray(self_) {
159
- return ff_core_Stack.Stack_drain(ff_core_StringMap.StringMap_toStack(self_))
153
+ return array_
160
154
  }
161
155
 
162
156
  export function StringMap_toList(self_) {
163
- return ff_core_Array.Array_toList(ff_core_StringMap.StringMap_toArray(self_))
157
+ return ff_core_Array.Array_drain(ff_core_StringMap.StringMap_toArray(self_))
164
158
  }
165
159
 
166
160
  export function StringMap_toStream(self_) {
167
- return ff_core_Array.Array_toStream(ff_core_StringMap.StringMap_toArray(self_), false)
161
+ return ff_core_List.List_toStream(ff_core_StringMap.StringMap_toList(self_), false)
168
162
  }
169
163
 
170
164
  export function StringMap_toMap(self_) {
171
- return ff_core_Array.Array_toMap(ff_core_StringMap.StringMap_toArray(self_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
165
+ return ff_core_List.List_toMap(ff_core_StringMap.StringMap_toList(self_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
172
166
  }
173
167
 
174
168
  export function StringMap_keys(self_) {
175
- const stack_ = ff_core_Stack.make_();
169
+ const array_ = ff_core_Array.make_();
176
170
  ff_core_StringMap.StringMap_each(self_, ((k_, v_) => {
177
- ff_core_Stack.Stack_push(stack_, k_)
171
+ ff_core_Array.Array_push(array_, k_)
178
172
  }));
179
- return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
173
+ return ff_core_Array.Array_toList(array_, 0, 9007199254740991)
180
174
  }
181
175
 
182
176
  export function StringMap_values(self_) {
183
- const stack_ = ff_core_Stack.make_();
177
+ const array_ = ff_core_Array.make_();
184
178
  ff_core_StringMap.StringMap_each(self_, ((k_, v_) => {
185
- ff_core_Stack.Stack_push(stack_, v_)
179
+ ff_core_Array.Array_push(array_, v_)
186
180
  }));
187
- return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
181
+ return ff_core_Array.Array_toList(array_, 0, 9007199254740991)
188
182
  }
189
183
 
190
184
  export function StringMap_copy(self_) {
@@ -234,44 +228,40 @@ export async function StringMap_eachWhile$(self_, body_, $task) {
234
228
  for(const [k, v] of self_) if(!await body_(k, v)) break
235
229
  }
236
230
 
237
- export async function StringMap_toStack$(self_, $task) {
238
- const stack_ = ff_core_Stack.make_();
231
+ export async function StringMap_toArray$(self_, $task) {
232
+ const array_ = ff_core_Array.make_();
239
233
  ff_core_StringMap.StringMap_each(self_, ((k_, v_) => {
240
- ff_core_Stack.Stack_push(stack_, ff_core_Pair.Pair(k_, v_))
234
+ ff_core_Array.Array_push(array_, ff_core_Pair.Pair(k_, v_))
241
235
  }));
242
- return stack_
243
- }
244
-
245
- export async function StringMap_toArray$(self_, $task) {
246
- return ff_core_Stack.Stack_drain(ff_core_StringMap.StringMap_toStack(self_))
236
+ return array_
247
237
  }
248
238
 
249
239
  export async function StringMap_toList$(self_, $task) {
250
- return ff_core_Array.Array_toList(ff_core_StringMap.StringMap_toArray(self_))
240
+ return ff_core_Array.Array_drain(ff_core_StringMap.StringMap_toArray(self_))
251
241
  }
252
242
 
253
243
  export async function StringMap_toStream$(self_, $task) {
254
- return (await ff_core_Array.Array_toStream$(ff_core_StringMap.StringMap_toArray(self_), false, $task))
244
+ return (await ff_core_List.List_toStream$(ff_core_StringMap.StringMap_toList(self_), false, $task))
255
245
  }
256
246
 
257
247
  export async function StringMap_toMap$(self_, $task) {
258
- return ff_core_Array.Array_toMap(ff_core_StringMap.StringMap_toArray(self_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
248
+ return ff_core_List.List_toMap(ff_core_StringMap.StringMap_toList(self_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
259
249
  }
260
250
 
261
251
  export async function StringMap_keys$(self_, $task) {
262
- const stack_ = ff_core_Stack.make_();
252
+ const array_ = ff_core_Array.make_();
263
253
  ff_core_StringMap.StringMap_each(self_, ((k_, v_) => {
264
- ff_core_Stack.Stack_push(stack_, k_)
254
+ ff_core_Array.Array_push(array_, k_)
265
255
  }));
266
- return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
256
+ return ff_core_Array.Array_toList(array_, 0, 9007199254740991)
267
257
  }
268
258
 
269
259
  export async function StringMap_values$(self_, $task) {
270
- const stack_ = ff_core_Stack.make_();
260
+ const array_ = ff_core_Array.make_();
271
261
  ff_core_StringMap.StringMap_each(self_, ((k_, v_) => {
272
- ff_core_Stack.Stack_push(stack_, v_)
262
+ ff_core_Array.Array_push(array_, v_)
273
263
  }));
274
- return ff_core_Stack.Stack_toList(stack_, 0, 9007199254740991)
264
+ return ff_core_Array.Array_toList(array_, 0, 9007199254740991)
275
265
  }
276
266
 
277
267
  export async function StringMap_copy$(self_, $task) {
@@ -290,14 +280,14 @@ export function StringMap_push(self_, key_, value_) {
290
280
  const _1 = ff_core_StringMap.StringMap_get(self_, key_);
291
281
  {
292
282
  if(_1.None) {
293
- ff_core_StringMap.StringMap_set(self_, key_, ff_core_List.List_toStack(ff_core_List.Link(value_, ff_core_List.Empty())))
283
+ ff_core_StringMap.StringMap_set(self_, key_, ff_core_List.List_toArray([value_]))
294
284
  return
295
285
  }
296
286
  }
297
287
  {
298
288
  if(_1.Some) {
299
- const stack_ = _1.value_;
300
- ff_core_Stack.Stack_push(stack_, value_)
289
+ const array_ = _1.value_;
290
+ ff_core_Array.Array_push(array_, value_)
301
291
  return
302
292
  }
303
293
  }
@@ -309,14 +299,14 @@ export async function StringMap_push$(self_, key_, value_, $task) {
309
299
  const _1 = ff_core_StringMap.StringMap_get(self_, key_);
310
300
  {
311
301
  if(_1.None) {
312
- ff_core_StringMap.StringMap_set(self_, key_, ff_core_List.List_toStack(ff_core_List.Link(value_, ff_core_List.Empty())))
302
+ ff_core_StringMap.StringMap_set(self_, key_, ff_core_List.List_toArray([value_]))
313
303
  return
314
304
  }
315
305
  }
316
306
  {
317
307
  if(_1.Some) {
318
- const stack_ = _1.value_;
319
- ff_core_Stack.Stack_push(stack_, value_)
308
+ const array_ = _1.value_;
309
+ ff_core_Array.Array_push(array_, value_)
320
310
  return
321
311
  }
322
312
  }
@@ -78,8 +78,6 @@ import * as ff_core_Show from "../../ff/core/Show.mjs"
78
78
 
79
79
  import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
80
80
 
81
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
82
-
83
81
  import * as ff_core_Stream from "../../ff/core/Stream.mjs"
84
82
 
85
83
  import * as ff_core_String from "../../ff/core/String.mjs"
@@ -78,8 +78,6 @@ import * as ff_core_Show from "../../ff/core/Show.mjs"
78
78
 
79
79
  import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
80
80
 
81
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
82
-
83
81
  import * as ff_core_Stream from "../../ff/core/Stream.mjs"
84
82
 
85
83
  import * as ff_core_String from "../../ff/core/String.mjs"
@@ -78,8 +78,6 @@ import * as ff_core_Show from "../../ff/core/Show.mjs"
78
78
 
79
79
  import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
80
80
 
81
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
82
-
83
81
  import * as ff_core_Stream from "../../ff/core/Stream.mjs"
84
82
 
85
83
  import * as ff_core_String from "../../ff/core/String.mjs"
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly compiler",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.4.17",
7
+ "version": "0.4.19",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly language support",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.4.17",
7
+ "version": "0.4.19",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -4,7 +4,7 @@ capability WebServer(
4
4
  internalPort: Int
5
5
  mutable internalJsWebSockets: JsValue
6
6
  mutable internalJsWildcard: JsValue
7
- mutable internalJsHosts: Stack[JsValue]
7
+ mutable internalJsHosts: Array[JsValue]
8
8
  mutable internalJsApp: JsValue
9
9
  )
10
10
 
@@ -18,7 +18,7 @@ class WebRequest[T](
18
18
  internalJsResponse: JsValue
19
19
  internalResponse: T
20
20
  internalResponseHeaders: StringMap[String]
21
- internalResponseChunks: Stack[JsValue]
21
+ internalResponseChunks: Array[JsValue]
22
22
  mutable internalResponseStatus: String
23
23
  mutable internalCloseConnection: Bool
24
24
  mutable internalResolveFlush: JsValue
@@ -37,7 +37,7 @@ make(
37
37
  host: String
38
38
  port: Int
39
39
  ): WebServer {
40
- WebServer(system, host, port, system.js().null(), system.js().null(), [].toStack(), system.js().null())
40
+ WebServer(system, host, port, system.js().null(), system.js().null(), [].toArray(), system.js().null())
41
41
  }
42
42
 
43
43
  extend self: WebServer {
@@ -113,7 +113,7 @@ extend self: WebServer {
113
113
  const query = req.getQuery() || '';
114
114
  const headers = new Map();
115
115
  req.forEach((key, value) => headers.set(key, value));
116
- const chunks = internalStack_();
116
+ const chunks = internalArray_();
117
117
  const task = ff_core_Task.Task_spawn($task, async task => {
118
118
  try {
119
119
  ff_core_Task.Task_throwIfAborted(task);
@@ -121,7 +121,7 @@ extend self: WebServer {
121
121
  self_.internalJsApp_, context,
122
122
  method, path, query, headers,
123
123
  res, null,
124
- new Map(), internalStack_(),
124
+ new Map(), internalArray_(),
125
125
  "200 OK", false, null, -1, false
126
126
  );
127
127
  await handler_(webRequest, task);
@@ -611,8 +611,8 @@ internalSend[T](self: WebSocketConnection, send: () => Bool): JsValue
611
611
  }
612
612
  """
613
613
 
614
- internalStack[T](): Stack[T] {
615
- Stack.make()
614
+ internalArray[T](): Array[T] {
615
+ Array.make()
616
616
  }
617
617
 
618
618
  internalTextChunk(data: String): JsValue
@@ -625,7 +625,7 @@ internalBufferChunk(data: Buffer): JsValue
625
625
  return data_;
626
626
  """
627
627
 
628
- internalChunksToChunk(chunks: Stack[JsValue]): JsValue
628
+ internalChunksToChunk(chunks: Array[JsValue]): JsValue
629
629
  target js sync """
630
630
  const chunks = chunks_.array;
631
631
  if(chunks.length === 0) return;