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.
- package/compiler/Builder.ff +1 -1
- package/compiler/Compiler.ff +6 -5
- package/compiler/Inference.ff +31 -19
- package/compiler/JsEmitter.ff +98 -71
- package/compiler/JsImporter.ff +1 -1
- package/compiler/LspHook.ff +4 -4
- package/compiler/Main.ff +6 -6
- package/compiler/Parser.ff +39 -39
- package/compiler/Patterns.ff +2 -0
- package/compiler/Syntax.ff +1 -1
- package/compiler/Tokenizer.ff +2 -2
- package/compiler/Workspace.ff +2 -2
- package/core/Array.ff +135 -294
- package/core/Buffer.ff +3 -3
- package/core/BuildSystem.ff +1 -1
- package/core/Equal.ff +36 -52
- package/core/HttpClient.ff +1 -1
- package/core/IntMap.ff +14 -18
- package/core/JsSystem.ff +1 -1
- package/core/JsValue.ff +6 -12
- package/core/Json.ff +19 -28
- package/core/List.ff +281 -312
- package/core/Map.ff +4 -8
- package/core/NodeSystem.ff +2 -2
- package/core/Option.ff +0 -4
- package/core/Ordering.ff +10 -6
- package/core/Pair.ff +0 -4
- package/core/Random.ff +12 -26
- package/core/RbMap.ff +216 -216
- package/core/Serializable.ff +9 -18
- package/core/Set.ff +0 -1
- package/core/SourceLocation.ff +1 -1
- package/core/Stack.ff +32 -45
- package/core/Stream.ff +10 -14
- package/core/String.ff +24 -6
- package/core/StringMap.ff +15 -19
- package/guide/Main.ff +20 -2
- package/lsp/CompletionHandler.ff +4 -4
- package/lsp/Handler.ff +45 -34
- package/lsp/HoverHandler.ff +2 -2
- package/lsp/LanguageServer.ff +2 -2
- package/lsp/SignatureHelpHandler.ff +1 -1
- package/lsp/SymbolHandler.ff +1 -1
- package/lux/Lux.ff +3 -3
- package/output/js/ff/compiler/Builder.mjs +19 -21
- package/output/js/ff/compiler/Compiler.mjs +18 -20
- package/output/js/ff/compiler/Dependencies.mjs +8 -10
- package/output/js/ff/compiler/Deriver.mjs +234 -236
- package/output/js/ff/compiler/Dictionaries.mjs +6 -8
- package/output/js/ff/compiler/Environment.mjs +42 -44
- package/output/js/ff/compiler/Inference.mjs +346 -304
- package/output/js/ff/compiler/JsEmitter.mjs +907 -833
- package/output/js/ff/compiler/JsImporter.mjs +0 -2
- package/output/js/ff/compiler/LspHook.mjs +10 -12
- package/output/js/ff/compiler/Main.mjs +109 -111
- package/output/js/ff/compiler/Parser.mjs +405 -407
- package/output/js/ff/compiler/Patterns.mjs +64 -50
- package/output/js/ff/compiler/Resolver.mjs +36 -38
- package/output/js/ff/compiler/Substitution.mjs +4 -6
- package/output/js/ff/compiler/Syntax.mjs +160 -162
- package/output/js/ff/compiler/Token.mjs +52 -54
- package/output/js/ff/compiler/Tokenizer.mjs +16 -18
- package/output/js/ff/compiler/Unification.mjs +24 -26
- package/output/js/ff/compiler/Wildcards.mjs +0 -2
- package/output/js/ff/compiler/Workspace.mjs +18 -20
- package/output/js/ff/core/Any.mjs +0 -2
- package/output/js/ff/core/Array.mjs +216 -613
- package/output/js/ff/core/AssetSystem.mjs +2 -4
- package/output/js/ff/core/Atomic.mjs +0 -2
- package/output/js/ff/core/Bool.mjs +0 -2
- package/output/js/ff/core/Box.mjs +0 -2
- package/output/js/ff/core/BrowserSystem.mjs +0 -2
- package/output/js/ff/core/Buffer.mjs +0 -2
- package/output/js/ff/core/BuildSystem.mjs +12 -14
- package/output/js/ff/core/Channel.mjs +0 -2
- package/output/js/ff/core/Char.mjs +0 -2
- package/output/js/ff/core/Core.mjs +0 -2
- package/output/js/ff/core/Duration.mjs +0 -2
- package/output/js/ff/core/Equal.mjs +0 -22
- package/output/js/ff/core/Error.mjs +0 -2
- package/output/js/ff/core/FileHandle.mjs +0 -2
- package/output/js/ff/core/Float.mjs +0 -2
- package/output/js/ff/core/HttpClient.mjs +2 -4
- package/output/js/ff/core/Instant.mjs +0 -2
- package/output/js/ff/core/Int.mjs +8 -10
- package/output/js/ff/core/IntMap.mjs +32 -42
- package/output/js/ff/core/JsSystem.mjs +1 -3
- package/output/js/ff/core/JsValue.mjs +5 -12
- package/output/js/ff/core/Json.mjs +23 -56
- package/output/js/ff/core/List.mjs +648 -1989
- package/output/js/ff/core/Lock.mjs +0 -2
- package/output/js/ff/core/Log.mjs +0 -2
- package/output/js/ff/core/Map.mjs +10 -20
- package/output/js/ff/core/NodeSystem.mjs +6 -8
- package/output/js/ff/core/Nothing.mjs +0 -2
- package/output/js/ff/core/Option.mjs +8 -18
- package/output/js/ff/core/Ordering.mjs +20 -98
- package/output/js/ff/core/Pair.mjs +6 -16
- package/output/js/ff/core/Path.mjs +12 -14
- package/output/js/ff/core/Random.mjs +24 -54
- package/output/js/ff/core/RbMap.mjs +54 -56
- package/output/js/ff/core/Serializable.mjs +19 -36
- package/output/js/ff/core/Set.mjs +0 -14
- package/output/js/ff/core/Show.mjs +0 -2
- package/output/js/ff/core/SourceLocation.mjs +0 -2
- package/output/js/ff/core/Stream.mjs +34 -44
- package/output/js/ff/core/String.mjs +31 -5
- package/output/js/ff/core/StringMap.mjs +32 -42
- package/output/js/ff/core/Task.mjs +0 -2
- package/output/js/ff/core/Try.mjs +0 -2
- package/output/js/ff/core/Unit.mjs +0 -2
- package/package.json +1 -1
- package/vscode/package.json +1 -1
- package/webserver/WebServer.ff +8 -8
- 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_ =
|
|
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_ =
|
|
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
|
|
667
|
-
const
|
|
664
|
+
export function Stream_toArray(self_) {
|
|
665
|
+
const array_ = ff_core_Array.make_();
|
|
668
666
|
ff_core_Stream.Stream_each(self_, ((_w1) => {
|
|
669
|
-
|
|
667
|
+
ff_core_Array.Array_push(array_, _w1)
|
|
670
668
|
}));
|
|
671
|
-
return
|
|
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
|
|
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_ =
|
|
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_ =
|
|
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
|
|
1193
|
-
const
|
|
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
|
-
|
|
1189
|
+
ff_core_Array.Array_push(array_, _w1)
|
|
1196
1190
|
}), $task));
|
|
1197
|
-
return
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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_ =
|
|
1227
|
+
const builder_ = ff_core_Array.make_();
|
|
1238
1228
|
ff_core_Stream.Stream_each(self_, ((_w1) => {
|
|
1239
|
-
|
|
1229
|
+
ff_core_Array.Array_push(builder_, _w1)
|
|
1240
1230
|
}));
|
|
1241
|
-
return ff_core_Buffer.fromBufferArray_(
|
|
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(
|
|
1240
|
+
return ff_core_Pair.Pair([], self_)
|
|
1251
1241
|
} else {
|
|
1252
|
-
const buffers_ =
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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_ =
|
|
1262
|
+
const builder_ = ff_core_Array.make_();
|
|
1273
1263
|
(await ff_core_Stream.Stream_each$(self_, (async (_w1, $task) => {
|
|
1274
|
-
|
|
1264
|
+
ff_core_Array.Array_push(builder_, _w1)
|
|
1275
1265
|
}), $task));
|
|
1276
|
-
return ff_core_Buffer.fromBufferArray_(
|
|
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(
|
|
1275
|
+
return ff_core_Pair.Pair([], self_)
|
|
1286
1276
|
} else {
|
|
1287
|
-
const buffers_ =
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
|
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
|
|
151
|
-
const
|
|
148
|
+
export function StringMap_toArray(self_) {
|
|
149
|
+
const array_ = ff_core_Array.make_();
|
|
152
150
|
ff_core_StringMap.StringMap_each(self_, ((k_, v_) => {
|
|
153
|
-
|
|
151
|
+
ff_core_Array.Array_push(array_, ff_core_Pair.Pair(k_, v_))
|
|
154
152
|
}));
|
|
155
|
-
return
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
169
|
+
const array_ = ff_core_Array.make_();
|
|
176
170
|
ff_core_StringMap.StringMap_each(self_, ((k_, v_) => {
|
|
177
|
-
|
|
171
|
+
ff_core_Array.Array_push(array_, k_)
|
|
178
172
|
}));
|
|
179
|
-
return
|
|
173
|
+
return ff_core_Array.Array_toList(array_, 0, 9007199254740991)
|
|
180
174
|
}
|
|
181
175
|
|
|
182
176
|
export function StringMap_values(self_) {
|
|
183
|
-
const
|
|
177
|
+
const array_ = ff_core_Array.make_();
|
|
184
178
|
ff_core_StringMap.StringMap_each(self_, ((k_, v_) => {
|
|
185
|
-
|
|
179
|
+
ff_core_Array.Array_push(array_, v_)
|
|
186
180
|
}));
|
|
187
|
-
return
|
|
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
|
|
238
|
-
const
|
|
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
|
-
|
|
234
|
+
ff_core_Array.Array_push(array_, ff_core_Pair.Pair(k_, v_))
|
|
241
235
|
}));
|
|
242
|
-
return
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
252
|
+
const array_ = ff_core_Array.make_();
|
|
263
253
|
ff_core_StringMap.StringMap_each(self_, ((k_, v_) => {
|
|
264
|
-
|
|
254
|
+
ff_core_Array.Array_push(array_, k_)
|
|
265
255
|
}));
|
|
266
|
-
return
|
|
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
|
|
260
|
+
const array_ = ff_core_Array.make_();
|
|
271
261
|
ff_core_StringMap.StringMap_each(self_, ((k_, v_) => {
|
|
272
|
-
|
|
262
|
+
ff_core_Array.Array_push(array_, v_)
|
|
273
263
|
}));
|
|
274
|
-
return
|
|
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.
|
|
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
|
|
300
|
-
|
|
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.
|
|
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
|
|
319
|
-
|
|
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
package/vscode/package.json
CHANGED
package/webserver/WebServer.ff
CHANGED
|
@@ -4,7 +4,7 @@ capability WebServer(
|
|
|
4
4
|
internalPort: Int
|
|
5
5
|
mutable internalJsWebSockets: JsValue
|
|
6
6
|
mutable internalJsWildcard: JsValue
|
|
7
|
-
mutable internalJsHosts:
|
|
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:
|
|
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(), [].
|
|
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 =
|
|
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(),
|
|
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
|
-
|
|
615
|
-
|
|
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:
|
|
628
|
+
internalChunksToChunk(chunks: Array[JsValue]): JsValue
|
|
629
629
|
target js sync """
|
|
630
630
|
const chunks = chunks_.array;
|
|
631
631
|
if(chunks.length === 0) return;
|