firefly-compiler 0.5.13 → 0.5.15
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/JsEmitter.ff +27 -6
- package/fireflysite/Test.ff +8 -2
- package/fireflysite/assets/markdown/reference/FunctionsAndMethods.md +33 -13
- package/output/js/ff/compiler/Builder.mjs +8 -4
- package/output/js/ff/compiler/Compiler.mjs +8 -4
- package/output/js/ff/compiler/Deriver.mjs +2 -2
- package/output/js/ff/compiler/Inference.mjs +68 -48
- package/output/js/ff/compiler/JsEmitter.mjs +102 -34
- package/output/js/ff/compiler/Parser.mjs +70 -62
- package/output/js/ff/compiler/Patterns.mjs +4 -4
- package/output/js/ff/compiler/Resolver.mjs +10 -6
- package/output/js/ff/compiler/Tokenizer.mjs +2 -2
- package/output/js/ff/compiler/Unification.mjs +18 -10
- package/output/js/ff/compiler/Workspace.mjs +20 -18
- package/output/js/ff/core/Array.mjs +8 -8
- package/output/js/ff/core/List.mjs +46 -42
- package/output/js/ff/core/Ordering.mjs +4 -4
- package/output/js/ff/core/Random.mjs +8 -8
- package/output/js/ff/core/Serializable.mjs +8 -8
- package/output/js/ff/core/Task.mjs +2 -2
- package/package.json +1 -1
- package/vscode/package.json +1 -1
|
@@ -931,7 +931,7 @@ return ff_compiler_JsEmitter.escapeKeyword_(_w1.name_)
|
|
|
931
931
|
})), ", ");
|
|
932
932
|
if(ff_core_List.List_isEmpty(allFields_)) {
|
|
933
933
|
return ((((((((((((("const " + definition_.name_) + "$ = {") + definition_.name_) + ": true};\n") + "export function ") + definition_.name_) + "(") + fields_) + ") {\n") + "return ") + definition_.name_) + "$;\n") + "}")
|
|
934
|
-
} else if((
|
|
934
|
+
} else if((typeDefinition_.variants_.length === 1)) {
|
|
935
935
|
return (((((((("export function " + definition_.name_) + "(") + fields_) + ") {\n") + "return {") + fields_) + "};\n") + "}")
|
|
936
936
|
} else {
|
|
937
937
|
return (((((((((("export function " + definition_.name_) + "(") + fields_) + ") {\n") + "return {") + definition_.name_) + ": true, ") + fields_) + "};\n") + "}")
|
|
@@ -1094,7 +1094,7 @@ const controller_ = (newAsync_
|
|
|
1094
1094
|
? ["$task"]
|
|
1095
1095
|
: []);
|
|
1096
1096
|
ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
|
|
1097
|
-
const arguments_ = ff_core_List.List_map(ff_core_List.List_pairs(ff_core_List.
|
|
1097
|
+
const arguments_ = ff_core_List.List_map(ff_core_List.List_pairs((cases_[0] ?? ff_core_List.internalGrab_(cases_, 0)).patterns_), ((_w1) => {
|
|
1098
1098
|
return ("_" + (_w1.first_ + 1))
|
|
1099
1099
|
}));
|
|
1100
1100
|
const escapedArguments_ = ff_core_List.List_map(arguments_, ((word_) => {
|
|
@@ -1179,7 +1179,7 @@ const typeArguments_ = _1.typeArguments_;
|
|
|
1179
1179
|
const arguments_ = _1.arguments_;
|
|
1180
1180
|
const dictionaries_ = _1.dictionaries_;
|
|
1181
1181
|
if(ff_core_String.String_contains(name_, "bundleForBrowser")) {
|
|
1182
|
-
if((!ff_core_Option.Option_contains(ff_core_List.
|
|
1182
|
+
if((!ff_core_Option.Option_contains((arguments_[0] ?? ff_core_List.internalGrab_(arguments_, 0)).name_, "system", ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
|
|
1183
1183
|
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) => {
|
|
1184
1184
|
return _w1.name_
|
|
1185
1185
|
})))));
|
|
@@ -1508,19 +1508,39 @@ return ff_core_Option.Some((((((("(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(
|
|
|
1508
1508
|
}
|
|
1509
1509
|
}
|
|
1510
1510
|
if(_1 === "ff:core/List.List_grab") {
|
|
1511
|
-
const
|
|
1512
|
-
if(
|
|
1513
|
-
const
|
|
1514
|
-
const
|
|
1515
|
-
|
|
1511
|
+
const _guard2 = arguments_;
|
|
1512
|
+
if(_guard2.length === 2) {
|
|
1513
|
+
const e1_ = _guard2[0];
|
|
1514
|
+
const e2_ = _guard2[1];
|
|
1515
|
+
if((ff_compiler_JsEmitter.noSideEffects_(e1_) && ff_compiler_JsEmitter.noSideEffects_(e2_))) {
|
|
1516
|
+
const code1_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e1_, async_);
|
|
1517
|
+
const code2_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e2_, async_);
|
|
1518
|
+
return ff_core_Option.Some(((((((((("(" + code1_) + "[") + code2_) + "] ?? ") + "ff_core_List.internalGrab_(") + code1_) + ", ") + code2_) + "))"))
|
|
1519
|
+
}
|
|
1516
1520
|
}
|
|
1517
1521
|
}
|
|
1518
1522
|
if(_1 === "ff:core/Array.Array_grab") {
|
|
1519
1523
|
const _guard1 = arguments_;
|
|
1520
|
-
if(_guard1.length === 2
|
|
1521
|
-
const
|
|
1522
|
-
const
|
|
1523
|
-
|
|
1524
|
+
if(_guard1.length === 2) {
|
|
1525
|
+
const e1_ = _guard1[0];
|
|
1526
|
+
const e2_ = _guard1[1];
|
|
1527
|
+
const code1_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e1_, async_);
|
|
1528
|
+
const code2_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e2_, async_);
|
|
1529
|
+
return ff_core_Option.Some(((((((((("(" + code1_) + ".array[") + code2_) + "] ?? ") + "ff_core_Array.internalGrab_(") + code1_) + ", ") + code2_) + "))"))
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
if(_1 === "ff:core/List.List_size") {
|
|
1533
|
+
const _guard1 = arguments_;
|
|
1534
|
+
if(_guard1.length === 1) {
|
|
1535
|
+
const e_ = _guard1[0];
|
|
1536
|
+
return ff_core_Option.Some((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_) + ".length"))
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
if(_1 === "ff:core/Array.Array_size") {
|
|
1540
|
+
const _guard1 = arguments_;
|
|
1541
|
+
if(_guard1.length === 1) {
|
|
1542
|
+
const e_ = _guard1[0];
|
|
1543
|
+
return ff_core_Option.Some((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_) + ".array.length"))
|
|
1524
1544
|
}
|
|
1525
1545
|
}
|
|
1526
1546
|
if(_1 === "ff:core/Equal.equals") {
|
|
@@ -1951,6 +1971,20 @@ return ff_core_Option.Some((("while(" + ff_compiler_JsEmitter.JsEmitter_emitComm
|
|
|
1951
1971
|
}
|
|
1952
1972
|
}
|
|
1953
1973
|
}
|
|
1974
|
+
if(_1 === "ff:core/Option.Option_each") {
|
|
1975
|
+
const _guard1 = arguments_;
|
|
1976
|
+
if(_guard1.length === 2 && _guard1[1].ELambda && _guard1[1].lambda_.cases_.length === 1 && _guard1[1].lambda_.cases_[0].patterns_.length === 1 && _guard1[1].lambda_.cases_[0].patterns_[0].PVariable && _guard1[1].lambda_.cases_[0].guards_.length === 0) {
|
|
1977
|
+
const list_ = _guard1[0];
|
|
1978
|
+
const name_ = _guard1[1].lambda_.cases_[0].patterns_[0].name_;
|
|
1979
|
+
const body_ = _guard1[1].lambda_.cases_[0].body_;
|
|
1980
|
+
return ff_core_Option.Some(((((("for(let for_o = " + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, list_, async_)) + "; for_o.Some;) {\n") + ff_core_Option.Option_else(ff_core_Option.Option_map(name_, ((_w1) => {
|
|
1981
|
+
return (("const " + ff_compiler_JsEmitter.escapeKeyword_(_w1)) + " = for_o.value_;\n")
|
|
1982
|
+
})), (() => {
|
|
1983
|
+
return ""
|
|
1984
|
+
}))) + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, last_, async_)) + "\nbreak\n}"))
|
|
1985
|
+
return
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1954
1988
|
if(_1 === "ff:core/List.List_each") {
|
|
1955
1989
|
const _guard2 = arguments_;
|
|
1956
1990
|
if(_guard2.length === 2 && _guard2[0].ECall && _guard2[0].target_.StaticCall && _guard2[0].arguments_.length === 2 && _guard2[1].ELambda && _guard2[1].lambda_.cases_.length === 1 && _guard2[1].lambda_.cases_[0].patterns_.length === 1 && _guard2[1].lambda_.cases_[0].patterns_[0].PVariable && _guard2[1].lambda_.cases_[0].guards_.length === 0) {
|
|
@@ -2306,7 +2340,7 @@ const _1 = ff_core_Pair.Pair(matchCase_.patterns_, matchCase_.guards_);
|
|
|
2306
2340
|
if(_1.first_.length >= 1) {
|
|
2307
2341
|
const p_ = _1.first_[0];
|
|
2308
2342
|
const ps_ = _1.first_.slice(1);
|
|
2309
|
-
return ff_compiler_JsEmitter.JsEmitter_emitPattern(self_, ff_core_List.
|
|
2343
|
+
return ff_compiler_JsEmitter.JsEmitter_emitPattern(self_, (arguments_[0] ?? ff_core_List.internalGrab_(arguments_, 0)), p_, ff_core_List.List_dropFirst(arguments_, 1), (((_c) => {
|
|
2310
2344
|
return ff_compiler_Syntax.MatchCase(_c.at_, ps_, _c.guards_, _c.body_)
|
|
2311
2345
|
}))(matchCase_), conditions_, variables_, jump_, last_, async_)
|
|
2312
2346
|
return
|
|
@@ -2331,7 +2365,7 @@ return emitWrapper_(code_)
|
|
|
2331
2365
|
if(_1.first_.length === 0 && _1.second_.length >= 1) {
|
|
2332
2366
|
const guard_ = _1.second_[0];
|
|
2333
2367
|
const guards_ = _1.second_.slice(1);
|
|
2334
|
-
const guardName_ = ("_guard" + (
|
|
2368
|
+
const guardName_ = ("_guard" + (guards_.length + 1));
|
|
2335
2369
|
const newCase_ = (((_c) => {
|
|
2336
2370
|
return ff_compiler_Syntax.MatchCase(_c.at_, [guard_.pattern_], guards_, _c.body_)
|
|
2337
2371
|
}))(matchCase_);
|
|
@@ -2417,7 +2451,7 @@ return (((argument_ + "[") + i_) + "]")
|
|
|
2417
2451
|
}
|
|
2418
2452
|
}));
|
|
2419
2453
|
const restArgument_ = ff_core_Option.Option_map(restPattern_, ((_) => {
|
|
2420
|
-
return (((argument_ + ".slice(") +
|
|
2454
|
+
return (((argument_ + ".slice(") + patterns_.length) + ")")
|
|
2421
2455
|
}));
|
|
2422
2456
|
const newArguments_ = [...itemArguments_, ...ff_core_Option.Option_toList(restArgument_), ...arguments_];
|
|
2423
2457
|
const newMatchCase_ = (((_c) => {
|
|
@@ -2428,7 +2462,7 @@ return ">="
|
|
|
2428
2462
|
})), (() => {
|
|
2429
2463
|
return "==="
|
|
2430
2464
|
}));
|
|
2431
|
-
const newConditions_ = [...conditions_, ((((argument_ + ".length ") + operator_) + " ") +
|
|
2465
|
+
const newConditions_ = [...conditions_, ((((argument_ + ".length ") + operator_) + " ") + patterns_.length)];
|
|
2432
2466
|
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, newArguments_, newMatchCase_, newConditions_, variables_, jump_, last_, async_)
|
|
2433
2467
|
}
|
|
2434
2468
|
}
|
|
@@ -2504,7 +2538,7 @@ return ff_core_Option.Option_map(ff_core_List.List_find(definition_.variants_, (
|
|
|
2504
2538
|
return (_w1.name_ === variantName_)
|
|
2505
2539
|
})), ((variant_) => {
|
|
2506
2540
|
newtype_ = definition_.newtype_;
|
|
2507
|
-
loneVariant_ = (
|
|
2541
|
+
loneVariant_ = (definition_.variants_.length === 1);
|
|
2508
2542
|
return [...ff_core_List.List_map(definition_.commonFields_, ((_w1) => {
|
|
2509
2543
|
return _w1.name_
|
|
2510
2544
|
})), ...ff_core_List.List_map(variant_.fields_, ((_w1) => {
|
|
@@ -2884,7 +2918,7 @@ return ff_compiler_JsEmitter.escapeKeyword_(_w1.name_)
|
|
|
2884
2918
|
})), ", ");
|
|
2885
2919
|
if(ff_core_List.List_isEmpty(allFields_)) {
|
|
2886
2920
|
return ((((((((((((("const " + definition_.name_) + "$ = {") + definition_.name_) + ": true};\n") + "export function ") + definition_.name_) + "(") + fields_) + ") {\n") + "return ") + definition_.name_) + "$;\n") + "}")
|
|
2887
|
-
} else if((
|
|
2921
|
+
} else if((typeDefinition_.variants_.length === 1)) {
|
|
2888
2922
|
return (((((((("export function " + definition_.name_) + "(") + fields_) + ") {\n") + "return {") + fields_) + "};\n") + "}")
|
|
2889
2923
|
} else {
|
|
2890
2924
|
return (((((((((("export function " + definition_.name_) + "(") + fields_) + ") {\n") + "return {") + definition_.name_) + ": true, ") + fields_) + "};\n") + "}")
|
|
@@ -3047,7 +3081,7 @@ const controller_ = (newAsync_
|
|
|
3047
3081
|
? ["$task"]
|
|
3048
3082
|
: []);
|
|
3049
3083
|
ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
|
|
3050
|
-
const arguments_ = ff_core_List.List_map(ff_core_List.List_pairs(ff_core_List.
|
|
3084
|
+
const arguments_ = ff_core_List.List_map(ff_core_List.List_pairs((cases_[0] ?? ff_core_List.internalGrab_(cases_, 0)).patterns_), ((_w1) => {
|
|
3051
3085
|
return ("_" + (_w1.first_ + 1))
|
|
3052
3086
|
}));
|
|
3053
3087
|
const escapedArguments_ = ff_core_List.List_map(arguments_, ((word_) => {
|
|
@@ -3132,7 +3166,7 @@ const typeArguments_ = _1.typeArguments_;
|
|
|
3132
3166
|
const arguments_ = _1.arguments_;
|
|
3133
3167
|
const dictionaries_ = _1.dictionaries_;
|
|
3134
3168
|
if(ff_core_String.String_contains(name_, "bundleForBrowser")) {
|
|
3135
|
-
if((!ff_core_Option.Option_contains(ff_core_List.
|
|
3169
|
+
if((!ff_core_Option.Option_contains((arguments_[0] ?? ff_core_List.internalGrab_(arguments_, 0)).name_, "system", ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
|
|
3136
3170
|
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) => {
|
|
3137
3171
|
return _w1.name_
|
|
3138
3172
|
})))));
|
|
@@ -3461,19 +3495,39 @@ return ff_core_Option.Some((((((("(" + (await ff_compiler_JsEmitter.JsEmitter_em
|
|
|
3461
3495
|
}
|
|
3462
3496
|
}
|
|
3463
3497
|
if(_1 === "ff:core/List.List_grab") {
|
|
3464
|
-
const
|
|
3465
|
-
if(
|
|
3466
|
-
const
|
|
3467
|
-
const
|
|
3468
|
-
|
|
3498
|
+
const _guard2 = arguments_;
|
|
3499
|
+
if(_guard2.length === 2) {
|
|
3500
|
+
const e1_ = _guard2[0];
|
|
3501
|
+
const e2_ = _guard2[1];
|
|
3502
|
+
if((ff_compiler_JsEmitter.noSideEffects_(e1_) && ff_compiler_JsEmitter.noSideEffects_(e2_))) {
|
|
3503
|
+
const code1_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, e1_, async_, $task));
|
|
3504
|
+
const code2_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, e2_, async_, $task));
|
|
3505
|
+
return ff_core_Option.Some(((((((((("(" + code1_) + "[") + code2_) + "] ?? ") + "ff_core_List.internalGrab_(") + code1_) + ", ") + code2_) + "))"))
|
|
3506
|
+
}
|
|
3469
3507
|
}
|
|
3470
3508
|
}
|
|
3471
3509
|
if(_1 === "ff:core/Array.Array_grab") {
|
|
3472
3510
|
const _guard1 = arguments_;
|
|
3473
|
-
if(_guard1.length === 2
|
|
3474
|
-
const
|
|
3475
|
-
const
|
|
3476
|
-
|
|
3511
|
+
if(_guard1.length === 2) {
|
|
3512
|
+
const e1_ = _guard1[0];
|
|
3513
|
+
const e2_ = _guard1[1];
|
|
3514
|
+
const code1_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, e1_, async_, $task));
|
|
3515
|
+
const code2_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, e2_, async_, $task));
|
|
3516
|
+
return ff_core_Option.Some(((((((((("(" + code1_) + ".array[") + code2_) + "] ?? ") + "ff_core_Array.internalGrab_(") + code1_) + ", ") + code2_) + "))"))
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
if(_1 === "ff:core/List.List_size") {
|
|
3520
|
+
const _guard1 = arguments_;
|
|
3521
|
+
if(_guard1.length === 1) {
|
|
3522
|
+
const e_ = _guard1[0];
|
|
3523
|
+
return ff_core_Option.Some(((await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, e_, async_, $task)) + ".length"))
|
|
3524
|
+
}
|
|
3525
|
+
}
|
|
3526
|
+
if(_1 === "ff:core/Array.Array_size") {
|
|
3527
|
+
const _guard1 = arguments_;
|
|
3528
|
+
if(_guard1.length === 1) {
|
|
3529
|
+
const e_ = _guard1[0];
|
|
3530
|
+
return ff_core_Option.Some(((await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, e_, async_, $task)) + ".array.length"))
|
|
3477
3531
|
}
|
|
3478
3532
|
}
|
|
3479
3533
|
if(_1 === "ff:core/Equal.equals") {
|
|
@@ -3904,6 +3958,20 @@ return ff_core_Option.Some((("while(" + (await ff_compiler_JsEmitter.JsEmitter_e
|
|
|
3904
3958
|
}
|
|
3905
3959
|
}
|
|
3906
3960
|
}
|
|
3961
|
+
if(_1 === "ff:core/Option.Option_each") {
|
|
3962
|
+
const _guard1 = arguments_;
|
|
3963
|
+
if(_guard1.length === 2 && _guard1[1].ELambda && _guard1[1].lambda_.cases_.length === 1 && _guard1[1].lambda_.cases_[0].patterns_.length === 1 && _guard1[1].lambda_.cases_[0].patterns_[0].PVariable && _guard1[1].lambda_.cases_[0].guards_.length === 0) {
|
|
3964
|
+
const list_ = _guard1[0];
|
|
3965
|
+
const name_ = _guard1[1].lambda_.cases_[0].patterns_[0].name_;
|
|
3966
|
+
const body_ = _guard1[1].lambda_.cases_[0].body_;
|
|
3967
|
+
return ff_core_Option.Some(((((("for(let for_o = " + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, list_, async_, $task))) + "; for_o.Some;) {\n") + ff_core_Option.Option_else(ff_core_Option.Option_map(name_, ((_w1) => {
|
|
3968
|
+
return (("const " + ff_compiler_JsEmitter.escapeKeyword_(_w1)) + " = for_o.value_;\n")
|
|
3969
|
+
})), (() => {
|
|
3970
|
+
return ""
|
|
3971
|
+
}))) + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, body_, last_, async_, $task))) + "\nbreak\n}"))
|
|
3972
|
+
return
|
|
3973
|
+
}
|
|
3974
|
+
}
|
|
3907
3975
|
if(_1 === "ff:core/List.List_each") {
|
|
3908
3976
|
const _guard2 = arguments_;
|
|
3909
3977
|
if(_guard2.length === 2 && _guard2[0].ECall && _guard2[0].target_.StaticCall && _guard2[0].arguments_.length === 2 && _guard2[1].ELambda && _guard2[1].lambda_.cases_.length === 1 && _guard2[1].lambda_.cases_[0].patterns_.length === 1 && _guard2[1].lambda_.cases_[0].patterns_[0].PVariable && _guard2[1].lambda_.cases_[0].guards_.length === 0) {
|
|
@@ -4259,7 +4327,7 @@ const _1 = ff_core_Pair.Pair(matchCase_.patterns_, matchCase_.guards_);
|
|
|
4259
4327
|
if(_1.first_.length >= 1) {
|
|
4260
4328
|
const p_ = _1.first_[0];
|
|
4261
4329
|
const ps_ = _1.first_.slice(1);
|
|
4262
|
-
return (await ff_compiler_JsEmitter.JsEmitter_emitPattern$(self_, ff_core_List.
|
|
4330
|
+
return (await ff_compiler_JsEmitter.JsEmitter_emitPattern$(self_, (arguments_[0] ?? ff_core_List.internalGrab_(arguments_, 0)), p_, ff_core_List.List_dropFirst(arguments_, 1), (((_c) => {
|
|
4263
4331
|
return ff_compiler_Syntax.MatchCase(_c.at_, ps_, _c.guards_, _c.body_)
|
|
4264
4332
|
}))(matchCase_), conditions_, variables_, jump_, last_, async_, $task))
|
|
4265
4333
|
return
|
|
@@ -4284,7 +4352,7 @@ return emitWrapper_(code_)
|
|
|
4284
4352
|
if(_1.first_.length === 0 && _1.second_.length >= 1) {
|
|
4285
4353
|
const guard_ = _1.second_[0];
|
|
4286
4354
|
const guards_ = _1.second_.slice(1);
|
|
4287
|
-
const guardName_ = ("_guard" + (
|
|
4355
|
+
const guardName_ = ("_guard" + (guards_.length + 1));
|
|
4288
4356
|
const newCase_ = (((_c) => {
|
|
4289
4357
|
return ff_compiler_Syntax.MatchCase(_c.at_, [guard_.pattern_], guards_, _c.body_)
|
|
4290
4358
|
}))(matchCase_);
|
|
@@ -4370,7 +4438,7 @@ return (((argument_ + "[") + i_) + "]")
|
|
|
4370
4438
|
}
|
|
4371
4439
|
}));
|
|
4372
4440
|
const restArgument_ = ff_core_Option.Option_map(restPattern_, ((_) => {
|
|
4373
|
-
return (((argument_ + ".slice(") +
|
|
4441
|
+
return (((argument_ + ".slice(") + patterns_.length) + ")")
|
|
4374
4442
|
}));
|
|
4375
4443
|
const newArguments_ = [...itemArguments_, ...ff_core_Option.Option_toList(restArgument_), ...arguments_];
|
|
4376
4444
|
const newMatchCase_ = (((_c) => {
|
|
@@ -4381,7 +4449,7 @@ return ">="
|
|
|
4381
4449
|
})), (() => {
|
|
4382
4450
|
return "==="
|
|
4383
4451
|
}));
|
|
4384
|
-
const newConditions_ = [...conditions_, ((((argument_ + ".length ") + operator_) + " ") +
|
|
4452
|
+
const newConditions_ = [...conditions_, ((((argument_ + ".length ") + operator_) + " ") + patterns_.length)];
|
|
4385
4453
|
return (await ff_compiler_JsEmitter.JsEmitter_emitCase$(self_, newArguments_, newMatchCase_, newConditions_, variables_, jump_, last_, async_, $task))
|
|
4386
4454
|
}
|
|
4387
4455
|
}
|
|
@@ -4457,7 +4525,7 @@ return ff_core_Option.Option_map(ff_core_List.List_find(definition_.variants_, (
|
|
|
4457
4525
|
return (_w1.name_ === variantName_)
|
|
4458
4526
|
})), ((variant_) => {
|
|
4459
4527
|
newtype_ = definition_.newtype_;
|
|
4460
|
-
loneVariant_ = (
|
|
4528
|
+
loneVariant_ = (definition_.variants_.length === 1);
|
|
4461
4529
|
return [...ff_core_List.List_map(definition_.commonFields_, ((_w1) => {
|
|
4462
4530
|
return _w1.name_
|
|
4463
4531
|
})), ...ff_core_List.List_map(variant_.fields_, ((_w1) => {
|