firefly-compiler 0.4.18 → 0.4.20
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 +17 -5
- package/compiler/Main.ff +6 -6
- package/compiler/Parser.ff +50 -52
- 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 +21 -30
- 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/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 +18 -18
- 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 +19 -5
- 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 +872 -51
- package/output/js/ff/compiler/Main.mjs +109 -111
- package/output/js/ff/compiler/Parser.mjs +427 -441
- 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 +25 -58
- 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/client/src/extension.ts +30 -2
- package/vscode/package.json +17 -1
- package/webserver/WebServer.ff +8 -8
- package/core/Stack.ff +0 -263
- package/output/js/ff/core/Stack.mjs +0 -603
|
@@ -86,8 +86,6 @@ import * as ff_core_Show from "../../ff/core/Show.mjs"
|
|
|
86
86
|
|
|
87
87
|
import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
|
|
88
88
|
|
|
89
|
-
import * as ff_core_Stack from "../../ff/core/Stack.mjs"
|
|
90
|
-
|
|
91
89
|
import * as ff_core_Stream from "../../ff/core/Stream.mjs"
|
|
92
90
|
|
|
93
91
|
import * as ff_core_String from "../../ff/core/String.mjs"
|
|
@@ -128,7 +126,7 @@ export function ProcessedVariantCase(variantName_, newtype_, loneVariant_, argum
|
|
|
128
126
|
return {variantName_, newtype_, loneVariant_, arguments_};
|
|
129
127
|
}
|
|
130
128
|
|
|
131
|
-
export const primitiveTypes_ = ff_core_List.List_toSet(
|
|
129
|
+
export const primitiveTypes_ = ff_core_List.List_toSet(["ff:core/Bool.Bool", "ff:core/Char.Char", "ff:core/Int.Int", "ff:core/Float.Float", "ff:core/String.String"], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
132
130
|
|
|
133
131
|
export function make_(otherModules_, emitTarget_, isMainModule_, compilerModulePath_, packagePair_, moduleName_) {
|
|
134
132
|
return ff_compiler_JsEmitter.JsEmitter(ff_core_List.List_toMap(ff_core_List.List_map(otherModules_, ((m_) => {
|
|
@@ -148,13 +146,13 @@ const term_a = term_;
|
|
|
148
146
|
if(term_a.ECall) {
|
|
149
147
|
const at_ = term_a.at_;
|
|
150
148
|
if(term_a.target_.StaticCall) {
|
|
151
|
-
if(term_a.target_.name_
|
|
152
|
-
if(term_a.arguments_.
|
|
153
|
-
const condition_ = term_a.arguments_
|
|
154
|
-
if(term_a.arguments_.
|
|
155
|
-
const body_ = term_a.arguments_
|
|
156
|
-
if(term_a.arguments_.
|
|
157
|
-
return
|
|
149
|
+
if(term_a.target_.name_ === "ff:core/Core.if") {
|
|
150
|
+
if(term_a.arguments_.length > 0) {
|
|
151
|
+
const condition_ = term_a.arguments_[0];
|
|
152
|
+
if(term_a.arguments_.length > 1) {
|
|
153
|
+
const body_ = term_a.arguments_[1];
|
|
154
|
+
if(term_a.arguments_.length === 2) {
|
|
155
|
+
return [ff_core_Pair.Pair(condition_.value_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_))]
|
|
158
156
|
return
|
|
159
157
|
}
|
|
160
158
|
}
|
|
@@ -167,19 +165,19 @@ return
|
|
|
167
165
|
if(term_a.ECall) {
|
|
168
166
|
const at_ = term_a.at_;
|
|
169
167
|
if(term_a.target_.StaticCall) {
|
|
170
|
-
if(term_a.target_.name_
|
|
171
|
-
if(term_a.arguments_.
|
|
172
|
-
const option_ = term_a.arguments_
|
|
173
|
-
if(term_a.arguments_.
|
|
174
|
-
const condition_ = term_a.arguments_
|
|
175
|
-
if(term_a.arguments_.
|
|
176
|
-
const body_ = term_a.arguments_
|
|
177
|
-
if(term_a.arguments_.
|
|
168
|
+
if(term_a.target_.name_ === "ff:core/Option.Option_elseIf") {
|
|
169
|
+
if(term_a.arguments_.length > 0) {
|
|
170
|
+
const option_ = term_a.arguments_[0];
|
|
171
|
+
if(term_a.arguments_.length > 1) {
|
|
172
|
+
const condition_ = term_a.arguments_[1];
|
|
173
|
+
if(term_a.arguments_.length > 2) {
|
|
174
|
+
const body_ = term_a.arguments_[2];
|
|
175
|
+
if(term_a.arguments_.length === 3) {
|
|
178
176
|
const list_ = ff_compiler_JsEmitter.detectIfElse_(option_.value_);
|
|
179
177
|
if(ff_core_List.List_isEmpty(list_)) {
|
|
180
|
-
return
|
|
178
|
+
return []
|
|
181
179
|
} else {
|
|
182
|
-
return
|
|
180
|
+
return [ff_core_Pair.Pair(ff_compiler_JsEmitter.invokeImmediately_(condition_.value_), ff_compiler_JsEmitter.invokeImmediately_(body_.value_)), ...list_]
|
|
183
181
|
}
|
|
184
182
|
return
|
|
185
183
|
}
|
|
@@ -194,17 +192,17 @@ return
|
|
|
194
192
|
if(term_a.ECall) {
|
|
195
193
|
const at_ = term_a.at_;
|
|
196
194
|
if(term_a.target_.StaticCall) {
|
|
197
|
-
if(term_a.target_.name_
|
|
198
|
-
if(term_a.arguments_.
|
|
199
|
-
const option_ = term_a.arguments_
|
|
200
|
-
if(term_a.arguments_.
|
|
201
|
-
const body_ = term_a.arguments_
|
|
202
|
-
if(term_a.arguments_.
|
|
195
|
+
if(term_a.target_.name_ === "ff:core/Option.Option_else") {
|
|
196
|
+
if(term_a.arguments_.length > 0) {
|
|
197
|
+
const option_ = term_a.arguments_[0];
|
|
198
|
+
if(term_a.arguments_.length > 1) {
|
|
199
|
+
const body_ = term_a.arguments_[1];
|
|
200
|
+
if(term_a.arguments_.length === 2) {
|
|
203
201
|
const list_ = ff_compiler_JsEmitter.detectIfElse_(option_.value_);
|
|
204
202
|
if(ff_core_List.List_isEmpty(list_)) {
|
|
205
|
-
return
|
|
203
|
+
return []
|
|
206
204
|
} else {
|
|
207
|
-
return
|
|
205
|
+
return [ff_core_Pair.Pair(ff_compiler_Syntax.EVariant(at_, "ff:core/Bool.True", [], ff_core_Option.None()), ff_compiler_JsEmitter.invokeImmediately_(body_.value_)), ...list_]
|
|
208
206
|
}
|
|
209
207
|
return
|
|
210
208
|
}
|
|
@@ -215,7 +213,7 @@ return
|
|
|
215
213
|
}
|
|
216
214
|
}
|
|
217
215
|
{
|
|
218
|
-
return
|
|
216
|
+
return []
|
|
219
217
|
return
|
|
220
218
|
}
|
|
221
219
|
}
|
|
@@ -227,11 +225,11 @@ const function_a = function_;
|
|
|
227
225
|
{
|
|
228
226
|
if(function_a.ELambda) {
|
|
229
227
|
const effect_ = function_a.lambda_.effect_;
|
|
230
|
-
if(function_a.lambda_.cases_.
|
|
231
|
-
if(function_a.lambda_.cases_.
|
|
232
|
-
if(function_a.lambda_.cases_.
|
|
233
|
-
const body_ = function_a.lambda_.cases_.
|
|
234
|
-
if(function_a.lambda_.cases_.
|
|
228
|
+
if(function_a.lambda_.cases_.length > 0) {
|
|
229
|
+
if(function_a.lambda_.cases_[0].patterns_.length === 0) {
|
|
230
|
+
if(function_a.lambda_.cases_[0].guards_.length === 0) {
|
|
231
|
+
const body_ = function_a.lambda_.cases_[0].body_;
|
|
232
|
+
if(function_a.lambda_.cases_.length === 1) {
|
|
235
233
|
return body_
|
|
236
234
|
return
|
|
237
235
|
}
|
|
@@ -241,8 +239,8 @@ return
|
|
|
241
239
|
}
|
|
242
240
|
}
|
|
243
241
|
{
|
|
244
|
-
const effect_ = ff_compiler_Syntax.TConstructor(function_.at_, "Q$",
|
|
245
|
-
return ff_compiler_Syntax.ECall(function_.at_, ff_compiler_Syntax.DynamicCall(function_, false), effect_,
|
|
242
|
+
const effect_ = ff_compiler_Syntax.TConstructor(function_.at_, "Q$", []);
|
|
243
|
+
return ff_compiler_Syntax.ECall(function_.at_, ff_compiler_Syntax.DynamicCall(function_, false), effect_, [], [], [])
|
|
246
244
|
return
|
|
247
245
|
}
|
|
248
246
|
}
|
|
@@ -296,31 +294,31 @@ export function charLiteralToNumber_(charLiteral_) {
|
|
|
296
294
|
{
|
|
297
295
|
const charLiteral_a = charLiteral_;
|
|
298
296
|
{
|
|
299
|
-
if(charLiteral_a
|
|
297
|
+
if(charLiteral_a === "'\\t'") {
|
|
300
298
|
return "9"
|
|
301
299
|
return
|
|
302
300
|
}
|
|
303
301
|
}
|
|
304
302
|
{
|
|
305
|
-
if(charLiteral_a
|
|
303
|
+
if(charLiteral_a === "'\\n'") {
|
|
306
304
|
return "10"
|
|
307
305
|
return
|
|
308
306
|
}
|
|
309
307
|
}
|
|
310
308
|
{
|
|
311
|
-
if(charLiteral_a
|
|
309
|
+
if(charLiteral_a === "'\\r'") {
|
|
312
310
|
return "13"
|
|
313
311
|
return
|
|
314
312
|
}
|
|
315
313
|
}
|
|
316
314
|
{
|
|
317
|
-
if(charLiteral_a
|
|
315
|
+
if(charLiteral_a === "'\\\"'") {
|
|
318
316
|
return "34"
|
|
319
317
|
return
|
|
320
318
|
}
|
|
321
319
|
}
|
|
322
320
|
{
|
|
323
|
-
if(charLiteral_a
|
|
321
|
+
if(charLiteral_a === "'\\''") {
|
|
324
322
|
return "39"
|
|
325
323
|
return
|
|
326
324
|
}
|
|
@@ -334,7 +332,7 @@ return
|
|
|
334
332
|
}
|
|
335
333
|
|
|
336
334
|
export function escapeResolved_(word_) {
|
|
337
|
-
const parts_ =
|
|
335
|
+
const parts_ = ff_core_String.String_split(ff_core_String.String_replace(ff_core_String.String_replace(word_, ":", "."), "/", "."), 46);
|
|
338
336
|
const initialParts_ = ff_core_List.List_dropLast(parts_, 1);
|
|
339
337
|
if(ff_core_List.List_isEmpty(initialParts_)) {
|
|
340
338
|
return ff_compiler_JsEmitter.escapeKeyword_(ff_core_List.List_grabLast(parts_))
|
|
@@ -356,7 +354,7 @@ export function effectTypeIsAsync_(effect_) {
|
|
|
356
354
|
const effect_a = effect_;
|
|
357
355
|
{
|
|
358
356
|
if(effect_a.TConstructor) {
|
|
359
|
-
if(effect_a.name_
|
|
357
|
+
if(effect_a.name_ === "Q$") {
|
|
360
358
|
return true
|
|
361
359
|
return
|
|
362
360
|
}
|
|
@@ -387,13 +385,13 @@ const term_a = term_;
|
|
|
387
385
|
if(term_a.ECall) {
|
|
388
386
|
const at_ = term_a.at_;
|
|
389
387
|
if(term_a.target_.StaticCall) {
|
|
390
|
-
if(term_a.target_.name_
|
|
391
|
-
if(term_a.arguments_.
|
|
392
|
-
const condition_ = term_a.arguments_
|
|
393
|
-
if(term_a.arguments_.
|
|
394
|
-
const body_ = term_a.arguments_
|
|
395
|
-
if(term_a.arguments_.
|
|
396
|
-
return
|
|
388
|
+
if(term_a.target_.name_ === "ff:core/Core.if") {
|
|
389
|
+
if(term_a.arguments_.length > 0) {
|
|
390
|
+
const condition_ = term_a.arguments_[0];
|
|
391
|
+
if(term_a.arguments_.length > 1) {
|
|
392
|
+
const body_ = term_a.arguments_[1];
|
|
393
|
+
if(term_a.arguments_.length === 2) {
|
|
394
|
+
return [ff_core_Pair.Pair(condition_.value_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_))]
|
|
397
395
|
return
|
|
398
396
|
}
|
|
399
397
|
}
|
|
@@ -406,19 +404,19 @@ return
|
|
|
406
404
|
if(term_a.ECall) {
|
|
407
405
|
const at_ = term_a.at_;
|
|
408
406
|
if(term_a.target_.StaticCall) {
|
|
409
|
-
if(term_a.target_.name_
|
|
410
|
-
if(term_a.arguments_.
|
|
411
|
-
const option_ = term_a.arguments_
|
|
412
|
-
if(term_a.arguments_.
|
|
413
|
-
const condition_ = term_a.arguments_
|
|
414
|
-
if(term_a.arguments_.
|
|
415
|
-
const body_ = term_a.arguments_
|
|
416
|
-
if(term_a.arguments_.
|
|
407
|
+
if(term_a.target_.name_ === "ff:core/Option.Option_elseIf") {
|
|
408
|
+
if(term_a.arguments_.length > 0) {
|
|
409
|
+
const option_ = term_a.arguments_[0];
|
|
410
|
+
if(term_a.arguments_.length > 1) {
|
|
411
|
+
const condition_ = term_a.arguments_[1];
|
|
412
|
+
if(term_a.arguments_.length > 2) {
|
|
413
|
+
const body_ = term_a.arguments_[2];
|
|
414
|
+
if(term_a.arguments_.length === 3) {
|
|
417
415
|
const list_ = ff_compiler_JsEmitter.detectIfElse_(option_.value_);
|
|
418
416
|
if(ff_core_List.List_isEmpty(list_)) {
|
|
419
|
-
return
|
|
417
|
+
return []
|
|
420
418
|
} else {
|
|
421
|
-
return
|
|
419
|
+
return [ff_core_Pair.Pair(ff_compiler_JsEmitter.invokeImmediately_(condition_.value_), ff_compiler_JsEmitter.invokeImmediately_(body_.value_)), ...list_]
|
|
422
420
|
}
|
|
423
421
|
return
|
|
424
422
|
}
|
|
@@ -433,17 +431,17 @@ return
|
|
|
433
431
|
if(term_a.ECall) {
|
|
434
432
|
const at_ = term_a.at_;
|
|
435
433
|
if(term_a.target_.StaticCall) {
|
|
436
|
-
if(term_a.target_.name_
|
|
437
|
-
if(term_a.arguments_.
|
|
438
|
-
const option_ = term_a.arguments_
|
|
439
|
-
if(term_a.arguments_.
|
|
440
|
-
const body_ = term_a.arguments_
|
|
441
|
-
if(term_a.arguments_.
|
|
434
|
+
if(term_a.target_.name_ === "ff:core/Option.Option_else") {
|
|
435
|
+
if(term_a.arguments_.length > 0) {
|
|
436
|
+
const option_ = term_a.arguments_[0];
|
|
437
|
+
if(term_a.arguments_.length > 1) {
|
|
438
|
+
const body_ = term_a.arguments_[1];
|
|
439
|
+
if(term_a.arguments_.length === 2) {
|
|
442
440
|
const list_ = ff_compiler_JsEmitter.detectIfElse_(option_.value_);
|
|
443
441
|
if(ff_core_List.List_isEmpty(list_)) {
|
|
444
|
-
return
|
|
442
|
+
return []
|
|
445
443
|
} else {
|
|
446
|
-
return
|
|
444
|
+
return [ff_core_Pair.Pair(ff_compiler_Syntax.EVariant(at_, "ff:core/Bool.True", [], ff_core_Option.None()), ff_compiler_JsEmitter.invokeImmediately_(body_.value_)), ...list_]
|
|
447
445
|
}
|
|
448
446
|
return
|
|
449
447
|
}
|
|
@@ -454,7 +452,7 @@ return
|
|
|
454
452
|
}
|
|
455
453
|
}
|
|
456
454
|
{
|
|
457
|
-
return
|
|
455
|
+
return []
|
|
458
456
|
return
|
|
459
457
|
}
|
|
460
458
|
}
|
|
@@ -466,11 +464,11 @@ const function_a = function_;
|
|
|
466
464
|
{
|
|
467
465
|
if(function_a.ELambda) {
|
|
468
466
|
const effect_ = function_a.lambda_.effect_;
|
|
469
|
-
if(function_a.lambda_.cases_.
|
|
470
|
-
if(function_a.lambda_.cases_.
|
|
471
|
-
if(function_a.lambda_.cases_.
|
|
472
|
-
const body_ = function_a.lambda_.cases_.
|
|
473
|
-
if(function_a.lambda_.cases_.
|
|
467
|
+
if(function_a.lambda_.cases_.length > 0) {
|
|
468
|
+
if(function_a.lambda_.cases_[0].patterns_.length === 0) {
|
|
469
|
+
if(function_a.lambda_.cases_[0].guards_.length === 0) {
|
|
470
|
+
const body_ = function_a.lambda_.cases_[0].body_;
|
|
471
|
+
if(function_a.lambda_.cases_.length === 1) {
|
|
474
472
|
return body_
|
|
475
473
|
return
|
|
476
474
|
}
|
|
@@ -480,8 +478,8 @@ return
|
|
|
480
478
|
}
|
|
481
479
|
}
|
|
482
480
|
{
|
|
483
|
-
const effect_ = ff_compiler_Syntax.TConstructor(function_.at_, "Q$",
|
|
484
|
-
return ff_compiler_Syntax.ECall(function_.at_, ff_compiler_Syntax.DynamicCall(function_, false), effect_,
|
|
481
|
+
const effect_ = ff_compiler_Syntax.TConstructor(function_.at_, "Q$", []);
|
|
482
|
+
return ff_compiler_Syntax.ECall(function_.at_, ff_compiler_Syntax.DynamicCall(function_, false), effect_, [], [], [])
|
|
485
483
|
return
|
|
486
484
|
}
|
|
487
485
|
}
|
|
@@ -535,31 +533,31 @@ export async function charLiteralToNumber_$(charLiteral_, $task) {
|
|
|
535
533
|
{
|
|
536
534
|
const charLiteral_a = charLiteral_;
|
|
537
535
|
{
|
|
538
|
-
if(charLiteral_a
|
|
536
|
+
if(charLiteral_a === "'\\t'") {
|
|
539
537
|
return "9"
|
|
540
538
|
return
|
|
541
539
|
}
|
|
542
540
|
}
|
|
543
541
|
{
|
|
544
|
-
if(charLiteral_a
|
|
542
|
+
if(charLiteral_a === "'\\n'") {
|
|
545
543
|
return "10"
|
|
546
544
|
return
|
|
547
545
|
}
|
|
548
546
|
}
|
|
549
547
|
{
|
|
550
|
-
if(charLiteral_a
|
|
548
|
+
if(charLiteral_a === "'\\r'") {
|
|
551
549
|
return "13"
|
|
552
550
|
return
|
|
553
551
|
}
|
|
554
552
|
}
|
|
555
553
|
{
|
|
556
|
-
if(charLiteral_a
|
|
554
|
+
if(charLiteral_a === "'\\\"'") {
|
|
557
555
|
return "34"
|
|
558
556
|
return
|
|
559
557
|
}
|
|
560
558
|
}
|
|
561
559
|
{
|
|
562
|
-
if(charLiteral_a
|
|
560
|
+
if(charLiteral_a === "'\\''") {
|
|
563
561
|
return "39"
|
|
564
562
|
return
|
|
565
563
|
}
|
|
@@ -573,7 +571,7 @@ return
|
|
|
573
571
|
}
|
|
574
572
|
|
|
575
573
|
export async function escapeResolved_$(word_, $task) {
|
|
576
|
-
const parts_ =
|
|
574
|
+
const parts_ = ff_core_String.String_split(ff_core_String.String_replace(ff_core_String.String_replace(word_, ":", "."), "/", "."), 46);
|
|
577
575
|
const initialParts_ = ff_core_List.List_dropLast(parts_, 1);
|
|
578
576
|
if(ff_core_List.List_isEmpty(initialParts_)) {
|
|
579
577
|
return ff_compiler_JsEmitter.escapeKeyword_(ff_core_List.List_grabLast(parts_))
|
|
@@ -595,7 +593,7 @@ export async function effectTypeIsAsync_$(effect_, $task) {
|
|
|
595
593
|
const effect_a = effect_;
|
|
596
594
|
{
|
|
597
595
|
if(effect_a.TConstructor) {
|
|
598
|
-
if(effect_a.name_
|
|
596
|
+
if(effect_a.name_ === "Q$") {
|
|
599
597
|
return true
|
|
600
598
|
return
|
|
601
599
|
}
|
|
@@ -610,39 +608,39 @@ return
|
|
|
610
608
|
|
|
611
609
|
export function JsEmitter_emitModule(self_, packagePair_, module_) {
|
|
612
610
|
const selfImport_ = ((((((((("import * as " + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "_")) + "_") + ff_core_String.String_dropLast(module_.file_, 3)) + " ") + "from \"../../") + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + ff_core_String.String_dropLast(module_.file_, 3)) + ".mjs\"");
|
|
613
|
-
const imports_ = ff_core_List.List_flatten(
|
|
611
|
+
const imports_ = ff_core_List.List_flatten([ff_core_Option.Option_toList(ff_core_Option.Option_map(self_.compilerModulePath_, ((_w1) => {
|
|
614
612
|
return (("import * as $firefly_compiler from '" + ff_core_Path.Path_url(_w1)) + "'")
|
|
615
|
-
}))), ff_core_List.
|
|
613
|
+
}))), ff_core_List.List_map(ff_core_List.List_sortBy(module_.imports_, ((i_) => {
|
|
616
614
|
return ff_core_Pair.Pair(i_.package_, i_.file_)
|
|
617
615
|
}), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)), ((_w1) => {
|
|
618
616
|
return ff_compiler_JsEmitter.JsEmitter_emitImportDefinition(self_, _w1)
|
|
619
|
-
}))
|
|
620
|
-
const parts_ =
|
|
617
|
+
}))]);
|
|
618
|
+
const parts_ = [(ff_core_List.List_any(imports_, ((_w1) => {
|
|
621
619
|
return (_w1 === selfImport_)
|
|
622
620
|
}))
|
|
623
621
|
? imports_
|
|
624
|
-
:
|
|
622
|
+
: [selfImport_, ...imports_]), ff_core_List.List_map(module_.types_, ((_w1) => {
|
|
625
623
|
return ff_compiler_JsEmitter.JsEmitter_emitTypeDefinition(self_, _w1)
|
|
626
|
-
})), ff_core_List.
|
|
624
|
+
})), ff_core_List.List_map(module_.lets_, ((_w1) => {
|
|
627
625
|
return ("export " + ff_compiler_JsEmitter.JsEmitter_emitLetDefinition(self_, _w1, false, false))
|
|
628
|
-
})), ff_core_List.
|
|
626
|
+
})), ff_core_List.List_map(module_.functions_, ((_w1) => {
|
|
629
627
|
return ("export " + ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_, _w1, false, ""))
|
|
630
|
-
})),
|
|
628
|
+
})), ff_compiler_JsEmitter.JsEmitter_withEmittingAsync(self_, (() => {
|
|
631
629
|
return ff_core_List.List_map(module_.functions_, ((_w1) => {
|
|
632
630
|
return ("export " + ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_, _w1, true, ""))
|
|
633
631
|
}))
|
|
634
|
-
})), ff_core_List.
|
|
632
|
+
})), ff_core_List.List_map(module_.extends_, ((_w1) => {
|
|
635
633
|
return ff_compiler_JsEmitter.JsEmitter_emitExtendsDefinition(self_, _w1)
|
|
636
|
-
})), ff_core_List.
|
|
634
|
+
})), ff_core_List.List_map(module_.instances_, ((_w1) => {
|
|
637
635
|
return ff_compiler_JsEmitter.JsEmitter_emitInstanceDefinition(self_, _w1)
|
|
638
|
-
})),
|
|
636
|
+
})), (self_.isMainModule_
|
|
639
637
|
? ff_compiler_JsEmitter.JsEmitter_emitRun(self_, module_.functions_, packagePair_, ((packagePair_.group_ === "ff") && (packagePair_.name_ === "compiler")))
|
|
640
|
-
:
|
|
638
|
+
: [])];
|
|
641
639
|
const ignoreJsImports_ = (((ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitExecutable()) && (packagePair_.group_ === "ff")) && (packagePair_.name_ === "core"))
|
|
642
|
-
?
|
|
643
|
-
:
|
|
640
|
+
? ["esbuild"]
|
|
641
|
+
: []);
|
|
644
642
|
const jsImports_ = ff_compiler_JsImporter.JsImporter_generateImports(self_.jsImporter_, ff_core_List.List_toSet(ignoreJsImports_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String));
|
|
645
|
-
return (ff_core_List.List_join(ff_core_List.List_map(
|
|
643
|
+
return (ff_core_List.List_join(ff_core_List.List_map([jsImports_, ...parts_], ((_w1) => {
|
|
646
644
|
return ff_core_List.List_join(_w1, "\n\n")
|
|
647
645
|
})), "\n\n") + "\n")
|
|
648
646
|
}
|
|
@@ -676,24 +674,24 @@ return (_w1.signature_.name_ === "main")
|
|
|
676
674
|
return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Option.Option_map(mainFunction_, ((_w1) => {
|
|
677
675
|
return _w1.signature_.name_
|
|
678
676
|
})), ((mainName_) => {
|
|
679
|
-
return ff_core_List.
|
|
680
|
-
?
|
|
681
|
-
:
|
|
677
|
+
return [ff_core_List.List_join(["export async function $run$(fireflyPath_, arguments_) {", "Error.stackTraceLimit = 50", "const $task = {controller: new AbortController(), subtasks: new Set(), promise: new Promise(() => {}), started: performance.now() * 0.001}", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
|
|
678
|
+
? ["let interval = setInterval(() => {}, 24 * 60 * 60 * 1000)"]
|
|
679
|
+
: []), "let system = {", "task_: $task,", "array_: arguments_,", "fireflyPath_: fireflyPath_,", (((("mainPackagePair_: {group_: \"" + mainPackagePair_.group_) + "\", name_: \"") + mainPackagePair_.name_) + "\"},"), (("executableMode_: " + (ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitExecutable())
|
|
682
680
|
? "true"
|
|
683
|
-
: "false")) + ","),
|
|
681
|
+
: "false")) + ","), ("buildMode_: " + (ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBuild())
|
|
684
682
|
? "true"
|
|
685
|
-
: "false")),
|
|
686
|
-
?
|
|
687
|
-
:
|
|
688
|
-
?
|
|
689
|
-
:
|
|
690
|
-
?
|
|
691
|
-
:
|
|
692
|
-
?
|
|
693
|
-
:
|
|
683
|
+
: "false")), "}", "try {", ...((!ff_core_Option.Option_isEmpty(buildMainFunction_))
|
|
684
|
+
? ["await buildMain_$(system, $task)"]
|
|
685
|
+
: []), ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBuild(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
|
|
686
|
+
? [(("await " + mainName_) + "_$(system, $task)")]
|
|
687
|
+
: []), ...(ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBuild())
|
|
688
|
+
? ["await $firefly_compiler.internalCreateExecutable_$(system, '.firefly/output/executable/Main.bundle.js', '.firefly/output', ['host'], system.assets_, $task)"]
|
|
689
|
+
: []), "} finally {", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
|
|
690
|
+
? ["ff_core_Task.Task_abort$($task)", "clearInterval(interval)"]
|
|
691
|
+
: []), "}", "}", ...(((_1) => {
|
|
694
692
|
{
|
|
695
693
|
if(_1.EmitBrowser) {
|
|
696
|
-
return
|
|
694
|
+
return ["queueMicrotask(async () => {", "await $run$(null, [])", "})"]
|
|
697
695
|
return
|
|
698
696
|
}
|
|
699
697
|
}
|
|
@@ -701,24 +699,24 @@ return
|
|
|
701
699
|
if(_1.EmitNode) {
|
|
702
700
|
const _guard1 = bootstrapping_;
|
|
703
701
|
if(_guard1) {
|
|
704
|
-
return
|
|
702
|
+
return ["import * as path from 'node:path'", "queueMicrotask(async () => {", "let fireflyPath_ = path.dirname(path.dirname(path.dirname(path.dirname(path.dirname(process.argv[1])))))", "await $run$(fireflyPath_, process.argv.slice(2))", "})"]
|
|
705
703
|
return
|
|
706
704
|
}
|
|
707
705
|
}
|
|
708
706
|
}
|
|
709
707
|
{
|
|
710
708
|
if(_1.EmitExecutable) {
|
|
711
|
-
return
|
|
709
|
+
return ["queueMicrotask(async () => {", "await $run$(null, process.argv.slice(2))", "})"]
|
|
712
710
|
return
|
|
713
711
|
}
|
|
714
712
|
}
|
|
715
713
|
{
|
|
716
|
-
return
|
|
714
|
+
return []
|
|
717
715
|
return
|
|
718
716
|
}
|
|
719
|
-
}))(self_.emitTarget_)
|
|
717
|
+
}))(self_.emitTarget_)], "\n")]
|
|
720
718
|
})), (() => {
|
|
721
|
-
return
|
|
719
|
+
return []
|
|
722
720
|
}))
|
|
723
721
|
}
|
|
724
722
|
|
|
@@ -758,7 +756,7 @@ return ff_core_List.List_map(methods_, ((_w1) => {
|
|
|
758
756
|
return ("export " + ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_, _w1, true, ""))
|
|
759
757
|
}))
|
|
760
758
|
}));
|
|
761
|
-
return ff_core_List.List_join(
|
|
759
|
+
return ff_core_List.List_join([...syncMethods_, ...asyncMethods_], "\n\n")
|
|
762
760
|
}
|
|
763
761
|
|
|
764
762
|
export function JsEmitter_emitInstanceDefinition(self_, definition_) {
|
|
@@ -775,11 +773,11 @@ return ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_, _w1, true,
|
|
|
775
773
|
return ("async " + ff_core_String.String_dropFirst(_w1, ff_core_String.String_size("async function ")))
|
|
776
774
|
}))
|
|
777
775
|
}));
|
|
778
|
-
const body_ = (("{\n" + ff_core_List.List_join(
|
|
776
|
+
const body_ = (("{\n" + ff_core_List.List_join([...methods_, ...asyncMethods_], ",\n")) + "\n}");
|
|
779
777
|
{
|
|
780
778
|
const _1 = definition_.constraints_;
|
|
781
779
|
{
|
|
782
|
-
if(_1.
|
|
780
|
+
if(_1.length === 0) {
|
|
783
781
|
return (((("export const " + name_) + " = ") + body_) + ";")
|
|
784
782
|
return
|
|
785
783
|
}
|
|
@@ -848,9 +846,9 @@ const lambda_ = _1.second_.lambda_;
|
|
|
848
846
|
const _1 = lambda_;
|
|
849
847
|
{
|
|
850
848
|
const effect_ = _1.effect_;
|
|
851
|
-
if(_1.cases_.
|
|
852
|
-
const matchCase_ = _1.cases_
|
|
853
|
-
if(_1.cases_.
|
|
849
|
+
if(_1.cases_.length > 0) {
|
|
850
|
+
const matchCase_ = _1.cases_[0];
|
|
851
|
+
if(_1.cases_.length === 1) {
|
|
854
852
|
const _guard1 = ff_core_List.List_all(matchCase_.patterns_, ((_1) => {
|
|
855
853
|
{
|
|
856
854
|
if(_1.PVariable) {
|
|
@@ -922,9 +920,9 @@ const dictionaryStrings_ = ff_core_List.List_map(signature_.constraints_, ((c_)
|
|
|
922
920
|
return ff_compiler_JsEmitter.makeDictionaryName_(c_.name_, ff_compiler_JsEmitter.firstTypeName_(c_.generics_))
|
|
923
921
|
}));
|
|
924
922
|
const controller_ = (async_
|
|
925
|
-
?
|
|
926
|
-
:
|
|
927
|
-
const parameters_ = (("(" + ff_core_List.List_join(
|
|
923
|
+
? ["$task"]
|
|
924
|
+
: []);
|
|
925
|
+
const parameters_ = (("(" + ff_core_List.List_join([...parameterStrings_, ...dictionaryStrings_, ...controller_], ", ")) + ")");
|
|
928
926
|
const prefix_ = (async_
|
|
929
927
|
? "async "
|
|
930
928
|
: "");
|
|
@@ -954,7 +952,7 @@ return ff_compiler_JsEmitter.JsEmitter_emitVariantDefinition(self_, definition_,
|
|
|
954
952
|
}
|
|
955
953
|
|
|
956
954
|
export function JsEmitter_emitVariantDefinition(self_, typeDefinition_, definition_) {
|
|
957
|
-
const allFields_ =
|
|
955
|
+
const allFields_ = [...typeDefinition_.commonFields_, ...definition_.fields_];
|
|
958
956
|
const fields_ = ff_core_List.List_join(ff_core_List.List_map(allFields_, ((_w1) => {
|
|
959
957
|
return ff_compiler_JsEmitter.escapeKeyword_(_w1.name_)
|
|
960
958
|
})), ", ");
|
|
@@ -1032,7 +1030,7 @@ return
|
|
|
1032
1030
|
{
|
|
1033
1031
|
if(_1.EVariant) {
|
|
1034
1032
|
const at_ = _1.at_;
|
|
1035
|
-
if(_1.name_
|
|
1033
|
+
if(_1.name_ === "ff:core/Bool.False") {
|
|
1036
1034
|
return "false"
|
|
1037
1035
|
return
|
|
1038
1036
|
}
|
|
@@ -1041,7 +1039,7 @@ return
|
|
|
1041
1039
|
{
|
|
1042
1040
|
if(_1.EVariant) {
|
|
1043
1041
|
const at_ = _1.at_;
|
|
1044
|
-
if(_1.name_
|
|
1042
|
+
if(_1.name_ === "ff:core/Bool.True") {
|
|
1045
1043
|
return "true"
|
|
1046
1044
|
return
|
|
1047
1045
|
}
|
|
@@ -1050,7 +1048,7 @@ return
|
|
|
1050
1048
|
{
|
|
1051
1049
|
if(_1.EVariant) {
|
|
1052
1050
|
const at_ = _1.at_;
|
|
1053
|
-
if(_1.name_
|
|
1051
|
+
if(_1.name_ === "ff:core/Unit.Unit") {
|
|
1054
1052
|
return "(void 0)"
|
|
1055
1053
|
return
|
|
1056
1054
|
}
|
|
@@ -1076,7 +1074,7 @@ return
|
|
|
1076
1074
|
{
|
|
1077
1075
|
if(_1.EVariantIs) {
|
|
1078
1076
|
const at_ = _1.at_;
|
|
1079
|
-
if(_1.name_
|
|
1077
|
+
if(_1.name_ === "ff:core/Bool.False") {
|
|
1080
1078
|
return "function(_v) { return !_v ? ff_core_Option.Some(_v) : ff_core_Option.None(); }"
|
|
1081
1079
|
return
|
|
1082
1080
|
}
|
|
@@ -1085,7 +1083,7 @@ return
|
|
|
1085
1083
|
{
|
|
1086
1084
|
if(_1.EVariantIs) {
|
|
1087
1085
|
const at_ = _1.at_;
|
|
1088
|
-
if(_1.name_
|
|
1086
|
+
if(_1.name_ === "ff:core/Bool.True") {
|
|
1089
1087
|
return "function(_v) { return _v ? ff_core_Option.Some(_v) : ff_core_Option.None(); }"
|
|
1090
1088
|
return
|
|
1091
1089
|
}
|
|
@@ -1094,7 +1092,7 @@ return
|
|
|
1094
1092
|
{
|
|
1095
1093
|
if(_1.EVariantIs) {
|
|
1096
1094
|
const at_ = _1.at_;
|
|
1097
|
-
if(_1.name_
|
|
1095
|
+
if(_1.name_ === "ff:core/Unit.Unit") {
|
|
1098
1096
|
return "function(_v) { return ff_core_Option.Some(_v); }"
|
|
1099
1097
|
return
|
|
1100
1098
|
}
|
|
@@ -1142,11 +1140,11 @@ return
|
|
|
1142
1140
|
if(_1.ELambda) {
|
|
1143
1141
|
const at_ = _1.at_;
|
|
1144
1142
|
const effect_ = _1.lambda_.effect_;
|
|
1145
|
-
if(_1.lambda_.cases_.
|
|
1146
|
-
const patterns_ = _1.lambda_.cases_.
|
|
1147
|
-
if(_1.lambda_.cases_.
|
|
1148
|
-
const body_ = _1.lambda_.cases_.
|
|
1149
|
-
if(_1.lambda_.cases_.
|
|
1143
|
+
if(_1.lambda_.cases_.length > 0) {
|
|
1144
|
+
const patterns_ = _1.lambda_.cases_[0].patterns_;
|
|
1145
|
+
if(_1.lambda_.cases_[0].guards_.length === 0) {
|
|
1146
|
+
const body_ = _1.lambda_.cases_[0].body_;
|
|
1147
|
+
if(_1.lambda_.cases_.length === 1) {
|
|
1150
1148
|
const _guard1 = ff_core_List.List_all(patterns_, ((_1) => {
|
|
1151
1149
|
{
|
|
1152
1150
|
if(_1.PVariable) {
|
|
@@ -1179,9 +1177,9 @@ return
|
|
|
1179
1177
|
}
|
|
1180
1178
|
}));
|
|
1181
1179
|
const controller_ = (newAsync_
|
|
1182
|
-
?
|
|
1183
|
-
:
|
|
1184
|
-
const parameters_ = ff_core_List.List_join(
|
|
1180
|
+
? ["$task"]
|
|
1181
|
+
: []);
|
|
1182
|
+
const parameters_ = ff_core_List.List_join([...patternParameters_, ...controller_], ", ");
|
|
1185
1183
|
const prefix_ = (newAsync_
|
|
1186
1184
|
? "async "
|
|
1187
1185
|
: "");
|
|
@@ -1200,8 +1198,8 @@ const effect_ = _1.lambda_.effect_;
|
|
|
1200
1198
|
const cases_ = _1.lambda_.cases_;
|
|
1201
1199
|
const newAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
|
|
1202
1200
|
const controller_ = (newAsync_
|
|
1203
|
-
?
|
|
1204
|
-
:
|
|
1201
|
+
? ["$task"]
|
|
1202
|
+
: []);
|
|
1205
1203
|
ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
|
|
1206
1204
|
const arguments_ = ff_core_List.List_map(ff_core_List.List_pairs(ff_core_List.List_grab(cases_, 0).patterns_), ((_w1) => {
|
|
1207
1205
|
return ("_" + (_w1.first_ + 1))
|
|
@@ -1215,7 +1213,7 @@ return (("{\n" + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, escapedArgument
|
|
|
1215
1213
|
const prefix_ = (newAsync_
|
|
1216
1214
|
? "async "
|
|
1217
1215
|
: "");
|
|
1218
|
-
return ((((((("(" + prefix_) + "(") + ff_core_List.List_join(
|
|
1216
|
+
return ((((((("(" + prefix_) + "(") + ff_core_List.List_join([...escapedArguments_, ...controller_], ", ")) + ") => ") + "{\n") + ff_core_List.List_join(caseStrings_, "\n")) + "\n})")
|
|
1219
1217
|
return
|
|
1220
1218
|
}
|
|
1221
1219
|
}
|
|
@@ -1243,10 +1241,10 @@ if(_1.ECall) {
|
|
|
1243
1241
|
const at_ = _1.at_;
|
|
1244
1242
|
if(_1.target_.StaticCall) {
|
|
1245
1243
|
const operator_ = _1.target_.name_;
|
|
1246
|
-
if(_1.typeArguments_.
|
|
1247
|
-
if(_1.arguments_.
|
|
1248
|
-
const value_ = _1.arguments_
|
|
1249
|
-
if(_1.arguments_.
|
|
1244
|
+
if(_1.typeArguments_.length === 0) {
|
|
1245
|
+
if(_1.arguments_.length > 0) {
|
|
1246
|
+
const value_ = _1.arguments_[0];
|
|
1247
|
+
if(_1.arguments_.length === 1) {
|
|
1250
1248
|
const _guard1 = (!ff_core_Char.Char_isAsciiLetter(ff_core_String.String_grabFirst(operator_)));
|
|
1251
1249
|
if(_guard1) {
|
|
1252
1250
|
return ((("(" + operator_) + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, value_, async_)) + ")")
|
|
@@ -1263,12 +1261,12 @@ if(_1.ECall) {
|
|
|
1263
1261
|
const at_ = _1.at_;
|
|
1264
1262
|
if(_1.target_.StaticCall) {
|
|
1265
1263
|
const operator_ = _1.target_.name_;
|
|
1266
|
-
if(_1.typeArguments_.
|
|
1267
|
-
if(_1.arguments_.
|
|
1268
|
-
const left_ = _1.arguments_
|
|
1269
|
-
if(_1.arguments_.
|
|
1270
|
-
const right_ = _1.arguments_
|
|
1271
|
-
if(_1.arguments_.
|
|
1264
|
+
if(_1.typeArguments_.length === 0) {
|
|
1265
|
+
if(_1.arguments_.length > 0) {
|
|
1266
|
+
const left_ = _1.arguments_[0];
|
|
1267
|
+
if(_1.arguments_.length > 1) {
|
|
1268
|
+
const right_ = _1.arguments_[1];
|
|
1269
|
+
if(_1.arguments_.length === 2) {
|
|
1272
1270
|
const _guard1 = (!ff_core_Char.Char_isAsciiLetter(ff_core_String.String_grabFirst(operator_)));
|
|
1273
1271
|
if(_guard1) {
|
|
1274
1272
|
return (((((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " ") + operator_) + " ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
|
|
@@ -1285,11 +1283,11 @@ return
|
|
|
1285
1283
|
if(_1.ECall) {
|
|
1286
1284
|
const at_ = _1.at_;
|
|
1287
1285
|
if(_1.target_.StaticCall) {
|
|
1288
|
-
if(_1.target_.name_
|
|
1289
|
-
if(_1.arguments_.
|
|
1290
|
-
if(_1.arguments_.
|
|
1291
|
-
const url_ = _1.arguments_.
|
|
1292
|
-
if(_1.arguments_.
|
|
1286
|
+
if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.import") {
|
|
1287
|
+
if(_1.arguments_.length > 0) {
|
|
1288
|
+
if(_1.arguments_[0].value_.EString) {
|
|
1289
|
+
const url_ = _1.arguments_[0].value_.value_;
|
|
1290
|
+
if(_1.arguments_.length === 1) {
|
|
1293
1291
|
return ff_compiler_JsImporter.JsImporter_add(self_.jsImporter_, ff_core_String.String_replace(url_, "\"", ""))
|
|
1294
1292
|
return
|
|
1295
1293
|
}
|
|
@@ -1303,10 +1301,10 @@ return
|
|
|
1303
1301
|
if(_1.ECall) {
|
|
1304
1302
|
const at_ = _1.at_;
|
|
1305
1303
|
if(_1.target_.StaticCall) {
|
|
1306
|
-
if(_1.target_.name_
|
|
1307
|
-
if(_1.arguments_.
|
|
1308
|
-
const body_ = _1.arguments_.
|
|
1309
|
-
if(_1.arguments_.
|
|
1304
|
+
if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.await") {
|
|
1305
|
+
if(_1.arguments_.length > 0) {
|
|
1306
|
+
const body_ = _1.arguments_[0].value_;
|
|
1307
|
+
if(_1.arguments_.length === 1) {
|
|
1310
1308
|
const emittedBody_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, body_, async_);
|
|
1311
1309
|
if(async_) {
|
|
1312
1310
|
return (("(await " + emittedBody_) + "($task))")
|
|
@@ -1324,8 +1322,8 @@ return
|
|
|
1324
1322
|
if(_1.ECall) {
|
|
1325
1323
|
const at_ = _1.at_;
|
|
1326
1324
|
if(_1.target_.StaticCall) {
|
|
1327
|
-
if(_1.target_.name_
|
|
1328
|
-
if(_1.arguments_.
|
|
1325
|
+
if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.cancelled") {
|
|
1326
|
+
if(_1.arguments_.length === 0) {
|
|
1329
1327
|
if(async_) {
|
|
1330
1328
|
return "$task.controller.signal.aborted"
|
|
1331
1329
|
} else {
|
|
@@ -1341,8 +1339,8 @@ return
|
|
|
1341
1339
|
if(_1.ECall) {
|
|
1342
1340
|
const at_ = _1.at_;
|
|
1343
1341
|
if(_1.target_.StaticCall) {
|
|
1344
|
-
if(_1.target_.name_
|
|
1345
|
-
if(_1.arguments_.
|
|
1342
|
+
if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.throwIfCancelled") {
|
|
1343
|
+
if(_1.arguments_.length === 0) {
|
|
1346
1344
|
if(async_) {
|
|
1347
1345
|
return "((() => ff_core_Task.Task_throwIfAborted($task))())"
|
|
1348
1346
|
} else {
|
|
@@ -1358,16 +1356,16 @@ return
|
|
|
1358
1356
|
if(_1.ECall) {
|
|
1359
1357
|
const at_ = _1.at_;
|
|
1360
1358
|
if(_1.target_.StaticCall) {
|
|
1361
|
-
if(_1.target_.name_
|
|
1362
|
-
if(_1.arguments_.
|
|
1363
|
-
const left_ = _1.arguments_
|
|
1364
|
-
if(_1.arguments_.
|
|
1365
|
-
const right_ = _1.arguments_
|
|
1366
|
-
if(_1.arguments_.
|
|
1367
|
-
if(_1.dictionaries_.
|
|
1368
|
-
const typeName_ = _1.dictionaries_.
|
|
1369
|
-
if(_1.dictionaries_.
|
|
1370
|
-
if(_1.dictionaries_.
|
|
1359
|
+
if(_1.target_.name_ === "ff:core/Equal.equals") {
|
|
1360
|
+
if(_1.arguments_.length > 0) {
|
|
1361
|
+
const left_ = _1.arguments_[0];
|
|
1362
|
+
if(_1.arguments_.length > 1) {
|
|
1363
|
+
const right_ = _1.arguments_[1];
|
|
1364
|
+
if(_1.arguments_.length === 2) {
|
|
1365
|
+
if(_1.dictionaries_.length > 0) {
|
|
1366
|
+
const typeName_ = _1.dictionaries_[0].typeName_;
|
|
1367
|
+
if(_1.dictionaries_[0].dictionaries_.length === 0) {
|
|
1368
|
+
if(_1.dictionaries_.length === 1) {
|
|
1371
1369
|
const _guard1 = (ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || (typeName_ === "ff:core/Ordering.Ordering"));
|
|
1372
1370
|
if(_guard1) {
|
|
1373
1371
|
return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " === ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
|
|
@@ -1387,16 +1385,16 @@ return
|
|
|
1387
1385
|
if(_1.ECall) {
|
|
1388
1386
|
const at_ = _1.at_;
|
|
1389
1387
|
if(_1.target_.StaticCall) {
|
|
1390
|
-
if(_1.target_.name_
|
|
1391
|
-
if(_1.arguments_.
|
|
1392
|
-
const left_ = _1.arguments_
|
|
1393
|
-
if(_1.arguments_.
|
|
1394
|
-
const right_ = _1.arguments_
|
|
1395
|
-
if(_1.arguments_.
|
|
1396
|
-
if(_1.dictionaries_.
|
|
1397
|
-
const typeName_ = _1.dictionaries_.
|
|
1398
|
-
if(_1.dictionaries_.
|
|
1399
|
-
if(_1.dictionaries_.
|
|
1388
|
+
if(_1.target_.name_ === "ff:core/Equal.notEquals") {
|
|
1389
|
+
if(_1.arguments_.length > 0) {
|
|
1390
|
+
const left_ = _1.arguments_[0];
|
|
1391
|
+
if(_1.arguments_.length > 1) {
|
|
1392
|
+
const right_ = _1.arguments_[1];
|
|
1393
|
+
if(_1.arguments_.length === 2) {
|
|
1394
|
+
if(_1.dictionaries_.length > 0) {
|
|
1395
|
+
const typeName_ = _1.dictionaries_[0].typeName_;
|
|
1396
|
+
if(_1.dictionaries_[0].dictionaries_.length === 0) {
|
|
1397
|
+
if(_1.dictionaries_.length === 1) {
|
|
1400
1398
|
const _guard1 = (ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || (typeName_ === "ff:core/Ordering.Ordering"));
|
|
1401
1399
|
if(_guard1) {
|
|
1402
1400
|
return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " !== ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
|
|
@@ -1416,16 +1414,16 @@ return
|
|
|
1416
1414
|
if(_1.ECall) {
|
|
1417
1415
|
const at_ = _1.at_;
|
|
1418
1416
|
if(_1.target_.StaticCall) {
|
|
1419
|
-
if(_1.target_.name_
|
|
1420
|
-
if(_1.arguments_.
|
|
1421
|
-
const left_ = _1.arguments_
|
|
1422
|
-
if(_1.arguments_.
|
|
1423
|
-
const right_ = _1.arguments_
|
|
1424
|
-
if(_1.arguments_.
|
|
1425
|
-
if(_1.dictionaries_.
|
|
1426
|
-
const typeName_ = _1.dictionaries_.
|
|
1427
|
-
if(_1.dictionaries_.
|
|
1428
|
-
if(_1.dictionaries_.
|
|
1417
|
+
if(_1.target_.name_ === "ff:core/Ordering.before") {
|
|
1418
|
+
if(_1.arguments_.length > 0) {
|
|
1419
|
+
const left_ = _1.arguments_[0];
|
|
1420
|
+
if(_1.arguments_.length > 1) {
|
|
1421
|
+
const right_ = _1.arguments_[1];
|
|
1422
|
+
if(_1.arguments_.length === 2) {
|
|
1423
|
+
if(_1.dictionaries_.length > 0) {
|
|
1424
|
+
const typeName_ = _1.dictionaries_[0].typeName_;
|
|
1425
|
+
if(_1.dictionaries_[0].dictionaries_.length === 0) {
|
|
1426
|
+
if(_1.dictionaries_.length === 1) {
|
|
1429
1427
|
const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
1430
1428
|
if(_guard1) {
|
|
1431
1429
|
return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " < ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
|
|
@@ -1445,16 +1443,16 @@ return
|
|
|
1445
1443
|
if(_1.ECall) {
|
|
1446
1444
|
const at_ = _1.at_;
|
|
1447
1445
|
if(_1.target_.StaticCall) {
|
|
1448
|
-
if(_1.target_.name_
|
|
1449
|
-
if(_1.arguments_.
|
|
1450
|
-
const left_ = _1.arguments_
|
|
1451
|
-
if(_1.arguments_.
|
|
1452
|
-
const right_ = _1.arguments_
|
|
1453
|
-
if(_1.arguments_.
|
|
1454
|
-
if(_1.dictionaries_.
|
|
1455
|
-
const typeName_ = _1.dictionaries_.
|
|
1456
|
-
if(_1.dictionaries_.
|
|
1457
|
-
if(_1.dictionaries_.
|
|
1446
|
+
if(_1.target_.name_ === "ff:core/Ordering.notBefore") {
|
|
1447
|
+
if(_1.arguments_.length > 0) {
|
|
1448
|
+
const left_ = _1.arguments_[0];
|
|
1449
|
+
if(_1.arguments_.length > 1) {
|
|
1450
|
+
const right_ = _1.arguments_[1];
|
|
1451
|
+
if(_1.arguments_.length === 2) {
|
|
1452
|
+
if(_1.dictionaries_.length > 0) {
|
|
1453
|
+
const typeName_ = _1.dictionaries_[0].typeName_;
|
|
1454
|
+
if(_1.dictionaries_[0].dictionaries_.length === 0) {
|
|
1455
|
+
if(_1.dictionaries_.length === 1) {
|
|
1458
1456
|
const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
1459
1457
|
if(_guard1) {
|
|
1460
1458
|
return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " >= ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
|
|
@@ -1474,16 +1472,16 @@ return
|
|
|
1474
1472
|
if(_1.ECall) {
|
|
1475
1473
|
const at_ = _1.at_;
|
|
1476
1474
|
if(_1.target_.StaticCall) {
|
|
1477
|
-
if(_1.target_.name_
|
|
1478
|
-
if(_1.arguments_.
|
|
1479
|
-
const left_ = _1.arguments_
|
|
1480
|
-
if(_1.arguments_.
|
|
1481
|
-
const right_ = _1.arguments_
|
|
1482
|
-
if(_1.arguments_.
|
|
1483
|
-
if(_1.dictionaries_.
|
|
1484
|
-
const typeName_ = _1.dictionaries_.
|
|
1485
|
-
if(_1.dictionaries_.
|
|
1486
|
-
if(_1.dictionaries_.
|
|
1475
|
+
if(_1.target_.name_ === "ff:core/Ordering.after") {
|
|
1476
|
+
if(_1.arguments_.length > 0) {
|
|
1477
|
+
const left_ = _1.arguments_[0];
|
|
1478
|
+
if(_1.arguments_.length > 1) {
|
|
1479
|
+
const right_ = _1.arguments_[1];
|
|
1480
|
+
if(_1.arguments_.length === 2) {
|
|
1481
|
+
if(_1.dictionaries_.length > 0) {
|
|
1482
|
+
const typeName_ = _1.dictionaries_[0].typeName_;
|
|
1483
|
+
if(_1.dictionaries_[0].dictionaries_.length === 0) {
|
|
1484
|
+
if(_1.dictionaries_.length === 1) {
|
|
1487
1485
|
const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
1488
1486
|
if(_guard1) {
|
|
1489
1487
|
return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " > ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
|
|
@@ -1503,16 +1501,16 @@ return
|
|
|
1503
1501
|
if(_1.ECall) {
|
|
1504
1502
|
const at_ = _1.at_;
|
|
1505
1503
|
if(_1.target_.StaticCall) {
|
|
1506
|
-
if(_1.target_.name_
|
|
1507
|
-
if(_1.arguments_.
|
|
1508
|
-
const left_ = _1.arguments_
|
|
1509
|
-
if(_1.arguments_.
|
|
1510
|
-
const right_ = _1.arguments_
|
|
1511
|
-
if(_1.arguments_.
|
|
1512
|
-
if(_1.dictionaries_.
|
|
1513
|
-
const typeName_ = _1.dictionaries_.
|
|
1514
|
-
if(_1.dictionaries_.
|
|
1515
|
-
if(_1.dictionaries_.
|
|
1504
|
+
if(_1.target_.name_ === "ff:core/Ordering.notAfter") {
|
|
1505
|
+
if(_1.arguments_.length > 0) {
|
|
1506
|
+
const left_ = _1.arguments_[0];
|
|
1507
|
+
if(_1.arguments_.length > 1) {
|
|
1508
|
+
const right_ = _1.arguments_[1];
|
|
1509
|
+
if(_1.arguments_.length === 2) {
|
|
1510
|
+
if(_1.dictionaries_.length > 0) {
|
|
1511
|
+
const typeName_ = _1.dictionaries_[0].typeName_;
|
|
1512
|
+
if(_1.dictionaries_[0].dictionaries_.length === 0) {
|
|
1513
|
+
if(_1.dictionaries_.length === 1) {
|
|
1516
1514
|
const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
1517
1515
|
if(_guard1) {
|
|
1518
1516
|
return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, left_, async_)) + " <= ") + ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, right_, async_)) + ")")
|
|
@@ -1531,24 +1529,24 @@ return
|
|
|
1531
1529
|
{
|
|
1532
1530
|
if(_1.ECall) {
|
|
1533
1531
|
if(_1.target_.StaticCall) {
|
|
1534
|
-
if(_1.target_.name_
|
|
1532
|
+
if(_1.target_.name_ === "ff:core/List.fillBy") {
|
|
1535
1533
|
const effect_ = _1.effect_;
|
|
1536
|
-
if(_1.arguments_.
|
|
1537
|
-
const size_ = _1.arguments_
|
|
1538
|
-
if(_1.arguments_.
|
|
1539
|
-
if(_1.arguments_.
|
|
1540
|
-
const at_ = _1.arguments_.
|
|
1541
|
-
const l_ = _1.arguments_.
|
|
1542
|
-
if(_1.arguments_.
|
|
1543
|
-
const c_ = _1.arguments_.
|
|
1544
|
-
if(_1.arguments_.
|
|
1545
|
-
if(_1.arguments_.
|
|
1546
|
-
const name_ = _1.arguments_.
|
|
1547
|
-
if(_1.arguments_.
|
|
1548
|
-
if(_1.arguments_.
|
|
1549
|
-
const body_ = _1.arguments_.
|
|
1550
|
-
if(_1.arguments_.
|
|
1551
|
-
if(_1.arguments_.
|
|
1534
|
+
if(_1.arguments_.length > 0) {
|
|
1535
|
+
const size_ = _1.arguments_[0];
|
|
1536
|
+
if(_1.arguments_.length > 1) {
|
|
1537
|
+
if(_1.arguments_[1].value_.ELambda) {
|
|
1538
|
+
const at_ = _1.arguments_[1].value_.at_;
|
|
1539
|
+
const l_ = _1.arguments_[1].value_.lambda_;
|
|
1540
|
+
if(_1.arguments_[1].value_.lambda_.cases_.length > 0) {
|
|
1541
|
+
const c_ = _1.arguments_[1].value_.lambda_.cases_[0];
|
|
1542
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length > 0) {
|
|
1543
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_[0].PVariable) {
|
|
1544
|
+
const name_ = _1.arguments_[1].value_.lambda_.cases_[0].patterns_[0].name_;
|
|
1545
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 1) {
|
|
1546
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
|
|
1547
|
+
const body_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
|
|
1548
|
+
if(_1.arguments_[1].value_.lambda_.cases_.length === 1) {
|
|
1549
|
+
if(_1.arguments_.length === 2) {
|
|
1552
1550
|
const _guard1 = (!ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
|
|
1553
1551
|
if(_guard1) {
|
|
1554
1552
|
const n_ = ff_core_Option.Option_else(ff_core_Option.Option_map(name_, ((_w1) => {
|
|
@@ -1603,9 +1601,9 @@ const emittedArguments_ = ff_core_List.List_map(arguments_, ((_w1) => {
|
|
|
1603
1601
|
return ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, _w1, async_)
|
|
1604
1602
|
}));
|
|
1605
1603
|
const controller_ = (await_
|
|
1606
|
-
?
|
|
1607
|
-
:
|
|
1608
|
-
const call_ = (((((d_ + ".") + n_) + "(") + ff_core_List.List_join(
|
|
1604
|
+
? ["$task"]
|
|
1605
|
+
: []);
|
|
1606
|
+
const call_ = (((((d_ + ".") + n_) + "(") + ff_core_List.List_join([...emittedArguments_, ...ds_, ...controller_], ", ")) + ")");
|
|
1609
1607
|
if(await_) {
|
|
1610
1608
|
return (("(await " + call_) + ")")
|
|
1611
1609
|
} else {
|
|
@@ -1625,10 +1623,18 @@ const effect_ = _1.effect_;
|
|
|
1625
1623
|
const typeArguments_ = _1.typeArguments_;
|
|
1626
1624
|
const arguments_ = _1.arguments_;
|
|
1627
1625
|
const dictionaries_ = _1.dictionaries_;
|
|
1626
|
+
if(ff_core_String.String_contains(name_, "bundleForBrowser")) {
|
|
1627
|
+
if((!ff_core_Option.Option_contains(ff_core_List.List_grab(arguments_, 0).name_, "system", ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
|
|
1628
|
+
ff_core_Log.debug_(("Wrong arguments for bundleForBrowser: " + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String)).show_(ff_core_List.List_map(arguments_, ((_w1) => {
|
|
1629
|
+
return _w1.name_
|
|
1630
|
+
})))));
|
|
1631
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.GrabException(), ff_core_Core.ff_core_Any_HasAnyTag$ff_core_Core_GrabException)})
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1628
1634
|
{
|
|
1629
1635
|
const _1 = ff_compiler_JsEmitter.detectIfElse_(term_);
|
|
1630
1636
|
{
|
|
1631
|
-
if(_1.
|
|
1637
|
+
if(_1.length === 0) {
|
|
1632
1638
|
const await_ = (async_ && ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
|
|
1633
1639
|
const ds_ = ff_core_List.List_map(dictionaries_, ((_w1) => {
|
|
1634
1640
|
return ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, _w1)
|
|
@@ -1640,9 +1646,9 @@ const emittedArguments_ = ff_core_List.List_map(arguments_, ((_w1) => {
|
|
|
1640
1646
|
return ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, _w1, async_)
|
|
1641
1647
|
}));
|
|
1642
1648
|
const controller_ = (await_
|
|
1643
|
-
?
|
|
1644
|
-
:
|
|
1645
|
-
const call_ = (((functionCode_ + "(") + ff_core_List.List_join(
|
|
1649
|
+
? ["$task"]
|
|
1650
|
+
: []);
|
|
1651
|
+
const call_ = (((functionCode_ + "(") + ff_core_List.List_join([...emittedArguments_, ...ds_, ...controller_], ", ")) + ")");
|
|
1646
1652
|
if(await_) {
|
|
1647
1653
|
return (("(await " + call_) + ")")
|
|
1648
1654
|
} else {
|
|
@@ -1652,11 +1658,11 @@ return
|
|
|
1652
1658
|
}
|
|
1653
1659
|
}
|
|
1654
1660
|
{
|
|
1655
|
-
if(_1.
|
|
1656
|
-
if(_1.
|
|
1657
|
-
if(_1.
|
|
1658
|
-
const elseBody_ = _1.
|
|
1659
|
-
const list_ = _1.
|
|
1661
|
+
if(_1.length > 0) {
|
|
1662
|
+
if(_1[0].first_.EVariant) {
|
|
1663
|
+
if(_1[0].first_.name_ === "ff:core/Bool.True") {
|
|
1664
|
+
const elseBody_ = _1[0].second_;
|
|
1665
|
+
const list_ = _1.slice(1);
|
|
1660
1666
|
return (("(" + ff_core_List.List_foldLeft(list_, ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, elseBody_, async_), ((_1, _2) => {
|
|
1661
1667
|
{
|
|
1662
1668
|
const otherwise_ = _1;
|
|
@@ -1707,9 +1713,9 @@ const emittedArguments_ = ff_core_List.List_map(arguments_, ((_w1) => {
|
|
|
1707
1713
|
return ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, _w1, async_)
|
|
1708
1714
|
}));
|
|
1709
1715
|
const controller_ = (await_
|
|
1710
|
-
?
|
|
1711
|
-
:
|
|
1712
|
-
const call_ = (((functionCode_ + "(") + ff_core_List.List_join(
|
|
1716
|
+
? ["$task"]
|
|
1717
|
+
: []);
|
|
1718
|
+
const call_ = (((functionCode_ + "(") + ff_core_List.List_join([...emittedArguments_, ...controller_], ", ")) + ")");
|
|
1713
1719
|
if(await_) {
|
|
1714
1720
|
return (("(await " + call_) + ")")
|
|
1715
1721
|
} else {
|
|
@@ -1804,7 +1810,7 @@ return
|
|
|
1804
1810
|
{
|
|
1805
1811
|
if(_1.EVariant) {
|
|
1806
1812
|
const at_ = _1.at_;
|
|
1807
|
-
if(_1.name_
|
|
1813
|
+
if(_1.name_ === "ff:core/Unit.Unit") {
|
|
1808
1814
|
return ""
|
|
1809
1815
|
return
|
|
1810
1816
|
}
|
|
@@ -1815,7 +1821,7 @@ if(_1.ESequential) {
|
|
|
1815
1821
|
const at_ = _1.at_;
|
|
1816
1822
|
if(_1.before_.EVariant) {
|
|
1817
1823
|
const at_ = _1.before_.at_;
|
|
1818
|
-
if(_1.before_.name_
|
|
1824
|
+
if(_1.before_.name_ === "ff:core/Unit.Unit") {
|
|
1819
1825
|
const after_ = _1.after_;
|
|
1820
1826
|
return ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, after_, last_, async_)
|
|
1821
1827
|
return
|
|
@@ -1829,7 +1835,7 @@ const at_ = _1.at_;
|
|
|
1829
1835
|
const before_ = _1.before_;
|
|
1830
1836
|
if(_1.after_.EVariant) {
|
|
1831
1837
|
const at_ = _1.after_.at_;
|
|
1832
|
-
if(_1.after_.name_
|
|
1838
|
+
if(_1.after_.name_ === "ff:core/Unit.Unit") {
|
|
1833
1839
|
return ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, before_, false, async_)
|
|
1834
1840
|
return
|
|
1835
1841
|
}
|
|
@@ -1870,12 +1876,12 @@ return
|
|
|
1870
1876
|
if(_1.ECall) {
|
|
1871
1877
|
const at_ = _1.at_;
|
|
1872
1878
|
if(_1.target_.StaticCall) {
|
|
1873
|
-
if(_1.target_.name_
|
|
1874
|
-
if(_1.arguments_.
|
|
1875
|
-
const condition_ = _1.arguments_
|
|
1876
|
-
if(_1.arguments_.
|
|
1877
|
-
const body_ = _1.arguments_
|
|
1878
|
-
if(_1.arguments_.
|
|
1879
|
+
if(_1.target_.name_ === "ff:core/Core.while") {
|
|
1880
|
+
if(_1.arguments_.length > 0) {
|
|
1881
|
+
const condition_ = _1.arguments_[0];
|
|
1882
|
+
if(_1.arguments_.length > 1) {
|
|
1883
|
+
const body_ = _1.arguments_[1];
|
|
1884
|
+
if(_1.arguments_.length === 2) {
|
|
1879
1885
|
return (((("while(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, ff_compiler_JsEmitter.invokeImmediately_(condition_.value_), async_)) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_), false, async_)) + "\n}")
|
|
1880
1886
|
return
|
|
1881
1887
|
}
|
|
@@ -1889,10 +1895,10 @@ return
|
|
|
1889
1895
|
if(_1.ECall) {
|
|
1890
1896
|
const at_ = _1.at_;
|
|
1891
1897
|
if(_1.target_.StaticCall) {
|
|
1892
|
-
if(_1.target_.name_
|
|
1893
|
-
if(_1.arguments_.
|
|
1894
|
-
const doWhileBody_ = _1.arguments_.
|
|
1895
|
-
if(_1.arguments_.
|
|
1898
|
+
if(_1.target_.name_ === "ff:core/Core.doWhile") {
|
|
1899
|
+
if(_1.arguments_.length > 0) {
|
|
1900
|
+
const doWhileBody_ = _1.arguments_[0].value_;
|
|
1901
|
+
if(_1.arguments_.length === 1) {
|
|
1896
1902
|
const _guard1 = ff_compiler_JsEmitter.invokeImmediately_(doWhileBody_);
|
|
1897
1903
|
if(_guard1.ESequential) {
|
|
1898
1904
|
const body_ = _guard1.before_;
|
|
@@ -1910,10 +1916,10 @@ return
|
|
|
1910
1916
|
if(_1.ECall) {
|
|
1911
1917
|
const at_ = _1.at_;
|
|
1912
1918
|
if(_1.target_.StaticCall) {
|
|
1913
|
-
if(_1.target_.name_
|
|
1914
|
-
if(_1.arguments_.
|
|
1915
|
-
const doWhileBody_ = _1.arguments_.
|
|
1916
|
-
if(_1.arguments_.
|
|
1919
|
+
if(_1.target_.name_ === "ff:core/Core.doWhile") {
|
|
1920
|
+
if(_1.arguments_.length > 0) {
|
|
1921
|
+
const doWhileBody_ = _1.arguments_[0].value_;
|
|
1922
|
+
if(_1.arguments_.length === 1) {
|
|
1917
1923
|
const _guard1 = ff_compiler_JsEmitter.invokeImmediately_(doWhileBody_);
|
|
1918
1924
|
const body_ = _guard1;
|
|
1919
1925
|
return (("while(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, body_, async_)) + ") {}")
|
|
@@ -1928,12 +1934,12 @@ return
|
|
|
1928
1934
|
if(_1.ECall) {
|
|
1929
1935
|
const at_ = _1.at_;
|
|
1930
1936
|
if(_1.target_.StaticCall) {
|
|
1931
|
-
if(_1.target_.name_
|
|
1932
|
-
if(_1.arguments_.
|
|
1933
|
-
const condition_ = _1.arguments_
|
|
1934
|
-
if(_1.arguments_.
|
|
1935
|
-
const body_ = _1.arguments_
|
|
1936
|
-
if(_1.arguments_.
|
|
1937
|
+
if(_1.target_.name_ === "ff:core/Core.if") {
|
|
1938
|
+
if(_1.arguments_.length > 0) {
|
|
1939
|
+
const condition_ = _1.arguments_[0];
|
|
1940
|
+
if(_1.arguments_.length > 1) {
|
|
1941
|
+
const body_ = _1.arguments_[1];
|
|
1942
|
+
if(_1.arguments_.length === 2) {
|
|
1937
1943
|
return ((("if(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, condition_.value_, async_)) + ") {\n") + (last_
|
|
1938
1944
|
? (("return ff_core_Option.Some(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_), async_)) + ")\n} else return ff_core_Option.None()")
|
|
1939
1945
|
: (ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_), false, async_) + "\n}")))
|
|
@@ -1949,13 +1955,13 @@ return
|
|
|
1949
1955
|
if(_1.ECall) {
|
|
1950
1956
|
const at_ = _1.at_;
|
|
1951
1957
|
if(_1.target_.StaticCall) {
|
|
1952
|
-
if(_1.target_.name_
|
|
1953
|
-
if(_1.arguments_.
|
|
1954
|
-
const argument_ = _1.arguments_
|
|
1955
|
-
if(_1.arguments_.
|
|
1956
|
-
if(_1.dictionaries_.
|
|
1957
|
-
const dictionary_ = _1.dictionaries_
|
|
1958
|
-
if(_1.dictionaries_.
|
|
1958
|
+
if(_1.target_.name_ === "ff:core/Core.throw") {
|
|
1959
|
+
if(_1.arguments_.length > 0) {
|
|
1960
|
+
const argument_ = _1.arguments_[0];
|
|
1961
|
+
if(_1.arguments_.length === 1) {
|
|
1962
|
+
if(_1.dictionaries_.length > 0) {
|
|
1963
|
+
const dictionary_ = _1.dictionaries_[0];
|
|
1964
|
+
if(_1.dictionaries_.length === 1) {
|
|
1959
1965
|
const d_ = ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, dictionary_);
|
|
1960
1966
|
const a_ = ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, argument_, async_);
|
|
1961
1967
|
return (((("throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(" + a_) + ", ") + d_) + ")})")
|
|
@@ -1972,7 +1978,7 @@ return
|
|
|
1972
1978
|
if(_1.ECall) {
|
|
1973
1979
|
const at_ = _1.at_;
|
|
1974
1980
|
if(_1.target_.StaticCall) {
|
|
1975
|
-
if(_1.target_.name_
|
|
1981
|
+
if(_1.target_.name_ === "ff:core/Core.try") {
|
|
1976
1982
|
const _guard1 = (!last_);
|
|
1977
1983
|
if(_guard1) {
|
|
1978
1984
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a try without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -1986,7 +1992,7 @@ return
|
|
|
1986
1992
|
if(_1.ECall) {
|
|
1987
1993
|
const at_ = _1.at_;
|
|
1988
1994
|
if(_1.target_.StaticCall) {
|
|
1989
|
-
if(_1.target_.name_
|
|
1995
|
+
if(_1.target_.name_ === "ff:core/Try.Try_map") {
|
|
1990
1996
|
const _guard1 = (!last_);
|
|
1991
1997
|
if(_guard1) {
|
|
1992
1998
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a map without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -2000,7 +2006,7 @@ return
|
|
|
2000
2006
|
if(_1.ECall) {
|
|
2001
2007
|
const at_ = _1.at_;
|
|
2002
2008
|
if(_1.target_.StaticCall) {
|
|
2003
|
-
if(_1.target_.name_
|
|
2009
|
+
if(_1.target_.name_ === "ff:core/Try.Try_flatMap") {
|
|
2004
2010
|
const _guard1 = (!last_);
|
|
2005
2011
|
if(_guard1) {
|
|
2006
2012
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a flatMap without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -2014,7 +2020,7 @@ return
|
|
|
2014
2020
|
if(_1.ECall) {
|
|
2015
2021
|
const at_ = _1.at_;
|
|
2016
2022
|
if(_1.target_.StaticCall) {
|
|
2017
|
-
if(_1.target_.name_
|
|
2023
|
+
if(_1.target_.name_ === "ff:core/Try.Try_flatten") {
|
|
2018
2024
|
const _guard1 = (!last_);
|
|
2019
2025
|
if(_guard1) {
|
|
2020
2026
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a flatten without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -2028,7 +2034,7 @@ return
|
|
|
2028
2034
|
if(_1.ECall) {
|
|
2029
2035
|
const at_ = _1.at_;
|
|
2030
2036
|
if(_1.target_.StaticCall) {
|
|
2031
|
-
if(_1.target_.name_
|
|
2037
|
+
if(_1.target_.name_ === "ff:core/Try.Try_catch") {
|
|
2032
2038
|
const _guard1 = (!last_);
|
|
2033
2039
|
if(_guard1) {
|
|
2034
2040
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a catch without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -2042,7 +2048,7 @@ return
|
|
|
2042
2048
|
if(_1.ECall) {
|
|
2043
2049
|
const at_ = _1.at_;
|
|
2044
2050
|
if(_1.target_.StaticCall) {
|
|
2045
|
-
if(_1.target_.name_
|
|
2051
|
+
if(_1.target_.name_ === "ff:core/Try.Try_catchAny") {
|
|
2046
2052
|
const _guard1 = (!last_);
|
|
2047
2053
|
if(_guard1) {
|
|
2048
2054
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a catchAny without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -2056,7 +2062,7 @@ return
|
|
|
2056
2062
|
if(_1.ECall) {
|
|
2057
2063
|
const at_ = _1.at_;
|
|
2058
2064
|
if(_1.target_.StaticCall) {
|
|
2059
|
-
if(_1.target_.name_
|
|
2065
|
+
if(_1.target_.name_ === "ff:core/Try.Try_finally") {
|
|
2060
2066
|
const _guard1 = (!last_);
|
|
2061
2067
|
if(_guard1) {
|
|
2062
2068
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a finally without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -2070,10 +2076,10 @@ return
|
|
|
2070
2076
|
if(_1.ECall) {
|
|
2071
2077
|
const at_ = _1.at_;
|
|
2072
2078
|
if(_1.target_.StaticCall) {
|
|
2073
|
-
if(_1.target_.name_
|
|
2074
|
-
if(_1.arguments_.
|
|
2075
|
-
const argument_ = _1.arguments_
|
|
2076
|
-
if(_1.arguments_.
|
|
2079
|
+
if(_1.target_.name_ === "ff:core/Try.Try_grab") {
|
|
2080
|
+
if(_1.arguments_.length > 0) {
|
|
2081
|
+
const argument_ = _1.arguments_[0];
|
|
2082
|
+
if(_1.arguments_.length === 1) {
|
|
2077
2083
|
const _guard1 = ff_compiler_JsEmitter.JsEmitter_emitTryCatchFinally(self_, argument_.value_, last_, async_);
|
|
2078
2084
|
if(_guard1.Some) {
|
|
2079
2085
|
const code_ = _guard1.value_;
|
|
@@ -2090,8 +2096,8 @@ return
|
|
|
2090
2096
|
if(_1.ECall) {
|
|
2091
2097
|
const at_ = _1.at_;
|
|
2092
2098
|
if(_1.target_.StaticCall) {
|
|
2093
|
-
if(_1.target_.name_
|
|
2094
|
-
if(_1.arguments_.
|
|
2099
|
+
if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.throwIfCancelled") {
|
|
2100
|
+
if(_1.arguments_.length === 0) {
|
|
2095
2101
|
if(async_) {
|
|
2096
2102
|
return "ff_core_Task.Task_throwIfAborted($task)"
|
|
2097
2103
|
} else {
|
|
@@ -2137,7 +2143,7 @@ ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
|
|
|
2137
2143
|
return ((((((((!last_)
|
|
2138
2144
|
? "do "
|
|
2139
2145
|
: "") + "{\nconst _1 = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, value_, async_)) + ";\n") + ff_core_List.List_join(ff_core_List.List_map(cases_, ((_w1) => {
|
|
2140
|
-
return (("{\n" + ff_compiler_JsEmitter.JsEmitter_emitCase(self_,
|
|
2146
|
+
return (("{\n" + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, ["_1"], _w1, true, last_, async_)) + "\n}")
|
|
2141
2147
|
})), "\n")) + "\n}") + ((!last_)
|
|
2142
2148
|
? " while(false)"
|
|
2143
2149
|
: ""))
|
|
@@ -2149,7 +2155,7 @@ return
|
|
|
2149
2155
|
{
|
|
2150
2156
|
const _1 = ff_compiler_JsEmitter.detectIfElse_(term_);
|
|
2151
2157
|
{
|
|
2152
|
-
if(_1.
|
|
2158
|
+
if(_1.length === 0) {
|
|
2153
2159
|
if(last_) {
|
|
2154
2160
|
return ("return " + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, term_, async_))
|
|
2155
2161
|
} else {
|
|
@@ -2159,11 +2165,11 @@ return
|
|
|
2159
2165
|
}
|
|
2160
2166
|
}
|
|
2161
2167
|
{
|
|
2162
|
-
if(_1.
|
|
2163
|
-
if(_1.
|
|
2164
|
-
if(_1.
|
|
2165
|
-
const elseBody_ = _1.
|
|
2166
|
-
const list_ = _1.
|
|
2168
|
+
if(_1.length > 0) {
|
|
2169
|
+
if(_1[0].first_.EVariant) {
|
|
2170
|
+
if(_1[0].first_.name_ === "ff:core/Bool.True") {
|
|
2171
|
+
const elseBody_ = _1[0].second_;
|
|
2172
|
+
const list_ = _1.slice(1);
|
|
2167
2173
|
const initial_ = (("{\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, elseBody_, last_, async_)) + "\n}");
|
|
2168
2174
|
return ff_core_List.List_foldLeft(list_, initial_, ((_1, _2) => {
|
|
2169
2175
|
{
|
|
@@ -2218,13 +2224,13 @@ export function JsEmitter_emitTryCatchFinally(self_, term_, last_, async_) {
|
|
|
2218
2224
|
function emitCatch_(catchEffect_, cases_) {
|
|
2219
2225
|
const catchAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(catchEffect_));
|
|
2220
2226
|
ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
|
|
2221
|
-
const arguments_ =
|
|
2227
|
+
const arguments_ = ["_exception.value_", "_error"];
|
|
2222
2228
|
{
|
|
2223
2229
|
const _1 = cases_;
|
|
2224
2230
|
{
|
|
2225
|
-
if(_1.
|
|
2226
|
-
const case_ = _1
|
|
2227
|
-
if(_1.
|
|
2231
|
+
if(_1.length > 0) {
|
|
2232
|
+
const case_ = _1[0];
|
|
2233
|
+
if(_1.length === 1) {
|
|
2228
2234
|
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, case_, false, last_, catchAsync_)
|
|
2229
2235
|
return
|
|
2230
2236
|
}
|
|
@@ -2250,30 +2256,30 @@ const _1 = term_;
|
|
|
2250
2256
|
if(_1.ECall) {
|
|
2251
2257
|
const at_ = _1.at_;
|
|
2252
2258
|
if(_1.target_.StaticCall) {
|
|
2253
|
-
if(_1.target_.name_
|
|
2254
|
-
if(_1.arguments_.
|
|
2255
|
-
if(_1.arguments_.
|
|
2256
|
-
const at_ = _1.arguments_.
|
|
2257
|
-
if(_1.arguments_.
|
|
2258
|
-
if(_1.arguments_.
|
|
2259
|
-
if(_1.arguments_.
|
|
2260
|
-
if(_1.arguments_.
|
|
2261
|
-
const tryEffect_ = _1.arguments_.
|
|
2262
|
-
if(_1.arguments_.
|
|
2263
|
-
if(_1.arguments_.
|
|
2264
|
-
if(_1.arguments_.
|
|
2265
|
-
const tryBody_ = _1.arguments_.
|
|
2266
|
-
if(_1.arguments_.
|
|
2267
|
-
if(_1.arguments_.
|
|
2268
|
-
if(_1.arguments_.
|
|
2269
|
-
if(_1.arguments_.
|
|
2270
|
-
const finallyEffect_ = _1.arguments_.
|
|
2271
|
-
if(_1.arguments_.
|
|
2272
|
-
if(_1.arguments_.
|
|
2273
|
-
if(_1.arguments_.
|
|
2274
|
-
const finallyBody_ = _1.arguments_.
|
|
2275
|
-
if(_1.arguments_.
|
|
2276
|
-
if(_1.arguments_.
|
|
2259
|
+
if(_1.target_.name_ === "ff:core/Try.Try_finally") {
|
|
2260
|
+
if(_1.arguments_.length > 0) {
|
|
2261
|
+
if(_1.arguments_[0].value_.ECall) {
|
|
2262
|
+
const at_ = _1.arguments_[0].value_.at_;
|
|
2263
|
+
if(_1.arguments_[0].value_.target_.StaticCall) {
|
|
2264
|
+
if(_1.arguments_[0].value_.target_.name_ === "ff:core/Core.try") {
|
|
2265
|
+
if(_1.arguments_[0].value_.arguments_.length > 0) {
|
|
2266
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.ELambda) {
|
|
2267
|
+
const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
|
|
2268
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length > 0) {
|
|
2269
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0) {
|
|
2270
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0) {
|
|
2271
|
+
const tryBody_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].body_;
|
|
2272
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1) {
|
|
2273
|
+
if(_1.arguments_[0].value_.arguments_.length === 1) {
|
|
2274
|
+
if(_1.arguments_.length > 1) {
|
|
2275
|
+
if(_1.arguments_[1].value_.ELambda) {
|
|
2276
|
+
const finallyEffect_ = _1.arguments_[1].value_.lambda_.effect_;
|
|
2277
|
+
if(_1.arguments_[1].value_.lambda_.cases_.length > 0) {
|
|
2278
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 0) {
|
|
2279
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
|
|
2280
|
+
const finallyBody_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
|
|
2281
|
+
if(_1.arguments_[1].value_.lambda_.cases_.length === 1) {
|
|
2282
|
+
if(_1.arguments_.length === 2) {
|
|
2277
2283
|
const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
|
|
2278
2284
|
const finallyAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(finallyEffect_));
|
|
2279
2285
|
return ff_core_Option.Some((((("try {\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, tryBody_, last_, tryAsync_)) + "\n} finally {\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, finallyBody_, last_, finallyAsync_)) + "\n}"))
|
|
@@ -2304,29 +2310,29 @@ return
|
|
|
2304
2310
|
if(_1.ECall) {
|
|
2305
2311
|
const at_ = _1.at_;
|
|
2306
2312
|
if(_1.target_.StaticCall) {
|
|
2307
|
-
if(_1.target_.name_
|
|
2308
|
-
if(_1.arguments_.
|
|
2309
|
-
if(_1.arguments_.
|
|
2310
|
-
const at_ = _1.arguments_.
|
|
2311
|
-
if(_1.arguments_.
|
|
2312
|
-
if(_1.arguments_.
|
|
2313
|
-
if(_1.arguments_.
|
|
2314
|
-
if(_1.arguments_.
|
|
2315
|
-
const tryEffect_ = _1.arguments_.
|
|
2316
|
-
if(_1.arguments_.
|
|
2317
|
-
if(_1.arguments_.
|
|
2318
|
-
if(_1.arguments_.
|
|
2319
|
-
const tryBody_ = _1.arguments_.
|
|
2320
|
-
if(_1.arguments_.
|
|
2321
|
-
if(_1.arguments_.
|
|
2322
|
-
if(_1.arguments_.
|
|
2323
|
-
if(_1.arguments_.
|
|
2324
|
-
const catchEffect_ = _1.arguments_.
|
|
2325
|
-
const cases_ = _1.arguments_.
|
|
2326
|
-
if(_1.arguments_.
|
|
2327
|
-
if(_1.dictionaries_.
|
|
2328
|
-
const dictionary_ = _1.dictionaries_
|
|
2329
|
-
if(_1.dictionaries_.
|
|
2313
|
+
if(_1.target_.name_ === "ff:core/Try.Try_catch") {
|
|
2314
|
+
if(_1.arguments_.length > 0) {
|
|
2315
|
+
if(_1.arguments_[0].value_.ECall) {
|
|
2316
|
+
const at_ = _1.arguments_[0].value_.at_;
|
|
2317
|
+
if(_1.arguments_[0].value_.target_.StaticCall) {
|
|
2318
|
+
if(_1.arguments_[0].value_.target_.name_ === "ff:core/Core.try") {
|
|
2319
|
+
if(_1.arguments_[0].value_.arguments_.length > 0) {
|
|
2320
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.ELambda) {
|
|
2321
|
+
const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
|
|
2322
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length > 0) {
|
|
2323
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0) {
|
|
2324
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0) {
|
|
2325
|
+
const tryBody_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].body_;
|
|
2326
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1) {
|
|
2327
|
+
if(_1.arguments_[0].value_.arguments_.length === 1) {
|
|
2328
|
+
if(_1.arguments_.length > 1) {
|
|
2329
|
+
if(_1.arguments_[1].value_.ELambda) {
|
|
2330
|
+
const catchEffect_ = _1.arguments_[1].value_.lambda_.effect_;
|
|
2331
|
+
const cases_ = _1.arguments_[1].value_.lambda_.cases_;
|
|
2332
|
+
if(_1.arguments_.length === 2) {
|
|
2333
|
+
if(_1.dictionaries_.length > 0) {
|
|
2334
|
+
const dictionary_ = _1.dictionaries_[0];
|
|
2335
|
+
if(_1.dictionaries_.length === 1) {
|
|
2330
2336
|
const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
|
|
2331
2337
|
const d_ = ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, dictionary_);
|
|
2332
2338
|
return ff_core_Option.Some(((((((((("try {\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, tryBody_, last_, tryAsync_)) + "\n} catch(_error) {\n") + "if(!_error.ffException) throw _error\n") + "const _exception = ff_core_Any.fromAny_(_error.ffException, ") + d_) + ")\n") + "if(!_exception.Some) throw _error\n") + emitCatch_(catchEffect_, cases_)) + "\n}"))
|
|
@@ -2355,43 +2361,43 @@ return
|
|
|
2355
2361
|
if(_1.ECall) {
|
|
2356
2362
|
const at_ = _1.at_;
|
|
2357
2363
|
if(_1.target_.StaticCall) {
|
|
2358
|
-
if(_1.target_.name_
|
|
2359
|
-
if(_1.arguments_.
|
|
2360
|
-
if(_1.arguments_.
|
|
2361
|
-
const at_ = _1.arguments_.
|
|
2362
|
-
if(_1.arguments_.
|
|
2363
|
-
if(_1.arguments_.
|
|
2364
|
-
if(_1.arguments_.
|
|
2365
|
-
if(_1.arguments_.
|
|
2366
|
-
const at_ = _1.arguments_.
|
|
2367
|
-
if(_1.arguments_.
|
|
2368
|
-
if(_1.arguments_.
|
|
2369
|
-
if(_1.arguments_.
|
|
2370
|
-
if(_1.arguments_.
|
|
2371
|
-
const tryEffect_ = _1.arguments_.
|
|
2372
|
-
if(_1.arguments_.
|
|
2373
|
-
if(_1.arguments_.
|
|
2374
|
-
if(_1.arguments_.
|
|
2375
|
-
const tryBody_ = _1.arguments_.
|
|
2376
|
-
if(_1.arguments_.
|
|
2377
|
-
if(_1.arguments_.
|
|
2378
|
-
if(_1.arguments_.
|
|
2379
|
-
if(_1.arguments_.
|
|
2380
|
-
const catchEffect_ = _1.arguments_.
|
|
2381
|
-
const cases_ = _1.arguments_.
|
|
2382
|
-
if(_1.arguments_.
|
|
2383
|
-
if(_1.arguments_.
|
|
2384
|
-
const dictionary_ = _1.arguments_.
|
|
2385
|
-
if(_1.arguments_.
|
|
2386
|
-
if(_1.arguments_.
|
|
2387
|
-
if(_1.arguments_.
|
|
2388
|
-
const finallyEffect_ = _1.arguments_.
|
|
2389
|
-
if(_1.arguments_.
|
|
2390
|
-
if(_1.arguments_.
|
|
2391
|
-
if(_1.arguments_.
|
|
2392
|
-
const finallyBody_ = _1.arguments_.
|
|
2393
|
-
if(_1.arguments_.
|
|
2394
|
-
if(_1.arguments_.
|
|
2364
|
+
if(_1.target_.name_ === "ff:core/Try.Try_finally") {
|
|
2365
|
+
if(_1.arguments_.length > 0) {
|
|
2366
|
+
if(_1.arguments_[0].value_.ECall) {
|
|
2367
|
+
const at_ = _1.arguments_[0].value_.at_;
|
|
2368
|
+
if(_1.arguments_[0].value_.target_.StaticCall) {
|
|
2369
|
+
if(_1.arguments_[0].value_.target_.name_ === "ff:core/Try.Try_catch") {
|
|
2370
|
+
if(_1.arguments_[0].value_.arguments_.length > 0) {
|
|
2371
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.ECall) {
|
|
2372
|
+
const at_ = _1.arguments_[0].value_.arguments_[0].value_.at_;
|
|
2373
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.target_.StaticCall) {
|
|
2374
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.target_.name_ === "ff:core/Core.try") {
|
|
2375
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_.length > 0) {
|
|
2376
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.ELambda) {
|
|
2377
|
+
const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
|
|
2378
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length > 0) {
|
|
2379
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0) {
|
|
2380
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0) {
|
|
2381
|
+
const tryBody_ = _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].body_;
|
|
2382
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1) {
|
|
2383
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_.length === 1) {
|
|
2384
|
+
if(_1.arguments_[0].value_.arguments_.length > 1) {
|
|
2385
|
+
if(_1.arguments_[0].value_.arguments_[1].value_.ELambda) {
|
|
2386
|
+
const catchEffect_ = _1.arguments_[0].value_.arguments_[1].value_.lambda_.effect_;
|
|
2387
|
+
const cases_ = _1.arguments_[0].value_.arguments_[1].value_.lambda_.cases_;
|
|
2388
|
+
if(_1.arguments_[0].value_.arguments_.length === 2) {
|
|
2389
|
+
if(_1.arguments_[0].value_.dictionaries_.length > 0) {
|
|
2390
|
+
const dictionary_ = _1.arguments_[0].value_.dictionaries_[0];
|
|
2391
|
+
if(_1.arguments_[0].value_.dictionaries_.length === 1) {
|
|
2392
|
+
if(_1.arguments_.length > 1) {
|
|
2393
|
+
if(_1.arguments_[1].value_.ELambda) {
|
|
2394
|
+
const finallyEffect_ = _1.arguments_[1].value_.lambda_.effect_;
|
|
2395
|
+
if(_1.arguments_[1].value_.lambda_.cases_.length > 0) {
|
|
2396
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 0) {
|
|
2397
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
|
|
2398
|
+
const finallyBody_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
|
|
2399
|
+
if(_1.arguments_[1].value_.lambda_.cases_.length === 1) {
|
|
2400
|
+
if(_1.arguments_.length === 2) {
|
|
2395
2401
|
const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
|
|
2396
2402
|
const finallyAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(finallyEffect_));
|
|
2397
2403
|
const d_ = ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, dictionary_);
|
|
@@ -2439,9 +2445,9 @@ export function JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_,
|
|
|
2439
2445
|
{
|
|
2440
2446
|
const _1 = ff_core_Pair.Pair(matchCase_.patterns_, matchCase_.guards_);
|
|
2441
2447
|
{
|
|
2442
|
-
if(_1.first_.
|
|
2443
|
-
const p_ = _1.first_
|
|
2444
|
-
const ps_ = _1.first_.
|
|
2448
|
+
if(_1.first_.length > 0) {
|
|
2449
|
+
const p_ = _1.first_[0];
|
|
2450
|
+
const ps_ = _1.first_.slice(1);
|
|
2445
2451
|
return ff_compiler_JsEmitter.JsEmitter_emitPattern(self_, ff_core_List.List_grab(arguments_, 0), p_, ff_core_List.List_dropFirst(arguments_, 1), (((_c) => {
|
|
2446
2452
|
return ff_compiler_Syntax.MatchCase(_c.at_, ps_, _c.guards_, _c.body_)
|
|
2447
2453
|
}))(matchCase_), jump_, last_, async_)
|
|
@@ -2449,22 +2455,22 @@ return
|
|
|
2449
2455
|
}
|
|
2450
2456
|
}
|
|
2451
2457
|
{
|
|
2452
|
-
if(_1.first_.
|
|
2453
|
-
if(_1.second_.
|
|
2454
|
-
const guard_ = _1.second_
|
|
2455
|
-
const guards_ = _1.second_.
|
|
2458
|
+
if(_1.first_.length === 0) {
|
|
2459
|
+
if(_1.second_.length > 0) {
|
|
2460
|
+
const guard_ = _1.second_[0];
|
|
2461
|
+
const guards_ = _1.second_.slice(1);
|
|
2456
2462
|
const guardName_ = ("_guard" + (ff_core_List.List_size(guards_) + 1));
|
|
2457
2463
|
const newCase_ = (((_c) => {
|
|
2458
|
-
return ff_compiler_Syntax.MatchCase(_c.at_,
|
|
2464
|
+
return ff_compiler_Syntax.MatchCase(_c.at_, [guard_.pattern_], guards_, _c.body_)
|
|
2459
2465
|
}))(matchCase_);
|
|
2460
|
-
return ((((("const " + guardName_) + " = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, guard_.term_, async_)) + ";\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_,
|
|
2466
|
+
return ((((("const " + guardName_) + " = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, guard_.term_, async_)) + ";\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, [guardName_], newCase_, jump_, last_, async_))
|
|
2461
2467
|
return
|
|
2462
2468
|
}
|
|
2463
2469
|
}
|
|
2464
2470
|
}
|
|
2465
2471
|
{
|
|
2466
|
-
if(_1.first_.
|
|
2467
|
-
if(_1.second_.
|
|
2472
|
+
if(_1.first_.length === 0) {
|
|
2473
|
+
if(_1.second_.length === 0) {
|
|
2468
2474
|
return (ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, matchCase_.body_, last_, async_) + ((jump_ && last_)
|
|
2469
2475
|
? "\nreturn"
|
|
2470
2476
|
: jump_
|
|
@@ -2483,21 +2489,21 @@ const _1 = pattern_;
|
|
|
2483
2489
|
{
|
|
2484
2490
|
if(_1.PString) {
|
|
2485
2491
|
const value_ = _1.value_;
|
|
2486
|
-
return (((((("if(" + argument_) + "
|
|
2492
|
+
return (((((("if(" + argument_) + " === ") + value_) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)) + "\n}")
|
|
2487
2493
|
return
|
|
2488
2494
|
}
|
|
2489
2495
|
}
|
|
2490
2496
|
{
|
|
2491
2497
|
if(_1.PInt) {
|
|
2492
2498
|
const value_ = _1.value_;
|
|
2493
|
-
return (((((("if(" + argument_) + "
|
|
2499
|
+
return (((((("if(" + argument_) + " === ") + value_) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)) + "\n}")
|
|
2494
2500
|
return
|
|
2495
2501
|
}
|
|
2496
2502
|
}
|
|
2497
2503
|
{
|
|
2498
2504
|
if(_1.PChar) {
|
|
2499
2505
|
const value_ = _1.value_;
|
|
2500
|
-
return (((((("if(" + argument_) + "
|
|
2506
|
+
return (((((("if(" + argument_) + " === ") + ff_compiler_JsEmitter.charLiteralToNumber_(value_)) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)) + "\n}")
|
|
2501
2507
|
return
|
|
2502
2508
|
}
|
|
2503
2509
|
}
|
|
@@ -2523,8 +2529,8 @@ return
|
|
|
2523
2529
|
}
|
|
2524
2530
|
{
|
|
2525
2531
|
if(_1.PVariant) {
|
|
2526
|
-
if(_1.name_
|
|
2527
|
-
if(_1.patterns_.
|
|
2532
|
+
if(_1.name_ === "ff:core/Bool.False") {
|
|
2533
|
+
if(_1.patterns_.length === 0) {
|
|
2528
2534
|
return (((("if(!" + argument_) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)) + "\n}")
|
|
2529
2535
|
return
|
|
2530
2536
|
}
|
|
@@ -2533,8 +2539,8 @@ return
|
|
|
2533
2539
|
}
|
|
2534
2540
|
{
|
|
2535
2541
|
if(_1.PVariant) {
|
|
2536
|
-
if(_1.name_
|
|
2537
|
-
if(_1.patterns_.
|
|
2542
|
+
if(_1.name_ === "ff:core/Bool.True") {
|
|
2543
|
+
if(_1.patterns_.length === 0) {
|
|
2538
2544
|
return (((("if(" + argument_) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)) + "\n}")
|
|
2539
2545
|
return
|
|
2540
2546
|
}
|
|
@@ -2543,15 +2549,57 @@ return
|
|
|
2543
2549
|
}
|
|
2544
2550
|
{
|
|
2545
2551
|
if(_1.PVariant) {
|
|
2552
|
+
if(_1.name_ === "List$Empty") {
|
|
2553
|
+
if(_1.patterns_.length === 0) {
|
|
2554
|
+
let shortArgument_ = argument_;
|
|
2555
|
+
let shortCount_ = 0;
|
|
2556
|
+
while(ff_core_String.String_endsWith(shortArgument_, ".slice(1)")) {
|
|
2557
|
+
shortArgument_ = ff_core_String.String_dropLast(shortArgument_, ff_core_String.String_size(".slice(1)"));
|
|
2558
|
+
shortCount_ += 1
|
|
2559
|
+
};
|
|
2560
|
+
return (((((("if(" + shortArgument_) + ".length === ") + shortCount_) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, jump_, last_, async_)) + "\n}")
|
|
2561
|
+
return
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
{
|
|
2567
|
+
if(_1.PVariant) {
|
|
2568
|
+
if(_1.name_ === "List$Link") {
|
|
2569
|
+
if(_1.patterns_.length > 0) {
|
|
2570
|
+
const head_ = _1.patterns_[0];
|
|
2571
|
+
if(_1.patterns_.length > 1) {
|
|
2572
|
+
const tail_ = _1.patterns_[1];
|
|
2573
|
+
if(_1.patterns_.length === 2) {
|
|
2574
|
+
let shortArgument_ = argument_;
|
|
2575
|
+
let shortCount_ = 0;
|
|
2576
|
+
while(ff_core_String.String_endsWith(shortArgument_, ".slice(1)")) {
|
|
2577
|
+
shortArgument_ = ff_core_String.String_dropLast(shortArgument_, ff_core_String.String_size(".slice(1)"));
|
|
2578
|
+
shortCount_ += 1
|
|
2579
|
+
};
|
|
2580
|
+
const newArguments_ = [(((shortArgument_ + "[") + shortCount_) + "]"), (argument_ + ".slice(1)"), ...arguments_];
|
|
2581
|
+
const newMatchCase_ = (((_c) => {
|
|
2582
|
+
return ff_compiler_Syntax.MatchCase(_c.at_, [head_, tail_, ...matchCase_.patterns_], _c.guards_, _c.body_)
|
|
2583
|
+
}))(matchCase_);
|
|
2584
|
+
return (((((("if(" + shortArgument_) + ".length > ") + shortCount_) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, newArguments_, newMatchCase_, jump_, last_, async_)) + "\n}")
|
|
2585
|
+
return
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
{
|
|
2593
|
+
if(_1.PVariant) {
|
|
2546
2594
|
const name_ = _1.name_;
|
|
2547
2595
|
const patterns_ = _1.patterns_;
|
|
2548
2596
|
const processed_ = ff_compiler_JsEmitter.JsEmitter_processVariantCase(self_, name_, argument_);
|
|
2549
2597
|
const newMatchCase_ = (((_c) => {
|
|
2550
|
-
return ff_compiler_Syntax.MatchCase(_c.at_,
|
|
2598
|
+
return ff_compiler_Syntax.MatchCase(_c.at_, [...patterns_, ...matchCase_.patterns_], _c.guards_, _c.body_)
|
|
2551
2599
|
}))(matchCase_);
|
|
2552
2600
|
return (((processed_.loneVariant_
|
|
2553
2601
|
? ""
|
|
2554
|
-
: (((("if(" + argument_) + ".") + processed_.variantName_) + ") {\n")) + ff_compiler_JsEmitter.JsEmitter_emitCase(self_,
|
|
2602
|
+
: (((("if(" + argument_) + ".") + processed_.variantName_) + ") {\n")) + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, [...processed_.arguments_, ...arguments_], newMatchCase_, jump_, last_, async_)) + (processed_.loneVariant_
|
|
2555
2603
|
? ""
|
|
2556
2604
|
: "\n}"))
|
|
2557
2605
|
return
|
|
@@ -2595,49 +2643,31 @@ return
|
|
|
2595
2643
|
}
|
|
2596
2644
|
|
|
2597
2645
|
export function JsEmitter_emitList(self_, items_, async_) {
|
|
2646
|
+
return (("[" + ff_core_List.List_join(ff_core_List.List_map(items_, ((_1) => {
|
|
2598
2647
|
{
|
|
2599
|
-
const
|
|
2600
|
-
{
|
|
2601
|
-
|
|
2602
|
-
return "ff_core_List.Empty()"
|
|
2603
|
-
return
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
{
|
|
2607
|
-
if(_1.Link) {
|
|
2608
|
-
const e_ = _1.head_.first_;
|
|
2609
|
-
if(_1.head_.second_) {
|
|
2610
|
-
if(_1.tail_.Empty) {
|
|
2611
|
-
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_)
|
|
2612
|
-
return
|
|
2613
|
-
}
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
}
|
|
2617
|
-
{
|
|
2618
|
-
if(_1.Link) {
|
|
2619
|
-
const e_ = _1.head_.first_;
|
|
2620
|
-
if(!_1.head_.second_) {
|
|
2621
|
-
const list_ = _1.tail_;
|
|
2622
|
-
return (((("ff_core_List.Link(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_)) + ", ") + ff_compiler_JsEmitter.JsEmitter_emitList(self_, list_, async_)) + ")")
|
|
2648
|
+
const item_ = _1.first_;
|
|
2649
|
+
if(!_1.second_) {
|
|
2650
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, item_, async_)
|
|
2623
2651
|
return
|
|
2624
2652
|
}
|
|
2625
2653
|
}
|
|
2626
|
-
}
|
|
2627
2654
|
{
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
const list_ = _1.tail_;
|
|
2632
|
-
return (((("ff_core_List.List_addAll(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_)) + ", ") + ff_compiler_JsEmitter.JsEmitter_emitList(self_, list_, async_)) + ")")
|
|
2655
|
+
const item_ = _1.first_;
|
|
2656
|
+
if(_1.second_) {
|
|
2657
|
+
return ("..." + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, item_, async_))
|
|
2633
2658
|
return
|
|
2634
2659
|
}
|
|
2635
2660
|
}
|
|
2636
|
-
}
|
|
2637
|
-
}
|
|
2661
|
+
})), ", ")) + "]")
|
|
2638
2662
|
}
|
|
2639
2663
|
|
|
2640
2664
|
export function JsEmitter_processVariantCase(self_, name_, argument_) {
|
|
2665
|
+
if((name_ === "List$Empty")) {
|
|
2666
|
+
return ff_compiler_JsEmitter.ProcessedVariantCase(name_, false, false, [])
|
|
2667
|
+
} else {
|
|
2668
|
+
if((name_ === "List$Link")) {
|
|
2669
|
+
return ff_compiler_JsEmitter.ProcessedVariantCase(name_, false, false, [(argument_ + "[0]"), (argument_ + ".slice(1)")])
|
|
2670
|
+
} else {
|
|
2641
2671
|
const variantNameUnqualified_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(name_), ((_w1) => {
|
|
2642
2672
|
return (_w1 !== 46)
|
|
2643
2673
|
})));
|
|
@@ -2652,11 +2682,11 @@ return (_w1.name_ === variantName_)
|
|
|
2652
2682
|
})), ((variant_) => {
|
|
2653
2683
|
newtype_ = definition_.newtype_;
|
|
2654
2684
|
loneVariant_ = (ff_core_List.List_size(definition_.variants_) === 1);
|
|
2655
|
-
return ff_core_List.
|
|
2685
|
+
return [...ff_core_List.List_map(definition_.commonFields_, ((_w1) => {
|
|
2656
2686
|
return _w1.name_
|
|
2657
|
-
})), ff_core_List.List_map(variant_.fields_, ((_w1) => {
|
|
2687
|
+
})), ...ff_core_List.List_map(variant_.fields_, ((_w1) => {
|
|
2658
2688
|
return _w1.name_
|
|
2659
|
-
}))
|
|
2689
|
+
}))]
|
|
2660
2690
|
}))
|
|
2661
2691
|
}))), ((field_) => {
|
|
2662
2692
|
if(newtype_) {
|
|
@@ -2667,8 +2697,13 @@ return ((argument_ + ".") + ff_compiler_JsEmitter.escapeKeyword_(field_))
|
|
|
2667
2697
|
}));
|
|
2668
2698
|
return ff_compiler_JsEmitter.ProcessedVariantCase(variantName_, newtype_, loneVariant_, newArguments_)
|
|
2669
2699
|
}
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2670
2702
|
|
|
2671
2703
|
export function JsEmitter_processVariant(self_, name_) {
|
|
2704
|
+
if(ff_core_String.String_startsWith(name_, "List$", 0)) {
|
|
2705
|
+
return false
|
|
2706
|
+
} else {
|
|
2672
2707
|
const variantNameUnqualified_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(name_), ((_w1) => {
|
|
2673
2708
|
return (_w1 !== 46)
|
|
2674
2709
|
})));
|
|
@@ -2685,6 +2720,7 @@ newtype_ = definition_.newtype_
|
|
|
2685
2720
|
})));
|
|
2686
2721
|
return newtype_
|
|
2687
2722
|
}
|
|
2723
|
+
}
|
|
2688
2724
|
|
|
2689
2725
|
export function JsEmitter_emitArgument(self_, callAt_, argument_, async_) {
|
|
2690
2726
|
{
|
|
@@ -2692,7 +2728,7 @@ const _1 = argument_.value_;
|
|
|
2692
2728
|
{
|
|
2693
2729
|
if(_1.ECall) {
|
|
2694
2730
|
if(_1.target_.StaticCall) {
|
|
2695
|
-
if(_1.target_.name_
|
|
2731
|
+
if(_1.target_.name_ === "ff:core/SourceLocation.callSite") {
|
|
2696
2732
|
return (((((((((("\"" + self_.moduleName_) + ":") + callAt_.line_) + ":") + callAt_.column_) + ",") + self_.packagePair_.group_) + ",") + self_.packagePair_.name_) + "\"")
|
|
2697
2733
|
return
|
|
2698
2734
|
}
|
|
@@ -2709,39 +2745,39 @@ return
|
|
|
2709
2745
|
|
|
2710
2746
|
export async function JsEmitter_emitModule$(self_, packagePair_, module_, $task) {
|
|
2711
2747
|
const selfImport_ = ((((((((("import * as " + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "_")) + "_") + ff_core_String.String_dropLast(module_.file_, 3)) + " ") + "from \"../../") + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + ff_core_String.String_dropLast(module_.file_, 3)) + ".mjs\"");
|
|
2712
|
-
const imports_ = ff_core_List.List_flatten(
|
|
2748
|
+
const imports_ = ff_core_List.List_flatten([ff_core_Option.Option_toList((await ff_core_Option.Option_map$(self_.compilerModulePath_, (async (_w1, $task) => {
|
|
2713
2749
|
return (("import * as $firefly_compiler from '" + (await ff_core_Path.Path_url$(_w1, $task))) + "'")
|
|
2714
|
-
}), $task))),
|
|
2750
|
+
}), $task))), (await ff_core_List.List_map$(ff_core_List.List_sortBy(module_.imports_, ((i_) => {
|
|
2715
2751
|
return ff_core_Pair.Pair(i_.package_, i_.file_)
|
|
2716
2752
|
}), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)), (async (_w1, $task) => {
|
|
2717
2753
|
return (await ff_compiler_JsEmitter.JsEmitter_emitImportDefinition$(self_, _w1, $task))
|
|
2718
|
-
}), $task))
|
|
2719
|
-
const parts_ =
|
|
2754
|
+
}), $task))]);
|
|
2755
|
+
const parts_ = [(ff_core_List.List_any(imports_, ((_w1) => {
|
|
2720
2756
|
return (_w1 === selfImport_)
|
|
2721
2757
|
}))
|
|
2722
2758
|
? imports_
|
|
2723
|
-
:
|
|
2759
|
+
: [selfImport_, ...imports_]), (await ff_core_List.List_map$(module_.types_, (async (_w1, $task) => {
|
|
2724
2760
|
return (await ff_compiler_JsEmitter.JsEmitter_emitTypeDefinition$(self_, _w1, $task))
|
|
2725
|
-
}), $task)),
|
|
2761
|
+
}), $task)), (await ff_core_List.List_map$(module_.lets_, (async (_w1, $task) => {
|
|
2726
2762
|
return ("export " + (await ff_compiler_JsEmitter.JsEmitter_emitLetDefinition$(self_, _w1, false, false, $task)))
|
|
2727
|
-
}), $task)),
|
|
2763
|
+
}), $task)), (await ff_core_List.List_map$(module_.functions_, (async (_w1, $task) => {
|
|
2728
2764
|
return ("export " + (await ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition$(self_, _w1, false, "", $task)))
|
|
2729
|
-
}), $task)),
|
|
2765
|
+
}), $task)), (await ff_compiler_JsEmitter.JsEmitter_withEmittingAsync$(self_, (async ($task) => {
|
|
2730
2766
|
return (await ff_core_List.List_map$(module_.functions_, (async (_w1, $task) => {
|
|
2731
2767
|
return ("export " + (await ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition$(self_, _w1, true, "", $task)))
|
|
2732
2768
|
}), $task))
|
|
2733
|
-
}), $task)),
|
|
2769
|
+
}), $task)), (await ff_core_List.List_map$(module_.extends_, (async (_w1, $task) => {
|
|
2734
2770
|
return (await ff_compiler_JsEmitter.JsEmitter_emitExtendsDefinition$(self_, _w1, $task))
|
|
2735
|
-
}), $task)),
|
|
2771
|
+
}), $task)), (await ff_core_List.List_map$(module_.instances_, (async (_w1, $task) => {
|
|
2736
2772
|
return (await ff_compiler_JsEmitter.JsEmitter_emitInstanceDefinition$(self_, _w1, $task))
|
|
2737
|
-
}), $task)),
|
|
2773
|
+
}), $task)), (self_.isMainModule_
|
|
2738
2774
|
? (await ff_compiler_JsEmitter.JsEmitter_emitRun$(self_, module_.functions_, packagePair_, ((packagePair_.group_ === "ff") && (packagePair_.name_ === "compiler")), $task))
|
|
2739
|
-
:
|
|
2775
|
+
: [])];
|
|
2740
2776
|
const ignoreJsImports_ = (((ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitExecutable()) && (packagePair_.group_ === "ff")) && (packagePair_.name_ === "core"))
|
|
2741
|
-
?
|
|
2742
|
-
:
|
|
2777
|
+
? ["esbuild"]
|
|
2778
|
+
: []);
|
|
2743
2779
|
const jsImports_ = ff_compiler_JsImporter.JsImporter_generateImports(self_.jsImporter_, ff_core_List.List_toSet(ignoreJsImports_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String));
|
|
2744
|
-
return (ff_core_List.List_join(ff_core_List.List_map(
|
|
2780
|
+
return (ff_core_List.List_join(ff_core_List.List_map([jsImports_, ...parts_], ((_w1) => {
|
|
2745
2781
|
return ff_core_List.List_join(_w1, "\n\n")
|
|
2746
2782
|
})), "\n\n") + "\n")
|
|
2747
2783
|
}
|
|
@@ -2775,24 +2811,24 @@ return (_w1.signature_.name_ === "main")
|
|
|
2775
2811
|
return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Option.Option_map(mainFunction_, ((_w1) => {
|
|
2776
2812
|
return _w1.signature_.name_
|
|
2777
2813
|
})), ((mainName_) => {
|
|
2778
|
-
return ff_core_List.
|
|
2779
|
-
?
|
|
2780
|
-
:
|
|
2814
|
+
return [ff_core_List.List_join(["export async function $run$(fireflyPath_, arguments_) {", "Error.stackTraceLimit = 50", "const $task = {controller: new AbortController(), subtasks: new Set(), promise: new Promise(() => {}), started: performance.now() * 0.001}", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
|
|
2815
|
+
? ["let interval = setInterval(() => {}, 24 * 60 * 60 * 1000)"]
|
|
2816
|
+
: []), "let system = {", "task_: $task,", "array_: arguments_,", "fireflyPath_: fireflyPath_,", (((("mainPackagePair_: {group_: \"" + mainPackagePair_.group_) + "\", name_: \"") + mainPackagePair_.name_) + "\"},"), (("executableMode_: " + (ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitExecutable())
|
|
2781
2817
|
? "true"
|
|
2782
|
-
: "false")) + ","),
|
|
2818
|
+
: "false")) + ","), ("buildMode_: " + (ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBuild())
|
|
2783
2819
|
? "true"
|
|
2784
|
-
: "false")),
|
|
2785
|
-
?
|
|
2786
|
-
:
|
|
2787
|
-
?
|
|
2788
|
-
:
|
|
2789
|
-
?
|
|
2790
|
-
:
|
|
2791
|
-
?
|
|
2792
|
-
:
|
|
2820
|
+
: "false")), "}", "try {", ...((!ff_core_Option.Option_isEmpty(buildMainFunction_))
|
|
2821
|
+
? ["await buildMain_$(system, $task)"]
|
|
2822
|
+
: []), ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBuild(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
|
|
2823
|
+
? [(("await " + mainName_) + "_$(system, $task)")]
|
|
2824
|
+
: []), ...(ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBuild())
|
|
2825
|
+
? ["await $firefly_compiler.internalCreateExecutable_$(system, '.firefly/output/executable/Main.bundle.js', '.firefly/output', ['host'], system.assets_, $task)"]
|
|
2826
|
+
: []), "} finally {", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
|
|
2827
|
+
? ["ff_core_Task.Task_abort$($task)", "clearInterval(interval)"]
|
|
2828
|
+
: []), "}", "}", ...(((_1) => {
|
|
2793
2829
|
{
|
|
2794
2830
|
if(_1.EmitBrowser) {
|
|
2795
|
-
return
|
|
2831
|
+
return ["queueMicrotask(async () => {", "await $run$(null, [])", "})"]
|
|
2796
2832
|
return
|
|
2797
2833
|
}
|
|
2798
2834
|
}
|
|
@@ -2800,24 +2836,24 @@ return
|
|
|
2800
2836
|
if(_1.EmitNode) {
|
|
2801
2837
|
const _guard1 = bootstrapping_;
|
|
2802
2838
|
if(_guard1) {
|
|
2803
|
-
return
|
|
2839
|
+
return ["import * as path from 'node:path'", "queueMicrotask(async () => {", "let fireflyPath_ = path.dirname(path.dirname(path.dirname(path.dirname(path.dirname(process.argv[1])))))", "await $run$(fireflyPath_, process.argv.slice(2))", "})"]
|
|
2804
2840
|
return
|
|
2805
2841
|
}
|
|
2806
2842
|
}
|
|
2807
2843
|
}
|
|
2808
2844
|
{
|
|
2809
2845
|
if(_1.EmitExecutable) {
|
|
2810
|
-
return
|
|
2846
|
+
return ["queueMicrotask(async () => {", "await $run$(null, process.argv.slice(2))", "})"]
|
|
2811
2847
|
return
|
|
2812
2848
|
}
|
|
2813
2849
|
}
|
|
2814
2850
|
{
|
|
2815
|
-
return
|
|
2851
|
+
return []
|
|
2816
2852
|
return
|
|
2817
2853
|
}
|
|
2818
|
-
}))(self_.emitTarget_)
|
|
2854
|
+
}))(self_.emitTarget_)], "\n")]
|
|
2819
2855
|
})), (() => {
|
|
2820
|
-
return
|
|
2856
|
+
return []
|
|
2821
2857
|
}))
|
|
2822
2858
|
}
|
|
2823
2859
|
|
|
@@ -2857,7 +2893,7 @@ return (await ff_core_List.List_map$(methods_, (async (_w1, $task) => {
|
|
|
2857
2893
|
return ("export " + (await ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition$(self_, _w1, true, "", $task)))
|
|
2858
2894
|
}), $task))
|
|
2859
2895
|
}), $task));
|
|
2860
|
-
return ff_core_List.List_join(
|
|
2896
|
+
return ff_core_List.List_join([...syncMethods_, ...asyncMethods_], "\n\n")
|
|
2861
2897
|
}
|
|
2862
2898
|
|
|
2863
2899
|
export async function JsEmitter_emitInstanceDefinition$(self_, definition_, $task) {
|
|
@@ -2874,11 +2910,11 @@ return (await ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition$(self_, _w1
|
|
|
2874
2910
|
return ("async " + ff_core_String.String_dropFirst(_w1, ff_core_String.String_size("async function ")))
|
|
2875
2911
|
}))
|
|
2876
2912
|
}), $task));
|
|
2877
|
-
const body_ = (("{\n" + ff_core_List.List_join(
|
|
2913
|
+
const body_ = (("{\n" + ff_core_List.List_join([...methods_, ...asyncMethods_], ",\n")) + "\n}");
|
|
2878
2914
|
{
|
|
2879
2915
|
const _1 = definition_.constraints_;
|
|
2880
2916
|
{
|
|
2881
|
-
if(_1.
|
|
2917
|
+
if(_1.length === 0) {
|
|
2882
2918
|
return (((("export const " + name_) + " = ") + body_) + ";")
|
|
2883
2919
|
return
|
|
2884
2920
|
}
|
|
@@ -2947,9 +2983,9 @@ const lambda_ = _1.second_.lambda_;
|
|
|
2947
2983
|
const _1 = lambda_;
|
|
2948
2984
|
{
|
|
2949
2985
|
const effect_ = _1.effect_;
|
|
2950
|
-
if(_1.cases_.
|
|
2951
|
-
const matchCase_ = _1.cases_
|
|
2952
|
-
if(_1.cases_.
|
|
2986
|
+
if(_1.cases_.length > 0) {
|
|
2987
|
+
const matchCase_ = _1.cases_[0];
|
|
2988
|
+
if(_1.cases_.length === 1) {
|
|
2953
2989
|
const _guard1 = ff_core_List.List_all(matchCase_.patterns_, ((_1) => {
|
|
2954
2990
|
{
|
|
2955
2991
|
if(_1.PVariable) {
|
|
@@ -3021,9 +3057,9 @@ const dictionaryStrings_ = ff_core_List.List_map(signature_.constraints_, ((c_)
|
|
|
3021
3057
|
return ff_compiler_JsEmitter.makeDictionaryName_(c_.name_, ff_compiler_JsEmitter.firstTypeName_(c_.generics_))
|
|
3022
3058
|
}));
|
|
3023
3059
|
const controller_ = (async_
|
|
3024
|
-
?
|
|
3025
|
-
:
|
|
3026
|
-
const parameters_ = (("(" + ff_core_List.List_join(
|
|
3060
|
+
? ["$task"]
|
|
3061
|
+
: []);
|
|
3062
|
+
const parameters_ = (("(" + ff_core_List.List_join([...parameterStrings_, ...dictionaryStrings_, ...controller_], ", ")) + ")");
|
|
3027
3063
|
const prefix_ = (async_
|
|
3028
3064
|
? "async "
|
|
3029
3065
|
: "");
|
|
@@ -3053,7 +3089,7 @@ return (await ff_compiler_JsEmitter.JsEmitter_emitVariantDefinition$(self_, defi
|
|
|
3053
3089
|
}
|
|
3054
3090
|
|
|
3055
3091
|
export async function JsEmitter_emitVariantDefinition$(self_, typeDefinition_, definition_, $task) {
|
|
3056
|
-
const allFields_ =
|
|
3092
|
+
const allFields_ = [...typeDefinition_.commonFields_, ...definition_.fields_];
|
|
3057
3093
|
const fields_ = ff_core_List.List_join(ff_core_List.List_map(allFields_, ((_w1) => {
|
|
3058
3094
|
return ff_compiler_JsEmitter.escapeKeyword_(_w1.name_)
|
|
3059
3095
|
})), ", ");
|
|
@@ -3131,7 +3167,7 @@ return
|
|
|
3131
3167
|
{
|
|
3132
3168
|
if(_1.EVariant) {
|
|
3133
3169
|
const at_ = _1.at_;
|
|
3134
|
-
if(_1.name_
|
|
3170
|
+
if(_1.name_ === "ff:core/Bool.False") {
|
|
3135
3171
|
return "false"
|
|
3136
3172
|
return
|
|
3137
3173
|
}
|
|
@@ -3140,7 +3176,7 @@ return
|
|
|
3140
3176
|
{
|
|
3141
3177
|
if(_1.EVariant) {
|
|
3142
3178
|
const at_ = _1.at_;
|
|
3143
|
-
if(_1.name_
|
|
3179
|
+
if(_1.name_ === "ff:core/Bool.True") {
|
|
3144
3180
|
return "true"
|
|
3145
3181
|
return
|
|
3146
3182
|
}
|
|
@@ -3149,7 +3185,7 @@ return
|
|
|
3149
3185
|
{
|
|
3150
3186
|
if(_1.EVariant) {
|
|
3151
3187
|
const at_ = _1.at_;
|
|
3152
|
-
if(_1.name_
|
|
3188
|
+
if(_1.name_ === "ff:core/Unit.Unit") {
|
|
3153
3189
|
return "(void 0)"
|
|
3154
3190
|
return
|
|
3155
3191
|
}
|
|
@@ -3175,7 +3211,7 @@ return
|
|
|
3175
3211
|
{
|
|
3176
3212
|
if(_1.EVariantIs) {
|
|
3177
3213
|
const at_ = _1.at_;
|
|
3178
|
-
if(_1.name_
|
|
3214
|
+
if(_1.name_ === "ff:core/Bool.False") {
|
|
3179
3215
|
return "function(_v) { return !_v ? ff_core_Option.Some(_v) : ff_core_Option.None(); }"
|
|
3180
3216
|
return
|
|
3181
3217
|
}
|
|
@@ -3184,7 +3220,7 @@ return
|
|
|
3184
3220
|
{
|
|
3185
3221
|
if(_1.EVariantIs) {
|
|
3186
3222
|
const at_ = _1.at_;
|
|
3187
|
-
if(_1.name_
|
|
3223
|
+
if(_1.name_ === "ff:core/Bool.True") {
|
|
3188
3224
|
return "function(_v) { return _v ? ff_core_Option.Some(_v) : ff_core_Option.None(); }"
|
|
3189
3225
|
return
|
|
3190
3226
|
}
|
|
@@ -3193,7 +3229,7 @@ return
|
|
|
3193
3229
|
{
|
|
3194
3230
|
if(_1.EVariantIs) {
|
|
3195
3231
|
const at_ = _1.at_;
|
|
3196
|
-
if(_1.name_
|
|
3232
|
+
if(_1.name_ === "ff:core/Unit.Unit") {
|
|
3197
3233
|
return "function(_v) { return ff_core_Option.Some(_v); }"
|
|
3198
3234
|
return
|
|
3199
3235
|
}
|
|
@@ -3241,11 +3277,11 @@ return
|
|
|
3241
3277
|
if(_1.ELambda) {
|
|
3242
3278
|
const at_ = _1.at_;
|
|
3243
3279
|
const effect_ = _1.lambda_.effect_;
|
|
3244
|
-
if(_1.lambda_.cases_.
|
|
3245
|
-
const patterns_ = _1.lambda_.cases_.
|
|
3246
|
-
if(_1.lambda_.cases_.
|
|
3247
|
-
const body_ = _1.lambda_.cases_.
|
|
3248
|
-
if(_1.lambda_.cases_.
|
|
3280
|
+
if(_1.lambda_.cases_.length > 0) {
|
|
3281
|
+
const patterns_ = _1.lambda_.cases_[0].patterns_;
|
|
3282
|
+
if(_1.lambda_.cases_[0].guards_.length === 0) {
|
|
3283
|
+
const body_ = _1.lambda_.cases_[0].body_;
|
|
3284
|
+
if(_1.lambda_.cases_.length === 1) {
|
|
3249
3285
|
const _guard1 = ff_core_List.List_all(patterns_, ((_1) => {
|
|
3250
3286
|
{
|
|
3251
3287
|
if(_1.PVariable) {
|
|
@@ -3278,9 +3314,9 @@ return
|
|
|
3278
3314
|
}
|
|
3279
3315
|
}));
|
|
3280
3316
|
const controller_ = (newAsync_
|
|
3281
|
-
?
|
|
3282
|
-
:
|
|
3283
|
-
const parameters_ = ff_core_List.List_join(
|
|
3317
|
+
? ["$task"]
|
|
3318
|
+
: []);
|
|
3319
|
+
const parameters_ = ff_core_List.List_join([...patternParameters_, ...controller_], ", ");
|
|
3284
3320
|
const prefix_ = (newAsync_
|
|
3285
3321
|
? "async "
|
|
3286
3322
|
: "");
|
|
@@ -3299,8 +3335,8 @@ const effect_ = _1.lambda_.effect_;
|
|
|
3299
3335
|
const cases_ = _1.lambda_.cases_;
|
|
3300
3336
|
const newAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
|
|
3301
3337
|
const controller_ = (newAsync_
|
|
3302
|
-
?
|
|
3303
|
-
:
|
|
3338
|
+
? ["$task"]
|
|
3339
|
+
: []);
|
|
3304
3340
|
ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
|
|
3305
3341
|
const arguments_ = ff_core_List.List_map(ff_core_List.List_pairs(ff_core_List.List_grab(cases_, 0).patterns_), ((_w1) => {
|
|
3306
3342
|
return ("_" + (_w1.first_ + 1))
|
|
@@ -3314,7 +3350,7 @@ return (("{\n" + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, escaped
|
|
|
3314
3350
|
const prefix_ = (newAsync_
|
|
3315
3351
|
? "async "
|
|
3316
3352
|
: "");
|
|
3317
|
-
return ((((((("(" + prefix_) + "(") + ff_core_List.List_join(
|
|
3353
|
+
return ((((((("(" + prefix_) + "(") + ff_core_List.List_join([...escapedArguments_, ...controller_], ", ")) + ") => ") + "{\n") + ff_core_List.List_join(caseStrings_, "\n")) + "\n})")
|
|
3318
3354
|
return
|
|
3319
3355
|
}
|
|
3320
3356
|
}
|
|
@@ -3342,10 +3378,10 @@ if(_1.ECall) {
|
|
|
3342
3378
|
const at_ = _1.at_;
|
|
3343
3379
|
if(_1.target_.StaticCall) {
|
|
3344
3380
|
const operator_ = _1.target_.name_;
|
|
3345
|
-
if(_1.typeArguments_.
|
|
3346
|
-
if(_1.arguments_.
|
|
3347
|
-
const value_ = _1.arguments_
|
|
3348
|
-
if(_1.arguments_.
|
|
3381
|
+
if(_1.typeArguments_.length === 0) {
|
|
3382
|
+
if(_1.arguments_.length > 0) {
|
|
3383
|
+
const value_ = _1.arguments_[0];
|
|
3384
|
+
if(_1.arguments_.length === 1) {
|
|
3349
3385
|
const _guard1 = (!ff_core_Char.Char_isAsciiLetter(ff_core_String.String_grabFirst(operator_)));
|
|
3350
3386
|
if(_guard1) {
|
|
3351
3387
|
return ((("(" + operator_) + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, value_, async_, $task))) + ")")
|
|
@@ -3362,12 +3398,12 @@ if(_1.ECall) {
|
|
|
3362
3398
|
const at_ = _1.at_;
|
|
3363
3399
|
if(_1.target_.StaticCall) {
|
|
3364
3400
|
const operator_ = _1.target_.name_;
|
|
3365
|
-
if(_1.typeArguments_.
|
|
3366
|
-
if(_1.arguments_.
|
|
3367
|
-
const left_ = _1.arguments_
|
|
3368
|
-
if(_1.arguments_.
|
|
3369
|
-
const right_ = _1.arguments_
|
|
3370
|
-
if(_1.arguments_.
|
|
3401
|
+
if(_1.typeArguments_.length === 0) {
|
|
3402
|
+
if(_1.arguments_.length > 0) {
|
|
3403
|
+
const left_ = _1.arguments_[0];
|
|
3404
|
+
if(_1.arguments_.length > 1) {
|
|
3405
|
+
const right_ = _1.arguments_[1];
|
|
3406
|
+
if(_1.arguments_.length === 2) {
|
|
3371
3407
|
const _guard1 = (!ff_core_Char.Char_isAsciiLetter(ff_core_String.String_grabFirst(operator_)));
|
|
3372
3408
|
if(_guard1) {
|
|
3373
3409
|
return (((((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " ") + operator_) + " ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
|
|
@@ -3384,11 +3420,11 @@ return
|
|
|
3384
3420
|
if(_1.ECall) {
|
|
3385
3421
|
const at_ = _1.at_;
|
|
3386
3422
|
if(_1.target_.StaticCall) {
|
|
3387
|
-
if(_1.target_.name_
|
|
3388
|
-
if(_1.arguments_.
|
|
3389
|
-
if(_1.arguments_.
|
|
3390
|
-
const url_ = _1.arguments_.
|
|
3391
|
-
if(_1.arguments_.
|
|
3423
|
+
if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.import") {
|
|
3424
|
+
if(_1.arguments_.length > 0) {
|
|
3425
|
+
if(_1.arguments_[0].value_.EString) {
|
|
3426
|
+
const url_ = _1.arguments_[0].value_.value_;
|
|
3427
|
+
if(_1.arguments_.length === 1) {
|
|
3392
3428
|
return ff_compiler_JsImporter.JsImporter_add(self_.jsImporter_, ff_core_String.String_replace(url_, "\"", ""))
|
|
3393
3429
|
return
|
|
3394
3430
|
}
|
|
@@ -3402,10 +3438,10 @@ return
|
|
|
3402
3438
|
if(_1.ECall) {
|
|
3403
3439
|
const at_ = _1.at_;
|
|
3404
3440
|
if(_1.target_.StaticCall) {
|
|
3405
|
-
if(_1.target_.name_
|
|
3406
|
-
if(_1.arguments_.
|
|
3407
|
-
const body_ = _1.arguments_.
|
|
3408
|
-
if(_1.arguments_.
|
|
3441
|
+
if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.await") {
|
|
3442
|
+
if(_1.arguments_.length > 0) {
|
|
3443
|
+
const body_ = _1.arguments_[0].value_;
|
|
3444
|
+
if(_1.arguments_.length === 1) {
|
|
3409
3445
|
const emittedBody_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, body_, async_, $task));
|
|
3410
3446
|
if(async_) {
|
|
3411
3447
|
return (("(await " + emittedBody_) + "($task))")
|
|
@@ -3423,8 +3459,8 @@ return
|
|
|
3423
3459
|
if(_1.ECall) {
|
|
3424
3460
|
const at_ = _1.at_;
|
|
3425
3461
|
if(_1.target_.StaticCall) {
|
|
3426
|
-
if(_1.target_.name_
|
|
3427
|
-
if(_1.arguments_.
|
|
3462
|
+
if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.cancelled") {
|
|
3463
|
+
if(_1.arguments_.length === 0) {
|
|
3428
3464
|
if(async_) {
|
|
3429
3465
|
return "$task.controller.signal.aborted"
|
|
3430
3466
|
} else {
|
|
@@ -3440,8 +3476,8 @@ return
|
|
|
3440
3476
|
if(_1.ECall) {
|
|
3441
3477
|
const at_ = _1.at_;
|
|
3442
3478
|
if(_1.target_.StaticCall) {
|
|
3443
|
-
if(_1.target_.name_
|
|
3444
|
-
if(_1.arguments_.
|
|
3479
|
+
if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.throwIfCancelled") {
|
|
3480
|
+
if(_1.arguments_.length === 0) {
|
|
3445
3481
|
if(async_) {
|
|
3446
3482
|
return "((() => ff_core_Task.Task_throwIfAborted($task))())"
|
|
3447
3483
|
} else {
|
|
@@ -3457,16 +3493,16 @@ return
|
|
|
3457
3493
|
if(_1.ECall) {
|
|
3458
3494
|
const at_ = _1.at_;
|
|
3459
3495
|
if(_1.target_.StaticCall) {
|
|
3460
|
-
if(_1.target_.name_
|
|
3461
|
-
if(_1.arguments_.
|
|
3462
|
-
const left_ = _1.arguments_
|
|
3463
|
-
if(_1.arguments_.
|
|
3464
|
-
const right_ = _1.arguments_
|
|
3465
|
-
if(_1.arguments_.
|
|
3466
|
-
if(_1.dictionaries_.
|
|
3467
|
-
const typeName_ = _1.dictionaries_.
|
|
3468
|
-
if(_1.dictionaries_.
|
|
3469
|
-
if(_1.dictionaries_.
|
|
3496
|
+
if(_1.target_.name_ === "ff:core/Equal.equals") {
|
|
3497
|
+
if(_1.arguments_.length > 0) {
|
|
3498
|
+
const left_ = _1.arguments_[0];
|
|
3499
|
+
if(_1.arguments_.length > 1) {
|
|
3500
|
+
const right_ = _1.arguments_[1];
|
|
3501
|
+
if(_1.arguments_.length === 2) {
|
|
3502
|
+
if(_1.dictionaries_.length > 0) {
|
|
3503
|
+
const typeName_ = _1.dictionaries_[0].typeName_;
|
|
3504
|
+
if(_1.dictionaries_[0].dictionaries_.length === 0) {
|
|
3505
|
+
if(_1.dictionaries_.length === 1) {
|
|
3470
3506
|
const _guard1 = (ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || (typeName_ === "ff:core/Ordering.Ordering"));
|
|
3471
3507
|
if(_guard1) {
|
|
3472
3508
|
return (((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " === ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
|
|
@@ -3486,16 +3522,16 @@ return
|
|
|
3486
3522
|
if(_1.ECall) {
|
|
3487
3523
|
const at_ = _1.at_;
|
|
3488
3524
|
if(_1.target_.StaticCall) {
|
|
3489
|
-
if(_1.target_.name_
|
|
3490
|
-
if(_1.arguments_.
|
|
3491
|
-
const left_ = _1.arguments_
|
|
3492
|
-
if(_1.arguments_.
|
|
3493
|
-
const right_ = _1.arguments_
|
|
3494
|
-
if(_1.arguments_.
|
|
3495
|
-
if(_1.dictionaries_.
|
|
3496
|
-
const typeName_ = _1.dictionaries_.
|
|
3497
|
-
if(_1.dictionaries_.
|
|
3498
|
-
if(_1.dictionaries_.
|
|
3525
|
+
if(_1.target_.name_ === "ff:core/Equal.notEquals") {
|
|
3526
|
+
if(_1.arguments_.length > 0) {
|
|
3527
|
+
const left_ = _1.arguments_[0];
|
|
3528
|
+
if(_1.arguments_.length > 1) {
|
|
3529
|
+
const right_ = _1.arguments_[1];
|
|
3530
|
+
if(_1.arguments_.length === 2) {
|
|
3531
|
+
if(_1.dictionaries_.length > 0) {
|
|
3532
|
+
const typeName_ = _1.dictionaries_[0].typeName_;
|
|
3533
|
+
if(_1.dictionaries_[0].dictionaries_.length === 0) {
|
|
3534
|
+
if(_1.dictionaries_.length === 1) {
|
|
3499
3535
|
const _guard1 = (ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || (typeName_ === "ff:core/Ordering.Ordering"));
|
|
3500
3536
|
if(_guard1) {
|
|
3501
3537
|
return (((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " !== ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
|
|
@@ -3515,16 +3551,16 @@ return
|
|
|
3515
3551
|
if(_1.ECall) {
|
|
3516
3552
|
const at_ = _1.at_;
|
|
3517
3553
|
if(_1.target_.StaticCall) {
|
|
3518
|
-
if(_1.target_.name_
|
|
3519
|
-
if(_1.arguments_.
|
|
3520
|
-
const left_ = _1.arguments_
|
|
3521
|
-
if(_1.arguments_.
|
|
3522
|
-
const right_ = _1.arguments_
|
|
3523
|
-
if(_1.arguments_.
|
|
3524
|
-
if(_1.dictionaries_.
|
|
3525
|
-
const typeName_ = _1.dictionaries_.
|
|
3526
|
-
if(_1.dictionaries_.
|
|
3527
|
-
if(_1.dictionaries_.
|
|
3554
|
+
if(_1.target_.name_ === "ff:core/Ordering.before") {
|
|
3555
|
+
if(_1.arguments_.length > 0) {
|
|
3556
|
+
const left_ = _1.arguments_[0];
|
|
3557
|
+
if(_1.arguments_.length > 1) {
|
|
3558
|
+
const right_ = _1.arguments_[1];
|
|
3559
|
+
if(_1.arguments_.length === 2) {
|
|
3560
|
+
if(_1.dictionaries_.length > 0) {
|
|
3561
|
+
const typeName_ = _1.dictionaries_[0].typeName_;
|
|
3562
|
+
if(_1.dictionaries_[0].dictionaries_.length === 0) {
|
|
3563
|
+
if(_1.dictionaries_.length === 1) {
|
|
3528
3564
|
const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
3529
3565
|
if(_guard1) {
|
|
3530
3566
|
return (((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " < ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
|
|
@@ -3544,16 +3580,16 @@ return
|
|
|
3544
3580
|
if(_1.ECall) {
|
|
3545
3581
|
const at_ = _1.at_;
|
|
3546
3582
|
if(_1.target_.StaticCall) {
|
|
3547
|
-
if(_1.target_.name_
|
|
3548
|
-
if(_1.arguments_.
|
|
3549
|
-
const left_ = _1.arguments_
|
|
3550
|
-
if(_1.arguments_.
|
|
3551
|
-
const right_ = _1.arguments_
|
|
3552
|
-
if(_1.arguments_.
|
|
3553
|
-
if(_1.dictionaries_.
|
|
3554
|
-
const typeName_ = _1.dictionaries_.
|
|
3555
|
-
if(_1.dictionaries_.
|
|
3556
|
-
if(_1.dictionaries_.
|
|
3583
|
+
if(_1.target_.name_ === "ff:core/Ordering.notBefore") {
|
|
3584
|
+
if(_1.arguments_.length > 0) {
|
|
3585
|
+
const left_ = _1.arguments_[0];
|
|
3586
|
+
if(_1.arguments_.length > 1) {
|
|
3587
|
+
const right_ = _1.arguments_[1];
|
|
3588
|
+
if(_1.arguments_.length === 2) {
|
|
3589
|
+
if(_1.dictionaries_.length > 0) {
|
|
3590
|
+
const typeName_ = _1.dictionaries_[0].typeName_;
|
|
3591
|
+
if(_1.dictionaries_[0].dictionaries_.length === 0) {
|
|
3592
|
+
if(_1.dictionaries_.length === 1) {
|
|
3557
3593
|
const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
3558
3594
|
if(_guard1) {
|
|
3559
3595
|
return (((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " >= ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
|
|
@@ -3573,16 +3609,16 @@ return
|
|
|
3573
3609
|
if(_1.ECall) {
|
|
3574
3610
|
const at_ = _1.at_;
|
|
3575
3611
|
if(_1.target_.StaticCall) {
|
|
3576
|
-
if(_1.target_.name_
|
|
3577
|
-
if(_1.arguments_.
|
|
3578
|
-
const left_ = _1.arguments_
|
|
3579
|
-
if(_1.arguments_.
|
|
3580
|
-
const right_ = _1.arguments_
|
|
3581
|
-
if(_1.arguments_.
|
|
3582
|
-
if(_1.dictionaries_.
|
|
3583
|
-
const typeName_ = _1.dictionaries_.
|
|
3584
|
-
if(_1.dictionaries_.
|
|
3585
|
-
if(_1.dictionaries_.
|
|
3612
|
+
if(_1.target_.name_ === "ff:core/Ordering.after") {
|
|
3613
|
+
if(_1.arguments_.length > 0) {
|
|
3614
|
+
const left_ = _1.arguments_[0];
|
|
3615
|
+
if(_1.arguments_.length > 1) {
|
|
3616
|
+
const right_ = _1.arguments_[1];
|
|
3617
|
+
if(_1.arguments_.length === 2) {
|
|
3618
|
+
if(_1.dictionaries_.length > 0) {
|
|
3619
|
+
const typeName_ = _1.dictionaries_[0].typeName_;
|
|
3620
|
+
if(_1.dictionaries_[0].dictionaries_.length === 0) {
|
|
3621
|
+
if(_1.dictionaries_.length === 1) {
|
|
3586
3622
|
const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
3587
3623
|
if(_guard1) {
|
|
3588
3624
|
return (((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " > ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
|
|
@@ -3602,16 +3638,16 @@ return
|
|
|
3602
3638
|
if(_1.ECall) {
|
|
3603
3639
|
const at_ = _1.at_;
|
|
3604
3640
|
if(_1.target_.StaticCall) {
|
|
3605
|
-
if(_1.target_.name_
|
|
3606
|
-
if(_1.arguments_.
|
|
3607
|
-
const left_ = _1.arguments_
|
|
3608
|
-
if(_1.arguments_.
|
|
3609
|
-
const right_ = _1.arguments_
|
|
3610
|
-
if(_1.arguments_.
|
|
3611
|
-
if(_1.dictionaries_.
|
|
3612
|
-
const typeName_ = _1.dictionaries_.
|
|
3613
|
-
if(_1.dictionaries_.
|
|
3614
|
-
if(_1.dictionaries_.
|
|
3641
|
+
if(_1.target_.name_ === "ff:core/Ordering.notAfter") {
|
|
3642
|
+
if(_1.arguments_.length > 0) {
|
|
3643
|
+
const left_ = _1.arguments_[0];
|
|
3644
|
+
if(_1.arguments_.length > 1) {
|
|
3645
|
+
const right_ = _1.arguments_[1];
|
|
3646
|
+
if(_1.arguments_.length === 2) {
|
|
3647
|
+
if(_1.dictionaries_.length > 0) {
|
|
3648
|
+
const typeName_ = _1.dictionaries_[0].typeName_;
|
|
3649
|
+
if(_1.dictionaries_[0].dictionaries_.length === 0) {
|
|
3650
|
+
if(_1.dictionaries_.length === 1) {
|
|
3615
3651
|
const _guard1 = ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
3616
3652
|
if(_guard1) {
|
|
3617
3653
|
return (((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, left_, async_, $task))) + " <= ") + (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, right_, async_, $task))) + ")")
|
|
@@ -3630,24 +3666,24 @@ return
|
|
|
3630
3666
|
{
|
|
3631
3667
|
if(_1.ECall) {
|
|
3632
3668
|
if(_1.target_.StaticCall) {
|
|
3633
|
-
if(_1.target_.name_
|
|
3669
|
+
if(_1.target_.name_ === "ff:core/List.fillBy") {
|
|
3634
3670
|
const effect_ = _1.effect_;
|
|
3635
|
-
if(_1.arguments_.
|
|
3636
|
-
const size_ = _1.arguments_
|
|
3637
|
-
if(_1.arguments_.
|
|
3638
|
-
if(_1.arguments_.
|
|
3639
|
-
const at_ = _1.arguments_.
|
|
3640
|
-
const l_ = _1.arguments_.
|
|
3641
|
-
if(_1.arguments_.
|
|
3642
|
-
const c_ = _1.arguments_.
|
|
3643
|
-
if(_1.arguments_.
|
|
3644
|
-
if(_1.arguments_.
|
|
3645
|
-
const name_ = _1.arguments_.
|
|
3646
|
-
if(_1.arguments_.
|
|
3647
|
-
if(_1.arguments_.
|
|
3648
|
-
const body_ = _1.arguments_.
|
|
3649
|
-
if(_1.arguments_.
|
|
3650
|
-
if(_1.arguments_.
|
|
3671
|
+
if(_1.arguments_.length > 0) {
|
|
3672
|
+
const size_ = _1.arguments_[0];
|
|
3673
|
+
if(_1.arguments_.length > 1) {
|
|
3674
|
+
if(_1.arguments_[1].value_.ELambda) {
|
|
3675
|
+
const at_ = _1.arguments_[1].value_.at_;
|
|
3676
|
+
const l_ = _1.arguments_[1].value_.lambda_;
|
|
3677
|
+
if(_1.arguments_[1].value_.lambda_.cases_.length > 0) {
|
|
3678
|
+
const c_ = _1.arguments_[1].value_.lambda_.cases_[0];
|
|
3679
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length > 0) {
|
|
3680
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_[0].PVariable) {
|
|
3681
|
+
const name_ = _1.arguments_[1].value_.lambda_.cases_[0].patterns_[0].name_;
|
|
3682
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 1) {
|
|
3683
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
|
|
3684
|
+
const body_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
|
|
3685
|
+
if(_1.arguments_[1].value_.lambda_.cases_.length === 1) {
|
|
3686
|
+
if(_1.arguments_.length === 2) {
|
|
3651
3687
|
const _guard1 = (!ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
|
|
3652
3688
|
if(_guard1) {
|
|
3653
3689
|
const n_ = ff_core_Option.Option_else(ff_core_Option.Option_map(name_, ((_w1) => {
|
|
@@ -3702,9 +3738,9 @@ const emittedArguments_ = (await ff_core_List.List_map$(arguments_, (async (_w1,
|
|
|
3702
3738
|
return (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, _w1, async_, $task))
|
|
3703
3739
|
}), $task));
|
|
3704
3740
|
const controller_ = (await_
|
|
3705
|
-
?
|
|
3706
|
-
:
|
|
3707
|
-
const call_ = (((((d_ + ".") + n_) + "(") + ff_core_List.List_join(
|
|
3741
|
+
? ["$task"]
|
|
3742
|
+
: []);
|
|
3743
|
+
const call_ = (((((d_ + ".") + n_) + "(") + ff_core_List.List_join([...emittedArguments_, ...ds_, ...controller_], ", ")) + ")");
|
|
3708
3744
|
if(await_) {
|
|
3709
3745
|
return (("(await " + call_) + ")")
|
|
3710
3746
|
} else {
|
|
@@ -3724,10 +3760,18 @@ const effect_ = _1.effect_;
|
|
|
3724
3760
|
const typeArguments_ = _1.typeArguments_;
|
|
3725
3761
|
const arguments_ = _1.arguments_;
|
|
3726
3762
|
const dictionaries_ = _1.dictionaries_;
|
|
3763
|
+
if(ff_core_String.String_contains(name_, "bundleForBrowser")) {
|
|
3764
|
+
if((!ff_core_Option.Option_contains(ff_core_List.List_grab(arguments_, 0).name_, "system", ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
|
|
3765
|
+
ff_core_Log.debug_(("Wrong arguments for bundleForBrowser: " + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String)).show_(ff_core_List.List_map(arguments_, ((_w1) => {
|
|
3766
|
+
return _w1.name_
|
|
3767
|
+
})))));
|
|
3768
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.GrabException(), ff_core_Core.ff_core_Any_HasAnyTag$ff_core_Core_GrabException)})
|
|
3769
|
+
}
|
|
3770
|
+
};
|
|
3727
3771
|
{
|
|
3728
3772
|
const _1 = ff_compiler_JsEmitter.detectIfElse_(term_);
|
|
3729
3773
|
{
|
|
3730
|
-
if(_1.
|
|
3774
|
+
if(_1.length === 0) {
|
|
3731
3775
|
const await_ = (async_ && ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
|
|
3732
3776
|
const ds_ = (await ff_core_List.List_map$(dictionaries_, (async (_w1, $task) => {
|
|
3733
3777
|
return (await ff_compiler_JsEmitter.JsEmitter_emitDictionary$(self_, _w1, $task))
|
|
@@ -3739,9 +3783,9 @@ const emittedArguments_ = (await ff_core_List.List_map$(arguments_, (async (_w1,
|
|
|
3739
3783
|
return (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, _w1, async_, $task))
|
|
3740
3784
|
}), $task));
|
|
3741
3785
|
const controller_ = (await_
|
|
3742
|
-
?
|
|
3743
|
-
:
|
|
3744
|
-
const call_ = (((functionCode_ + "(") + ff_core_List.List_join(
|
|
3786
|
+
? ["$task"]
|
|
3787
|
+
: []);
|
|
3788
|
+
const call_ = (((functionCode_ + "(") + ff_core_List.List_join([...emittedArguments_, ...ds_, ...controller_], ", ")) + ")");
|
|
3745
3789
|
if(await_) {
|
|
3746
3790
|
return (("(await " + call_) + ")")
|
|
3747
3791
|
} else {
|
|
@@ -3751,11 +3795,11 @@ return
|
|
|
3751
3795
|
}
|
|
3752
3796
|
}
|
|
3753
3797
|
{
|
|
3754
|
-
if(_1.
|
|
3755
|
-
if(_1.
|
|
3756
|
-
if(_1.
|
|
3757
|
-
const elseBody_ = _1.
|
|
3758
|
-
const list_ = _1.
|
|
3798
|
+
if(_1.length > 0) {
|
|
3799
|
+
if(_1[0].first_.EVariant) {
|
|
3800
|
+
if(_1[0].first_.name_ === "ff:core/Bool.True") {
|
|
3801
|
+
const elseBody_ = _1[0].second_;
|
|
3802
|
+
const list_ = _1.slice(1);
|
|
3759
3803
|
return (("(" + (await ff_core_List.List_foldLeft$(list_, (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, elseBody_, async_, $task)), (async (_1, _2, $task) => {
|
|
3760
3804
|
{
|
|
3761
3805
|
const otherwise_ = _1;
|
|
@@ -3806,9 +3850,9 @@ const emittedArguments_ = (await ff_core_List.List_map$(arguments_, (async (_w1,
|
|
|
3806
3850
|
return (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, _w1, async_, $task))
|
|
3807
3851
|
}), $task));
|
|
3808
3852
|
const controller_ = (await_
|
|
3809
|
-
?
|
|
3810
|
-
:
|
|
3811
|
-
const call_ = (((functionCode_ + "(") + ff_core_List.List_join(
|
|
3853
|
+
? ["$task"]
|
|
3854
|
+
: []);
|
|
3855
|
+
const call_ = (((functionCode_ + "(") + ff_core_List.List_join([...emittedArguments_, ...controller_], ", ")) + ")");
|
|
3812
3856
|
if(await_) {
|
|
3813
3857
|
return (("(await " + call_) + ")")
|
|
3814
3858
|
} else {
|
|
@@ -3903,7 +3947,7 @@ return
|
|
|
3903
3947
|
{
|
|
3904
3948
|
if(_1.EVariant) {
|
|
3905
3949
|
const at_ = _1.at_;
|
|
3906
|
-
if(_1.name_
|
|
3950
|
+
if(_1.name_ === "ff:core/Unit.Unit") {
|
|
3907
3951
|
return ""
|
|
3908
3952
|
return
|
|
3909
3953
|
}
|
|
@@ -3914,7 +3958,7 @@ if(_1.ESequential) {
|
|
|
3914
3958
|
const at_ = _1.at_;
|
|
3915
3959
|
if(_1.before_.EVariant) {
|
|
3916
3960
|
const at_ = _1.before_.at_;
|
|
3917
|
-
if(_1.before_.name_
|
|
3961
|
+
if(_1.before_.name_ === "ff:core/Unit.Unit") {
|
|
3918
3962
|
const after_ = _1.after_;
|
|
3919
3963
|
return (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, after_, last_, async_, $task))
|
|
3920
3964
|
return
|
|
@@ -3928,7 +3972,7 @@ const at_ = _1.at_;
|
|
|
3928
3972
|
const before_ = _1.before_;
|
|
3929
3973
|
if(_1.after_.EVariant) {
|
|
3930
3974
|
const at_ = _1.after_.at_;
|
|
3931
|
-
if(_1.after_.name_
|
|
3975
|
+
if(_1.after_.name_ === "ff:core/Unit.Unit") {
|
|
3932
3976
|
return (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, before_, false, async_, $task))
|
|
3933
3977
|
return
|
|
3934
3978
|
}
|
|
@@ -3969,12 +4013,12 @@ return
|
|
|
3969
4013
|
if(_1.ECall) {
|
|
3970
4014
|
const at_ = _1.at_;
|
|
3971
4015
|
if(_1.target_.StaticCall) {
|
|
3972
|
-
if(_1.target_.name_
|
|
3973
|
-
if(_1.arguments_.
|
|
3974
|
-
const condition_ = _1.arguments_
|
|
3975
|
-
if(_1.arguments_.
|
|
3976
|
-
const body_ = _1.arguments_
|
|
3977
|
-
if(_1.arguments_.
|
|
4016
|
+
if(_1.target_.name_ === "ff:core/Core.while") {
|
|
4017
|
+
if(_1.arguments_.length > 0) {
|
|
4018
|
+
const condition_ = _1.arguments_[0];
|
|
4019
|
+
if(_1.arguments_.length > 1) {
|
|
4020
|
+
const body_ = _1.arguments_[1];
|
|
4021
|
+
if(_1.arguments_.length === 2) {
|
|
3978
4022
|
return (((("while(" + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, ff_compiler_JsEmitter.invokeImmediately_(condition_.value_), async_, $task))) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_), false, async_, $task))) + "\n}")
|
|
3979
4023
|
return
|
|
3980
4024
|
}
|
|
@@ -3988,10 +4032,10 @@ return
|
|
|
3988
4032
|
if(_1.ECall) {
|
|
3989
4033
|
const at_ = _1.at_;
|
|
3990
4034
|
if(_1.target_.StaticCall) {
|
|
3991
|
-
if(_1.target_.name_
|
|
3992
|
-
if(_1.arguments_.
|
|
3993
|
-
const doWhileBody_ = _1.arguments_.
|
|
3994
|
-
if(_1.arguments_.
|
|
4035
|
+
if(_1.target_.name_ === "ff:core/Core.doWhile") {
|
|
4036
|
+
if(_1.arguments_.length > 0) {
|
|
4037
|
+
const doWhileBody_ = _1.arguments_[0].value_;
|
|
4038
|
+
if(_1.arguments_.length === 1) {
|
|
3995
4039
|
const _guard1 = ff_compiler_JsEmitter.invokeImmediately_(doWhileBody_);
|
|
3996
4040
|
if(_guard1.ESequential) {
|
|
3997
4041
|
const body_ = _guard1.before_;
|
|
@@ -4009,10 +4053,10 @@ return
|
|
|
4009
4053
|
if(_1.ECall) {
|
|
4010
4054
|
const at_ = _1.at_;
|
|
4011
4055
|
if(_1.target_.StaticCall) {
|
|
4012
|
-
if(_1.target_.name_
|
|
4013
|
-
if(_1.arguments_.
|
|
4014
|
-
const doWhileBody_ = _1.arguments_.
|
|
4015
|
-
if(_1.arguments_.
|
|
4056
|
+
if(_1.target_.name_ === "ff:core/Core.doWhile") {
|
|
4057
|
+
if(_1.arguments_.length > 0) {
|
|
4058
|
+
const doWhileBody_ = _1.arguments_[0].value_;
|
|
4059
|
+
if(_1.arguments_.length === 1) {
|
|
4016
4060
|
const _guard1 = ff_compiler_JsEmitter.invokeImmediately_(doWhileBody_);
|
|
4017
4061
|
const body_ = _guard1;
|
|
4018
4062
|
return (("while(" + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, body_, async_, $task))) + ") {}")
|
|
@@ -4027,12 +4071,12 @@ return
|
|
|
4027
4071
|
if(_1.ECall) {
|
|
4028
4072
|
const at_ = _1.at_;
|
|
4029
4073
|
if(_1.target_.StaticCall) {
|
|
4030
|
-
if(_1.target_.name_
|
|
4031
|
-
if(_1.arguments_.
|
|
4032
|
-
const condition_ = _1.arguments_
|
|
4033
|
-
if(_1.arguments_.
|
|
4034
|
-
const body_ = _1.arguments_
|
|
4035
|
-
if(_1.arguments_.
|
|
4074
|
+
if(_1.target_.name_ === "ff:core/Core.if") {
|
|
4075
|
+
if(_1.arguments_.length > 0) {
|
|
4076
|
+
const condition_ = _1.arguments_[0];
|
|
4077
|
+
if(_1.arguments_.length > 1) {
|
|
4078
|
+
const body_ = _1.arguments_[1];
|
|
4079
|
+
if(_1.arguments_.length === 2) {
|
|
4036
4080
|
return ((("if(" + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, condition_.value_, async_, $task))) + ") {\n") + (last_
|
|
4037
4081
|
? (("return ff_core_Option.Some(" + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_), async_, $task))) + ")\n} else return ff_core_Option.None()")
|
|
4038
4082
|
: ((await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, ff_compiler_JsEmitter.invokeImmediately_(body_.value_), false, async_, $task)) + "\n}")))
|
|
@@ -4048,13 +4092,13 @@ return
|
|
|
4048
4092
|
if(_1.ECall) {
|
|
4049
4093
|
const at_ = _1.at_;
|
|
4050
4094
|
if(_1.target_.StaticCall) {
|
|
4051
|
-
if(_1.target_.name_
|
|
4052
|
-
if(_1.arguments_.
|
|
4053
|
-
const argument_ = _1.arguments_
|
|
4054
|
-
if(_1.arguments_.
|
|
4055
|
-
if(_1.dictionaries_.
|
|
4056
|
-
const dictionary_ = _1.dictionaries_
|
|
4057
|
-
if(_1.dictionaries_.
|
|
4095
|
+
if(_1.target_.name_ === "ff:core/Core.throw") {
|
|
4096
|
+
if(_1.arguments_.length > 0) {
|
|
4097
|
+
const argument_ = _1.arguments_[0];
|
|
4098
|
+
if(_1.arguments_.length === 1) {
|
|
4099
|
+
if(_1.dictionaries_.length > 0) {
|
|
4100
|
+
const dictionary_ = _1.dictionaries_[0];
|
|
4101
|
+
if(_1.dictionaries_.length === 1) {
|
|
4058
4102
|
const d_ = (await ff_compiler_JsEmitter.JsEmitter_emitDictionary$(self_, dictionary_, $task));
|
|
4059
4103
|
const a_ = (await ff_compiler_JsEmitter.JsEmitter_emitArgument$(self_, at_, argument_, async_, $task));
|
|
4060
4104
|
return (((("throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(" + a_) + ", ") + d_) + ")})")
|
|
@@ -4071,7 +4115,7 @@ return
|
|
|
4071
4115
|
if(_1.ECall) {
|
|
4072
4116
|
const at_ = _1.at_;
|
|
4073
4117
|
if(_1.target_.StaticCall) {
|
|
4074
|
-
if(_1.target_.name_
|
|
4118
|
+
if(_1.target_.name_ === "ff:core/Core.try") {
|
|
4075
4119
|
const _guard1 = (!last_);
|
|
4076
4120
|
if(_guard1) {
|
|
4077
4121
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a try without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -4085,7 +4129,7 @@ return
|
|
|
4085
4129
|
if(_1.ECall) {
|
|
4086
4130
|
const at_ = _1.at_;
|
|
4087
4131
|
if(_1.target_.StaticCall) {
|
|
4088
|
-
if(_1.target_.name_
|
|
4132
|
+
if(_1.target_.name_ === "ff:core/Try.Try_map") {
|
|
4089
4133
|
const _guard1 = (!last_);
|
|
4090
4134
|
if(_guard1) {
|
|
4091
4135
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a map without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -4099,7 +4143,7 @@ return
|
|
|
4099
4143
|
if(_1.ECall) {
|
|
4100
4144
|
const at_ = _1.at_;
|
|
4101
4145
|
if(_1.target_.StaticCall) {
|
|
4102
|
-
if(_1.target_.name_
|
|
4146
|
+
if(_1.target_.name_ === "ff:core/Try.Try_flatMap") {
|
|
4103
4147
|
const _guard1 = (!last_);
|
|
4104
4148
|
if(_guard1) {
|
|
4105
4149
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a flatMap without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -4113,7 +4157,7 @@ return
|
|
|
4113
4157
|
if(_1.ECall) {
|
|
4114
4158
|
const at_ = _1.at_;
|
|
4115
4159
|
if(_1.target_.StaticCall) {
|
|
4116
|
-
if(_1.target_.name_
|
|
4160
|
+
if(_1.target_.name_ === "ff:core/Try.Try_flatten") {
|
|
4117
4161
|
const _guard1 = (!last_);
|
|
4118
4162
|
if(_guard1) {
|
|
4119
4163
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a flatten without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -4127,7 +4171,7 @@ return
|
|
|
4127
4171
|
if(_1.ECall) {
|
|
4128
4172
|
const at_ = _1.at_;
|
|
4129
4173
|
if(_1.target_.StaticCall) {
|
|
4130
|
-
if(_1.target_.name_
|
|
4174
|
+
if(_1.target_.name_ === "ff:core/Try.Try_catch") {
|
|
4131
4175
|
const _guard1 = (!last_);
|
|
4132
4176
|
if(_guard1) {
|
|
4133
4177
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a catch without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -4141,7 +4185,7 @@ return
|
|
|
4141
4185
|
if(_1.ECall) {
|
|
4142
4186
|
const at_ = _1.at_;
|
|
4143
4187
|
if(_1.target_.StaticCall) {
|
|
4144
|
-
if(_1.target_.name_
|
|
4188
|
+
if(_1.target_.name_ === "ff:core/Try.Try_catchAny") {
|
|
4145
4189
|
const _guard1 = (!last_);
|
|
4146
4190
|
if(_guard1) {
|
|
4147
4191
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a catchAny without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -4155,7 +4199,7 @@ return
|
|
|
4155
4199
|
if(_1.ECall) {
|
|
4156
4200
|
const at_ = _1.at_;
|
|
4157
4201
|
if(_1.target_.StaticCall) {
|
|
4158
|
-
if(_1.target_.name_
|
|
4202
|
+
if(_1.target_.name_ === "ff:core/Try.Try_finally") {
|
|
4159
4203
|
const _guard1 = (!last_);
|
|
4160
4204
|
if(_guard1) {
|
|
4161
4205
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Statements can't be a finally without a grab"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
@@ -4169,10 +4213,10 @@ return
|
|
|
4169
4213
|
if(_1.ECall) {
|
|
4170
4214
|
const at_ = _1.at_;
|
|
4171
4215
|
if(_1.target_.StaticCall) {
|
|
4172
|
-
if(_1.target_.name_
|
|
4173
|
-
if(_1.arguments_.
|
|
4174
|
-
const argument_ = _1.arguments_
|
|
4175
|
-
if(_1.arguments_.
|
|
4216
|
+
if(_1.target_.name_ === "ff:core/Try.Try_grab") {
|
|
4217
|
+
if(_1.arguments_.length > 0) {
|
|
4218
|
+
const argument_ = _1.arguments_[0];
|
|
4219
|
+
if(_1.arguments_.length === 1) {
|
|
4176
4220
|
const _guard1 = (await ff_compiler_JsEmitter.JsEmitter_emitTryCatchFinally$(self_, argument_.value_, last_, async_, $task));
|
|
4177
4221
|
if(_guard1.Some) {
|
|
4178
4222
|
const code_ = _guard1.value_;
|
|
@@ -4189,8 +4233,8 @@ return
|
|
|
4189
4233
|
if(_1.ECall) {
|
|
4190
4234
|
const at_ = _1.at_;
|
|
4191
4235
|
if(_1.target_.StaticCall) {
|
|
4192
|
-
if(_1.target_.name_
|
|
4193
|
-
if(_1.arguments_.
|
|
4236
|
+
if(_1.target_.name_ === "ff:unsafejs/UnsafeJs.throwIfCancelled") {
|
|
4237
|
+
if(_1.arguments_.length === 0) {
|
|
4194
4238
|
if(async_) {
|
|
4195
4239
|
return "ff_core_Task.Task_throwIfAborted($task)"
|
|
4196
4240
|
} else {
|
|
@@ -4236,7 +4280,7 @@ ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
|
|
|
4236
4280
|
return ((((((((!last_)
|
|
4237
4281
|
? "do "
|
|
4238
4282
|
: "") + "{\nconst _1 = ") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, value_, async_, $task))) + ";\n") + ff_core_List.List_join((await ff_core_List.List_map$(cases_, (async (_w1, $task) => {
|
|
4239
|
-
return (("{\n" + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_,
|
|
4283
|
+
return (("{\n" + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, ["_1"], _w1, true, last_, async_, $task))) + "\n}")
|
|
4240
4284
|
}), $task)), "\n")) + "\n}") + ((!last_)
|
|
4241
4285
|
? " while(false)"
|
|
4242
4286
|
: ""))
|
|
@@ -4248,7 +4292,7 @@ return
|
|
|
4248
4292
|
{
|
|
4249
4293
|
const _1 = ff_compiler_JsEmitter.detectIfElse_(term_);
|
|
4250
4294
|
{
|
|
4251
|
-
if(_1.
|
|
4295
|
+
if(_1.length === 0) {
|
|
4252
4296
|
if(last_) {
|
|
4253
4297
|
return ("return " + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, term_, async_, $task)))
|
|
4254
4298
|
} else {
|
|
@@ -4258,11 +4302,11 @@ return
|
|
|
4258
4302
|
}
|
|
4259
4303
|
}
|
|
4260
4304
|
{
|
|
4261
|
-
if(_1.
|
|
4262
|
-
if(_1.
|
|
4263
|
-
if(_1.
|
|
4264
|
-
const elseBody_ = _1.
|
|
4265
|
-
const list_ = _1.
|
|
4305
|
+
if(_1.length > 0) {
|
|
4306
|
+
if(_1[0].first_.EVariant) {
|
|
4307
|
+
if(_1[0].first_.name_ === "ff:core/Bool.True") {
|
|
4308
|
+
const elseBody_ = _1[0].second_;
|
|
4309
|
+
const list_ = _1.slice(1);
|
|
4266
4310
|
const initial_ = (("{\n" + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, elseBody_, last_, async_, $task))) + "\n}");
|
|
4267
4311
|
return (await ff_core_List.List_foldLeft$(list_, initial_, (async (_1, _2, $task) => {
|
|
4268
4312
|
{
|
|
@@ -4317,13 +4361,13 @@ export async function JsEmitter_emitTryCatchFinally$(self_, term_, last_, async_
|
|
|
4317
4361
|
async function emitCatch_$(catchEffect_, cases_, $task) {
|
|
4318
4362
|
const catchAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(catchEffect_));
|
|
4319
4363
|
ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
|
|
4320
|
-
const arguments_ =
|
|
4364
|
+
const arguments_ = ["_exception.value_", "_error"];
|
|
4321
4365
|
{
|
|
4322
4366
|
const _1 = cases_;
|
|
4323
4367
|
{
|
|
4324
|
-
if(_1.
|
|
4325
|
-
const case_ = _1
|
|
4326
|
-
if(_1.
|
|
4368
|
+
if(_1.length > 0) {
|
|
4369
|
+
const case_ = _1[0];
|
|
4370
|
+
if(_1.length === 1) {
|
|
4327
4371
|
return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, case_, false, last_, catchAsync_, $task))
|
|
4328
4372
|
return
|
|
4329
4373
|
}
|
|
@@ -4349,30 +4393,30 @@ const _1 = term_;
|
|
|
4349
4393
|
if(_1.ECall) {
|
|
4350
4394
|
const at_ = _1.at_;
|
|
4351
4395
|
if(_1.target_.StaticCall) {
|
|
4352
|
-
if(_1.target_.name_
|
|
4353
|
-
if(_1.arguments_.
|
|
4354
|
-
if(_1.arguments_.
|
|
4355
|
-
const at_ = _1.arguments_.
|
|
4356
|
-
if(_1.arguments_.
|
|
4357
|
-
if(_1.arguments_.
|
|
4358
|
-
if(_1.arguments_.
|
|
4359
|
-
if(_1.arguments_.
|
|
4360
|
-
const tryEffect_ = _1.arguments_.
|
|
4361
|
-
if(_1.arguments_.
|
|
4362
|
-
if(_1.arguments_.
|
|
4363
|
-
if(_1.arguments_.
|
|
4364
|
-
const tryBody_ = _1.arguments_.
|
|
4365
|
-
if(_1.arguments_.
|
|
4366
|
-
if(_1.arguments_.
|
|
4367
|
-
if(_1.arguments_.
|
|
4368
|
-
if(_1.arguments_.
|
|
4369
|
-
const finallyEffect_ = _1.arguments_.
|
|
4370
|
-
if(_1.arguments_.
|
|
4371
|
-
if(_1.arguments_.
|
|
4372
|
-
if(_1.arguments_.
|
|
4373
|
-
const finallyBody_ = _1.arguments_.
|
|
4374
|
-
if(_1.arguments_.
|
|
4375
|
-
if(_1.arguments_.
|
|
4396
|
+
if(_1.target_.name_ === "ff:core/Try.Try_finally") {
|
|
4397
|
+
if(_1.arguments_.length > 0) {
|
|
4398
|
+
if(_1.arguments_[0].value_.ECall) {
|
|
4399
|
+
const at_ = _1.arguments_[0].value_.at_;
|
|
4400
|
+
if(_1.arguments_[0].value_.target_.StaticCall) {
|
|
4401
|
+
if(_1.arguments_[0].value_.target_.name_ === "ff:core/Core.try") {
|
|
4402
|
+
if(_1.arguments_[0].value_.arguments_.length > 0) {
|
|
4403
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.ELambda) {
|
|
4404
|
+
const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
|
|
4405
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length > 0) {
|
|
4406
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0) {
|
|
4407
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0) {
|
|
4408
|
+
const tryBody_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].body_;
|
|
4409
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1) {
|
|
4410
|
+
if(_1.arguments_[0].value_.arguments_.length === 1) {
|
|
4411
|
+
if(_1.arguments_.length > 1) {
|
|
4412
|
+
if(_1.arguments_[1].value_.ELambda) {
|
|
4413
|
+
const finallyEffect_ = _1.arguments_[1].value_.lambda_.effect_;
|
|
4414
|
+
if(_1.arguments_[1].value_.lambda_.cases_.length > 0) {
|
|
4415
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 0) {
|
|
4416
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
|
|
4417
|
+
const finallyBody_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
|
|
4418
|
+
if(_1.arguments_[1].value_.lambda_.cases_.length === 1) {
|
|
4419
|
+
if(_1.arguments_.length === 2) {
|
|
4376
4420
|
const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
|
|
4377
4421
|
const finallyAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(finallyEffect_));
|
|
4378
4422
|
return ff_core_Option.Some((((("try {\n" + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, tryBody_, last_, tryAsync_, $task))) + "\n} finally {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, finallyBody_, last_, finallyAsync_, $task))) + "\n}"))
|
|
@@ -4403,29 +4447,29 @@ return
|
|
|
4403
4447
|
if(_1.ECall) {
|
|
4404
4448
|
const at_ = _1.at_;
|
|
4405
4449
|
if(_1.target_.StaticCall) {
|
|
4406
|
-
if(_1.target_.name_
|
|
4407
|
-
if(_1.arguments_.
|
|
4408
|
-
if(_1.arguments_.
|
|
4409
|
-
const at_ = _1.arguments_.
|
|
4410
|
-
if(_1.arguments_.
|
|
4411
|
-
if(_1.arguments_.
|
|
4412
|
-
if(_1.arguments_.
|
|
4413
|
-
if(_1.arguments_.
|
|
4414
|
-
const tryEffect_ = _1.arguments_.
|
|
4415
|
-
if(_1.arguments_.
|
|
4416
|
-
if(_1.arguments_.
|
|
4417
|
-
if(_1.arguments_.
|
|
4418
|
-
const tryBody_ = _1.arguments_.
|
|
4419
|
-
if(_1.arguments_.
|
|
4420
|
-
if(_1.arguments_.
|
|
4421
|
-
if(_1.arguments_.
|
|
4422
|
-
if(_1.arguments_.
|
|
4423
|
-
const catchEffect_ = _1.arguments_.
|
|
4424
|
-
const cases_ = _1.arguments_.
|
|
4425
|
-
if(_1.arguments_.
|
|
4426
|
-
if(_1.dictionaries_.
|
|
4427
|
-
const dictionary_ = _1.dictionaries_
|
|
4428
|
-
if(_1.dictionaries_.
|
|
4450
|
+
if(_1.target_.name_ === "ff:core/Try.Try_catch") {
|
|
4451
|
+
if(_1.arguments_.length > 0) {
|
|
4452
|
+
if(_1.arguments_[0].value_.ECall) {
|
|
4453
|
+
const at_ = _1.arguments_[0].value_.at_;
|
|
4454
|
+
if(_1.arguments_[0].value_.target_.StaticCall) {
|
|
4455
|
+
if(_1.arguments_[0].value_.target_.name_ === "ff:core/Core.try") {
|
|
4456
|
+
if(_1.arguments_[0].value_.arguments_.length > 0) {
|
|
4457
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.ELambda) {
|
|
4458
|
+
const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
|
|
4459
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length > 0) {
|
|
4460
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0) {
|
|
4461
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0) {
|
|
4462
|
+
const tryBody_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].body_;
|
|
4463
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1) {
|
|
4464
|
+
if(_1.arguments_[0].value_.arguments_.length === 1) {
|
|
4465
|
+
if(_1.arguments_.length > 1) {
|
|
4466
|
+
if(_1.arguments_[1].value_.ELambda) {
|
|
4467
|
+
const catchEffect_ = _1.arguments_[1].value_.lambda_.effect_;
|
|
4468
|
+
const cases_ = _1.arguments_[1].value_.lambda_.cases_;
|
|
4469
|
+
if(_1.arguments_.length === 2) {
|
|
4470
|
+
if(_1.dictionaries_.length > 0) {
|
|
4471
|
+
const dictionary_ = _1.dictionaries_[0];
|
|
4472
|
+
if(_1.dictionaries_.length === 1) {
|
|
4429
4473
|
const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
|
|
4430
4474
|
const d_ = (await ff_compiler_JsEmitter.JsEmitter_emitDictionary$(self_, dictionary_, $task));
|
|
4431
4475
|
return ff_core_Option.Some(((((((((("try {\n" + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, tryBody_, last_, tryAsync_, $task))) + "\n} catch(_error) {\n") + "if(!_error.ffException) throw _error\n") + "const _exception = ff_core_Any.fromAny_(_error.ffException, ") + d_) + ")\n") + "if(!_exception.Some) throw _error\n") + (await emitCatch_$(catchEffect_, cases_, $task))) + "\n}"))
|
|
@@ -4454,43 +4498,43 @@ return
|
|
|
4454
4498
|
if(_1.ECall) {
|
|
4455
4499
|
const at_ = _1.at_;
|
|
4456
4500
|
if(_1.target_.StaticCall) {
|
|
4457
|
-
if(_1.target_.name_
|
|
4458
|
-
if(_1.arguments_.
|
|
4459
|
-
if(_1.arguments_.
|
|
4460
|
-
const at_ = _1.arguments_.
|
|
4461
|
-
if(_1.arguments_.
|
|
4462
|
-
if(_1.arguments_.
|
|
4463
|
-
if(_1.arguments_.
|
|
4464
|
-
if(_1.arguments_.
|
|
4465
|
-
const at_ = _1.arguments_.
|
|
4466
|
-
if(_1.arguments_.
|
|
4467
|
-
if(_1.arguments_.
|
|
4468
|
-
if(_1.arguments_.
|
|
4469
|
-
if(_1.arguments_.
|
|
4470
|
-
const tryEffect_ = _1.arguments_.
|
|
4471
|
-
if(_1.arguments_.
|
|
4472
|
-
if(_1.arguments_.
|
|
4473
|
-
if(_1.arguments_.
|
|
4474
|
-
const tryBody_ = _1.arguments_.
|
|
4475
|
-
if(_1.arguments_.
|
|
4476
|
-
if(_1.arguments_.
|
|
4477
|
-
if(_1.arguments_.
|
|
4478
|
-
if(_1.arguments_.
|
|
4479
|
-
const catchEffect_ = _1.arguments_.
|
|
4480
|
-
const cases_ = _1.arguments_.
|
|
4481
|
-
if(_1.arguments_.
|
|
4482
|
-
if(_1.arguments_.
|
|
4483
|
-
const dictionary_ = _1.arguments_.
|
|
4484
|
-
if(_1.arguments_.
|
|
4485
|
-
if(_1.arguments_.
|
|
4486
|
-
if(_1.arguments_.
|
|
4487
|
-
const finallyEffect_ = _1.arguments_.
|
|
4488
|
-
if(_1.arguments_.
|
|
4489
|
-
if(_1.arguments_.
|
|
4490
|
-
if(_1.arguments_.
|
|
4491
|
-
const finallyBody_ = _1.arguments_.
|
|
4492
|
-
if(_1.arguments_.
|
|
4493
|
-
if(_1.arguments_.
|
|
4501
|
+
if(_1.target_.name_ === "ff:core/Try.Try_finally") {
|
|
4502
|
+
if(_1.arguments_.length > 0) {
|
|
4503
|
+
if(_1.arguments_[0].value_.ECall) {
|
|
4504
|
+
const at_ = _1.arguments_[0].value_.at_;
|
|
4505
|
+
if(_1.arguments_[0].value_.target_.StaticCall) {
|
|
4506
|
+
if(_1.arguments_[0].value_.target_.name_ === "ff:core/Try.Try_catch") {
|
|
4507
|
+
if(_1.arguments_[0].value_.arguments_.length > 0) {
|
|
4508
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.ECall) {
|
|
4509
|
+
const at_ = _1.arguments_[0].value_.arguments_[0].value_.at_;
|
|
4510
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.target_.StaticCall) {
|
|
4511
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.target_.name_ === "ff:core/Core.try") {
|
|
4512
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_.length > 0) {
|
|
4513
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.ELambda) {
|
|
4514
|
+
const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
|
|
4515
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length > 0) {
|
|
4516
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0) {
|
|
4517
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0) {
|
|
4518
|
+
const tryBody_ = _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].body_;
|
|
4519
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1) {
|
|
4520
|
+
if(_1.arguments_[0].value_.arguments_[0].value_.arguments_.length === 1) {
|
|
4521
|
+
if(_1.arguments_[0].value_.arguments_.length > 1) {
|
|
4522
|
+
if(_1.arguments_[0].value_.arguments_[1].value_.ELambda) {
|
|
4523
|
+
const catchEffect_ = _1.arguments_[0].value_.arguments_[1].value_.lambda_.effect_;
|
|
4524
|
+
const cases_ = _1.arguments_[0].value_.arguments_[1].value_.lambda_.cases_;
|
|
4525
|
+
if(_1.arguments_[0].value_.arguments_.length === 2) {
|
|
4526
|
+
if(_1.arguments_[0].value_.dictionaries_.length > 0) {
|
|
4527
|
+
const dictionary_ = _1.arguments_[0].value_.dictionaries_[0];
|
|
4528
|
+
if(_1.arguments_[0].value_.dictionaries_.length === 1) {
|
|
4529
|
+
if(_1.arguments_.length > 1) {
|
|
4530
|
+
if(_1.arguments_[1].value_.ELambda) {
|
|
4531
|
+
const finallyEffect_ = _1.arguments_[1].value_.lambda_.effect_;
|
|
4532
|
+
if(_1.arguments_[1].value_.lambda_.cases_.length > 0) {
|
|
4533
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 0) {
|
|
4534
|
+
if(_1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
|
|
4535
|
+
const finallyBody_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
|
|
4536
|
+
if(_1.arguments_[1].value_.lambda_.cases_.length === 1) {
|
|
4537
|
+
if(_1.arguments_.length === 2) {
|
|
4494
4538
|
const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
|
|
4495
4539
|
const finallyAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(finallyEffect_));
|
|
4496
4540
|
const d_ = (await ff_compiler_JsEmitter.JsEmitter_emitDictionary$(self_, dictionary_, $task));
|
|
@@ -4538,9 +4582,9 @@ export async function JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_,
|
|
|
4538
4582
|
{
|
|
4539
4583
|
const _1 = ff_core_Pair.Pair(matchCase_.patterns_, matchCase_.guards_);
|
|
4540
4584
|
{
|
|
4541
|
-
if(_1.first_.
|
|
4542
|
-
const p_ = _1.first_
|
|
4543
|
-
const ps_ = _1.first_.
|
|
4585
|
+
if(_1.first_.length > 0) {
|
|
4586
|
+
const p_ = _1.first_[0];
|
|
4587
|
+
const ps_ = _1.first_.slice(1);
|
|
4544
4588
|
return (await ff_compiler_JsEmitter.JsEmitter_emitPattern$(self_, ff_core_List.List_grab(arguments_, 0), p_, ff_core_List.List_dropFirst(arguments_, 1), (((_c) => {
|
|
4545
4589
|
return ff_compiler_Syntax.MatchCase(_c.at_, ps_, _c.guards_, _c.body_)
|
|
4546
4590
|
}))(matchCase_), jump_, last_, async_, $task))
|
|
@@ -4548,22 +4592,22 @@ return
|
|
|
4548
4592
|
}
|
|
4549
4593
|
}
|
|
4550
4594
|
{
|
|
4551
|
-
if(_1.first_.
|
|
4552
|
-
if(_1.second_.
|
|
4553
|
-
const guard_ = _1.second_
|
|
4554
|
-
const guards_ = _1.second_.
|
|
4595
|
+
if(_1.first_.length === 0) {
|
|
4596
|
+
if(_1.second_.length > 0) {
|
|
4597
|
+
const guard_ = _1.second_[0];
|
|
4598
|
+
const guards_ = _1.second_.slice(1);
|
|
4555
4599
|
const guardName_ = ("_guard" + (ff_core_List.List_size(guards_) + 1));
|
|
4556
4600
|
const newCase_ = (((_c) => {
|
|
4557
|
-
return ff_compiler_Syntax.MatchCase(_c.at_,
|
|
4601
|
+
return ff_compiler_Syntax.MatchCase(_c.at_, [guard_.pattern_], guards_, _c.body_)
|
|
4558
4602
|
}))(matchCase_);
|
|
4559
|
-
return ((((("const " + guardName_) + " = ") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, guard_.term_, async_, $task))) + ";\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_,
|
|
4603
|
+
return ((((("const " + guardName_) + " = ") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, guard_.term_, async_, $task))) + ";\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, [guardName_], newCase_, jump_, last_, async_, $task)))
|
|
4560
4604
|
return
|
|
4561
4605
|
}
|
|
4562
4606
|
}
|
|
4563
4607
|
}
|
|
4564
4608
|
{
|
|
4565
|
-
if(_1.first_.
|
|
4566
|
-
if(_1.second_.
|
|
4609
|
+
if(_1.first_.length === 0) {
|
|
4610
|
+
if(_1.second_.length === 0) {
|
|
4567
4611
|
return ((await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, matchCase_.body_, last_, async_, $task)) + ((jump_ && last_)
|
|
4568
4612
|
? "\nreturn"
|
|
4569
4613
|
: jump_
|
|
@@ -4582,21 +4626,21 @@ const _1 = pattern_;
|
|
|
4582
4626
|
{
|
|
4583
4627
|
if(_1.PString) {
|
|
4584
4628
|
const value_ = _1.value_;
|
|
4585
|
-
return (((((("if(" + argument_) + "
|
|
4629
|
+
return (((((("if(" + argument_) + " === ") + value_) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))) + "\n}")
|
|
4586
4630
|
return
|
|
4587
4631
|
}
|
|
4588
4632
|
}
|
|
4589
4633
|
{
|
|
4590
4634
|
if(_1.PInt) {
|
|
4591
4635
|
const value_ = _1.value_;
|
|
4592
|
-
return (((((("if(" + argument_) + "
|
|
4636
|
+
return (((((("if(" + argument_) + " === ") + value_) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))) + "\n}")
|
|
4593
4637
|
return
|
|
4594
4638
|
}
|
|
4595
4639
|
}
|
|
4596
4640
|
{
|
|
4597
4641
|
if(_1.PChar) {
|
|
4598
4642
|
const value_ = _1.value_;
|
|
4599
|
-
return (((((("if(" + argument_) + "
|
|
4643
|
+
return (((((("if(" + argument_) + " === ") + ff_compiler_JsEmitter.charLiteralToNumber_(value_)) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))) + "\n}")
|
|
4600
4644
|
return
|
|
4601
4645
|
}
|
|
4602
4646
|
}
|
|
@@ -4622,8 +4666,8 @@ return
|
|
|
4622
4666
|
}
|
|
4623
4667
|
{
|
|
4624
4668
|
if(_1.PVariant) {
|
|
4625
|
-
if(_1.name_
|
|
4626
|
-
if(_1.patterns_.
|
|
4669
|
+
if(_1.name_ === "ff:core/Bool.False") {
|
|
4670
|
+
if(_1.patterns_.length === 0) {
|
|
4627
4671
|
return (((("if(!" + argument_) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))) + "\n}")
|
|
4628
4672
|
return
|
|
4629
4673
|
}
|
|
@@ -4632,8 +4676,8 @@ return
|
|
|
4632
4676
|
}
|
|
4633
4677
|
{
|
|
4634
4678
|
if(_1.PVariant) {
|
|
4635
|
-
if(_1.name_
|
|
4636
|
-
if(_1.patterns_.
|
|
4679
|
+
if(_1.name_ === "ff:core/Bool.True") {
|
|
4680
|
+
if(_1.patterns_.length === 0) {
|
|
4637
4681
|
return (((("if(" + argument_) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))) + "\n}")
|
|
4638
4682
|
return
|
|
4639
4683
|
}
|
|
@@ -4642,15 +4686,57 @@ return
|
|
|
4642
4686
|
}
|
|
4643
4687
|
{
|
|
4644
4688
|
if(_1.PVariant) {
|
|
4689
|
+
if(_1.name_ === "List$Empty") {
|
|
4690
|
+
if(_1.patterns_.length === 0) {
|
|
4691
|
+
let shortArgument_ = argument_;
|
|
4692
|
+
let shortCount_ = 0;
|
|
4693
|
+
while(ff_core_String.String_endsWith(shortArgument_, ".slice(1)")) {
|
|
4694
|
+
shortArgument_ = ff_core_String.String_dropLast(shortArgument_, ff_core_String.String_size(".slice(1)"));
|
|
4695
|
+
shortCount_ += 1
|
|
4696
|
+
};
|
|
4697
|
+
return (((((("if(" + shortArgument_) + ".length === ") + shortCount_) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, arguments_, matchCase_, jump_, last_, async_, $task))) + "\n}")
|
|
4698
|
+
return
|
|
4699
|
+
}
|
|
4700
|
+
}
|
|
4701
|
+
}
|
|
4702
|
+
}
|
|
4703
|
+
{
|
|
4704
|
+
if(_1.PVariant) {
|
|
4705
|
+
if(_1.name_ === "List$Link") {
|
|
4706
|
+
if(_1.patterns_.length > 0) {
|
|
4707
|
+
const head_ = _1.patterns_[0];
|
|
4708
|
+
if(_1.patterns_.length > 1) {
|
|
4709
|
+
const tail_ = _1.patterns_[1];
|
|
4710
|
+
if(_1.patterns_.length === 2) {
|
|
4711
|
+
let shortArgument_ = argument_;
|
|
4712
|
+
let shortCount_ = 0;
|
|
4713
|
+
while(ff_core_String.String_endsWith(shortArgument_, ".slice(1)")) {
|
|
4714
|
+
shortArgument_ = ff_core_String.String_dropLast(shortArgument_, ff_core_String.String_size(".slice(1)"));
|
|
4715
|
+
shortCount_ += 1
|
|
4716
|
+
};
|
|
4717
|
+
const newArguments_ = [(((shortArgument_ + "[") + shortCount_) + "]"), (argument_ + ".slice(1)"), ...arguments_];
|
|
4718
|
+
const newMatchCase_ = (((_c) => {
|
|
4719
|
+
return ff_compiler_Syntax.MatchCase(_c.at_, [head_, tail_, ...matchCase_.patterns_], _c.guards_, _c.body_)
|
|
4720
|
+
}))(matchCase_);
|
|
4721
|
+
return (((((("if(" + shortArgument_) + ".length > ") + shortCount_) + ") {\n") + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, newArguments_, newMatchCase_, jump_, last_, async_, $task))) + "\n}")
|
|
4722
|
+
return
|
|
4723
|
+
}
|
|
4724
|
+
}
|
|
4725
|
+
}
|
|
4726
|
+
}
|
|
4727
|
+
}
|
|
4728
|
+
}
|
|
4729
|
+
{
|
|
4730
|
+
if(_1.PVariant) {
|
|
4645
4731
|
const name_ = _1.name_;
|
|
4646
4732
|
const patterns_ = _1.patterns_;
|
|
4647
4733
|
const processed_ = (await ff_compiler_JsEmitter.JsEmitter_processVariantCase$(self_, name_, argument_, $task));
|
|
4648
4734
|
const newMatchCase_ = (((_c) => {
|
|
4649
|
-
return ff_compiler_Syntax.MatchCase(_c.at_,
|
|
4735
|
+
return ff_compiler_Syntax.MatchCase(_c.at_, [...patterns_, ...matchCase_.patterns_], _c.guards_, _c.body_)
|
|
4650
4736
|
}))(matchCase_);
|
|
4651
4737
|
return (((processed_.loneVariant_
|
|
4652
4738
|
? ""
|
|
4653
|
-
: (((("if(" + argument_) + ".") + processed_.variantName_) + ") {\n")) + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_,
|
|
4739
|
+
: (((("if(" + argument_) + ".") + processed_.variantName_) + ") {\n")) + (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, [...processed_.arguments_, ...arguments_], newMatchCase_, jump_, last_, async_, $task))) + (processed_.loneVariant_
|
|
4654
4740
|
? ""
|
|
4655
4741
|
: "\n}"))
|
|
4656
4742
|
return
|
|
@@ -4694,49 +4780,31 @@ return
|
|
|
4694
4780
|
}
|
|
4695
4781
|
|
|
4696
4782
|
export async function JsEmitter_emitList$(self_, items_, async_, $task) {
|
|
4783
|
+
return (("[" + ff_core_List.List_join((await ff_core_List.List_map$(items_, (async (_1, $task) => {
|
|
4697
4784
|
{
|
|
4698
|
-
const
|
|
4699
|
-
{
|
|
4700
|
-
|
|
4701
|
-
return "ff_core_List.Empty()"
|
|
4702
|
-
return
|
|
4703
|
-
}
|
|
4704
|
-
}
|
|
4705
|
-
{
|
|
4706
|
-
if(_1.Link) {
|
|
4707
|
-
const e_ = _1.head_.first_;
|
|
4708
|
-
if(_1.head_.second_) {
|
|
4709
|
-
if(_1.tail_.Empty) {
|
|
4710
|
-
return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, e_, async_, $task))
|
|
4711
|
-
return
|
|
4712
|
-
}
|
|
4713
|
-
}
|
|
4714
|
-
}
|
|
4715
|
-
}
|
|
4716
|
-
{
|
|
4717
|
-
if(_1.Link) {
|
|
4718
|
-
const e_ = _1.head_.first_;
|
|
4719
|
-
if(!_1.head_.second_) {
|
|
4720
|
-
const list_ = _1.tail_;
|
|
4721
|
-
return (((("ff_core_List.Link(" + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, e_, async_, $task))) + ", ") + (await ff_compiler_JsEmitter.JsEmitter_emitList$(self_, list_, async_, $task))) + ")")
|
|
4785
|
+
const item_ = _1.first_;
|
|
4786
|
+
if(!_1.second_) {
|
|
4787
|
+
return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, item_, async_, $task))
|
|
4722
4788
|
return
|
|
4723
4789
|
}
|
|
4724
4790
|
}
|
|
4725
|
-
}
|
|
4726
4791
|
{
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
const list_ = _1.tail_;
|
|
4731
|
-
return (((("ff_core_List.List_addAll(" + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, e_, async_, $task))) + ", ") + (await ff_compiler_JsEmitter.JsEmitter_emitList$(self_, list_, async_, $task))) + ")")
|
|
4792
|
+
const item_ = _1.first_;
|
|
4793
|
+
if(_1.second_) {
|
|
4794
|
+
return ("..." + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, item_, async_, $task)))
|
|
4732
4795
|
return
|
|
4733
4796
|
}
|
|
4734
4797
|
}
|
|
4735
|
-
}
|
|
4736
|
-
}
|
|
4798
|
+
}), $task)), ", ")) + "]")
|
|
4737
4799
|
}
|
|
4738
4800
|
|
|
4739
4801
|
export async function JsEmitter_processVariantCase$(self_, name_, argument_, $task) {
|
|
4802
|
+
if((name_ === "List$Empty")) {
|
|
4803
|
+
return ff_compiler_JsEmitter.ProcessedVariantCase(name_, false, false, [])
|
|
4804
|
+
} else {
|
|
4805
|
+
if((name_ === "List$Link")) {
|
|
4806
|
+
return ff_compiler_JsEmitter.ProcessedVariantCase(name_, false, false, [(argument_ + "[0]"), (argument_ + ".slice(1)")])
|
|
4807
|
+
} else {
|
|
4740
4808
|
const variantNameUnqualified_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(name_), ((_w1) => {
|
|
4741
4809
|
return (_w1 !== 46)
|
|
4742
4810
|
})));
|
|
@@ -4751,11 +4819,11 @@ return (_w1.name_ === variantName_)
|
|
|
4751
4819
|
})), ((variant_) => {
|
|
4752
4820
|
newtype_ = definition_.newtype_;
|
|
4753
4821
|
loneVariant_ = (ff_core_List.List_size(definition_.variants_) === 1);
|
|
4754
|
-
return ff_core_List.
|
|
4822
|
+
return [...ff_core_List.List_map(definition_.commonFields_, ((_w1) => {
|
|
4755
4823
|
return _w1.name_
|
|
4756
|
-
})), ff_core_List.List_map(variant_.fields_, ((_w1) => {
|
|
4824
|
+
})), ...ff_core_List.List_map(variant_.fields_, ((_w1) => {
|
|
4757
4825
|
return _w1.name_
|
|
4758
|
-
}))
|
|
4826
|
+
}))]
|
|
4759
4827
|
}))
|
|
4760
4828
|
}))), ((field_) => {
|
|
4761
4829
|
if(newtype_) {
|
|
@@ -4766,8 +4834,13 @@ return ((argument_ + ".") + ff_compiler_JsEmitter.escapeKeyword_(field_))
|
|
|
4766
4834
|
}));
|
|
4767
4835
|
return ff_compiler_JsEmitter.ProcessedVariantCase(variantName_, newtype_, loneVariant_, newArguments_)
|
|
4768
4836
|
}
|
|
4837
|
+
}
|
|
4838
|
+
}
|
|
4769
4839
|
|
|
4770
4840
|
export async function JsEmitter_processVariant$(self_, name_, $task) {
|
|
4841
|
+
if(ff_core_String.String_startsWith(name_, "List$", 0)) {
|
|
4842
|
+
return false
|
|
4843
|
+
} else {
|
|
4771
4844
|
const variantNameUnqualified_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(name_), ((_w1) => {
|
|
4772
4845
|
return (_w1 !== 46)
|
|
4773
4846
|
})));
|
|
@@ -4784,6 +4857,7 @@ newtype_ = definition_.newtype_
|
|
|
4784
4857
|
})));
|
|
4785
4858
|
return newtype_
|
|
4786
4859
|
}
|
|
4860
|
+
}
|
|
4787
4861
|
|
|
4788
4862
|
export async function JsEmitter_emitArgument$(self_, callAt_, argument_, async_, $task) {
|
|
4789
4863
|
{
|
|
@@ -4791,7 +4865,7 @@ const _1 = argument_.value_;
|
|
|
4791
4865
|
{
|
|
4792
4866
|
if(_1.ECall) {
|
|
4793
4867
|
if(_1.target_.StaticCall) {
|
|
4794
|
-
if(_1.target_.name_
|
|
4868
|
+
if(_1.target_.name_ === "ff:core/SourceLocation.callSite") {
|
|
4795
4869
|
return (((((((((("\"" + self_.moduleName_) + ":") + callAt_.line_) + ":") + callAt_.column_) + ",") + self_.packagePair_.group_) + ",") + self_.packagePair_.name_) + "\"")
|
|
4796
4870
|
return
|
|
4797
4871
|
}
|
|
@@ -5215,28 +5289,28 @@ serialization_.offset_ += 1;
|
|
|
5215
5289
|
{
|
|
5216
5290
|
const _1 = variantIndex_;
|
|
5217
5291
|
{
|
|
5218
|
-
if(_1
|
|
5292
|
+
if(_1 === 0) {
|
|
5219
5293
|
serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 30), 0);
|
|
5220
5294
|
return ff_compiler_JsEmitter.EmitNode()
|
|
5221
5295
|
return
|
|
5222
5296
|
}
|
|
5223
5297
|
}
|
|
5224
5298
|
{
|
|
5225
|
-
if(_1
|
|
5299
|
+
if(_1 === 1) {
|
|
5226
5300
|
serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
|
|
5227
5301
|
return ff_compiler_JsEmitter.EmitBrowser()
|
|
5228
5302
|
return
|
|
5229
5303
|
}
|
|
5230
5304
|
}
|
|
5231
5305
|
{
|
|
5232
|
-
if(_1
|
|
5306
|
+
if(_1 === 2) {
|
|
5233
5307
|
serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
|
|
5234
5308
|
return ff_compiler_JsEmitter.EmitBuild()
|
|
5235
5309
|
return
|
|
5236
5310
|
}
|
|
5237
5311
|
}
|
|
5238
5312
|
{
|
|
5239
|
-
if(_1
|
|
5313
|
+
if(_1 === 3) {
|
|
5240
5314
|
serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
|
|
5241
5315
|
return ff_compiler_JsEmitter.EmitExecutable()
|
|
5242
5316
|
return
|
|
@@ -5300,28 +5374,28 @@ serialization_.offset_ += 1;
|
|
|
5300
5374
|
{
|
|
5301
5375
|
const _1 = variantIndex_;
|
|
5302
5376
|
{
|
|
5303
|
-
if(_1
|
|
5377
|
+
if(_1 === 0) {
|
|
5304
5378
|
serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 30), 0);
|
|
5305
5379
|
return ff_compiler_JsEmitter.EmitNode()
|
|
5306
5380
|
return
|
|
5307
5381
|
}
|
|
5308
5382
|
}
|
|
5309
5383
|
{
|
|
5310
|
-
if(_1
|
|
5384
|
+
if(_1 === 1) {
|
|
5311
5385
|
serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
|
|
5312
5386
|
return ff_compiler_JsEmitter.EmitBrowser()
|
|
5313
5387
|
return
|
|
5314
5388
|
}
|
|
5315
5389
|
}
|
|
5316
5390
|
{
|
|
5317
|
-
if(_1
|
|
5391
|
+
if(_1 === 2) {
|
|
5318
5392
|
serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
|
|
5319
5393
|
return ff_compiler_JsEmitter.EmitBuild()
|
|
5320
5394
|
return
|
|
5321
5395
|
}
|
|
5322
5396
|
}
|
|
5323
5397
|
{
|
|
5324
|
-
if(_1
|
|
5398
|
+
if(_1 === 3) {
|
|
5325
5399
|
serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
|
|
5326
5400
|
return ff_compiler_JsEmitter.EmitExecutable()
|
|
5327
5401
|
return
|
|
@@ -5360,7 +5434,7 @@ serialization_.offset_ += 1;
|
|
|
5360
5434
|
{
|
|
5361
5435
|
const _1 = variantIndex_;
|
|
5362
5436
|
{
|
|
5363
|
-
if(_1
|
|
5437
|
+
if(_1 === 0) {
|
|
5364
5438
|
serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
|
|
5365
5439
|
return ff_compiler_JsEmitter.ProcessedVariantCase(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_))
|
|
5366
5440
|
return
|
|
@@ -5396,7 +5470,7 @@ serialization_.offset_ += 1;
|
|
|
5396
5470
|
{
|
|
5397
5471
|
const _1 = variantIndex_;
|
|
5398
5472
|
{
|
|
5399
|
-
if(_1
|
|
5473
|
+
if(_1 === 0) {
|
|
5400
5474
|
serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
|
|
5401
5475
|
return ff_compiler_JsEmitter.ProcessedVariantCase(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_))
|
|
5402
5476
|
return
|