firefly-compiler 0.5.10 → 0.5.12
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
CHANGED
|
@@ -386,13 +386,13 @@ extend self: JsEmitter {
|
|
|
386
386
|
if(await) {"(await " + call + ")"} else {call}
|
|
387
387
|
| [Pair(EVariant(_, "ff:core/Bool.True", _, _), elseBody), ...list] =>
|
|
388
388
|
"(" + list.foldLeft(self.emitTerm(elseBody, async)) {| otherwise, Pair(condition, body) =>
|
|
389
|
-
self.
|
|
390
|
-
"\n? " + self.
|
|
389
|
+
self.emitComma(condition, async) +
|
|
390
|
+
"\n? " + self.emitComma(body, async) + "\n: " + otherwise
|
|
391
391
|
} + ")"
|
|
392
392
|
| list =>
|
|
393
393
|
"(" + list.foldLeft("ff_core_Option.None()") {| otherwise, Pair(condition, body) =>
|
|
394
|
-
self.
|
|
395
|
-
"\n? ff_core_Option.Some(" + self.
|
|
394
|
+
self.emitComma(condition, async) +
|
|
395
|
+
"\n? ff_core_Option.Some(" + self.emitComma(body, async) + ")\n: " + otherwise
|
|
396
396
|
} + ")"
|
|
397
397
|
}
|
|
398
398
|
| ECall(at, DynamicCall(function, _), effect, typeArguments, arguments, dictionaries) =>
|
|
@@ -697,26 +697,10 @@ extend self: JsEmitter {
|
|
|
697
697
|
| "ff:core/List.List_each" {arguments | [list, ELambda(_, Lambda(_, _, [
|
|
698
698
|
MatchCase(_, [PVariable(_, name)], [], body)
|
|
699
699
|
]))]} =>
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
let
|
|
703
|
-
|
|
704
|
-
start = self.emitTerm(a2.value, async)
|
|
705
|
-
if(!start.all {_.isAsciiDigit()}) {
|
|
706
|
-
start = "Math.max(" + start + ", 0)"
|
|
707
|
-
}
|
|
708
|
-
self.emitTerm(a1.value, async)
|
|
709
|
-
| ECall(_, StaticCall("ff:core/List.List_dropLast", _, _), _, _, [a1, a2], _) =>
|
|
710
|
-
let count = self.emitTerm(a2.value, async)
|
|
711
|
-
if(!count.all {_.isAsciiDigit()}) {
|
|
712
|
-
end = end + " - Math.max(" + count + ", 0)"
|
|
713
|
-
} else {
|
|
714
|
-
end = end + " - " + count
|
|
715
|
-
}
|
|
716
|
-
self.emitTerm(a1.value, async)
|
|
717
|
-
| _ =>
|
|
718
|
-
self.emitTerm(list, async)
|
|
719
|
-
}
|
|
700
|
+
let fusion = self.emitLightFusion(list, async)
|
|
701
|
+
let start = fusion.second.first
|
|
702
|
+
let end = fusion.second.second
|
|
703
|
+
let listCode = fusion.first
|
|
720
704
|
Some(
|
|
721
705
|
"for(let for_i = " + start + ", for_a = " + listCode + ", for_l = " + end +
|
|
722
706
|
"; for_i < for_l; for_i++) {\n" +
|
|
@@ -727,26 +711,10 @@ extend self: JsEmitter {
|
|
|
727
711
|
| "ff:core/List.List_eachWhile" {arguments | [list, ELambda(_, Lambda(_, _, [
|
|
728
712
|
MatchCase(_, [PVariable(_, name)], [], ESequential(_, body, condition))
|
|
729
713
|
]))]} =>
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
let
|
|
733
|
-
|
|
734
|
-
start = self.emitTerm(a2.value, async)
|
|
735
|
-
if(!start.all {_.isAsciiDigit()}) {
|
|
736
|
-
start = "Math.max(" + start + ", 0)"
|
|
737
|
-
}
|
|
738
|
-
self.emitTerm(a1.value, async)
|
|
739
|
-
| ECall(_, StaticCall("ff:core/List.List_dropLast", _, _), _, _, [a1, a2], _) =>
|
|
740
|
-
let count = self.emitTerm(a2.value, async)
|
|
741
|
-
if(!count.all {_.isAsciiDigit()}) {
|
|
742
|
-
end = end + " - Math.max(" + count + ", 0)"
|
|
743
|
-
} else {
|
|
744
|
-
end = end + " - " + count
|
|
745
|
-
}
|
|
746
|
-
self.emitTerm(a1.value, async)
|
|
747
|
-
| _ =>
|
|
748
|
-
self.emitTerm(list, async)
|
|
749
|
-
}
|
|
714
|
+
let fusion = self.emitLightFusion(list, async)
|
|
715
|
+
let start = fusion.second.first
|
|
716
|
+
let end = fusion.second.second
|
|
717
|
+
let listCode = fusion.first
|
|
750
718
|
Some(
|
|
751
719
|
"for(let for_i = " + start + ", for_a = " + listCode + ", for_l = " + end +
|
|
752
720
|
"; for_i < for_l; for_i++) {\n" +
|
|
@@ -806,6 +774,45 @@ extend self: JsEmitter {
|
|
|
806
774
|
None
|
|
807
775
|
}
|
|
808
776
|
}
|
|
777
|
+
|
|
778
|
+
emitLightFusion(list: Term, async: Bool): Pair[String, Pair[String, String]] {
|
|
779
|
+
mutable start = "0"
|
|
780
|
+
mutable end = "for_a.length"
|
|
781
|
+
let listCode = list.{
|
|
782
|
+
| ECall(_, StaticCall("ff:core/List.List_dropFirst", _, _), _, _, [a1, a2], _) =>
|
|
783
|
+
start = self.emitTerm(a2.value, async)
|
|
784
|
+
if(!start.all {_.isAsciiDigit()}) {
|
|
785
|
+
start = "Math.max(" + start + ", 0)"
|
|
786
|
+
}
|
|
787
|
+
self.emitTerm(a1.value, async)
|
|
788
|
+
| ECall(_, StaticCall("ff:core/List.List_dropLast", _, _), _, _, [a1, a2], _) =>
|
|
789
|
+
let count = self.emitTerm(a2.value, async)
|
|
790
|
+
if(!count.all {_.isAsciiDigit()}) {
|
|
791
|
+
end = end + " - Math.max(" + count + ", 0)"
|
|
792
|
+
} else {
|
|
793
|
+
end = end + " - " + count
|
|
794
|
+
}
|
|
795
|
+
self.emitTerm(a1.value, async)
|
|
796
|
+
| ECall(_, StaticCall("ff:core/List.List_takeFirst", _, _), _, _, [a1, a2], _) =>
|
|
797
|
+
end = self.emitTerm(a2.value, async)
|
|
798
|
+
if(!end.all {_.isAsciiDigit()}) {
|
|
799
|
+
end = "Math.max(" + end + ", 0)"
|
|
800
|
+
}
|
|
801
|
+
end = "Math.min(" + end + ", for_a.length)"
|
|
802
|
+
self.emitTerm(a1.value, async)
|
|
803
|
+
| ECall(_, StaticCall("ff:core/List.List_takeLast", _, _), _, _, [a1, a2], _) =>
|
|
804
|
+
let count = self.emitTerm(a2.value, async)
|
|
805
|
+
if(!count.all {_.isAsciiDigit()}) {
|
|
806
|
+
start = "Math.max(for_a.length - Math.max(" + count + ", 0), 0)"
|
|
807
|
+
} else {
|
|
808
|
+
start = "Math.max(for_a.length - " + count + ", 0)"
|
|
809
|
+
}
|
|
810
|
+
self.emitTerm(a1.value, async)
|
|
811
|
+
| _ =>
|
|
812
|
+
self.emitTerm(list, async)
|
|
813
|
+
}
|
|
814
|
+
Pair(listCode, Pair(start, end))
|
|
815
|
+
}
|
|
809
816
|
|
|
810
817
|
emitTryCatchFinally(term: Term, last: Bool, async: Bool): Option[String] {
|
|
811
818
|
function emitCatch(catchEffect: Type, cases: List[MatchCase]): String {
|
|
@@ -1074,13 +1081,22 @@ extend self: JsEmitter {
|
|
|
1074
1081
|
|
|
1075
1082
|
emitComma(term: Term, async: Bool): String {
|
|
1076
1083
|
term.{
|
|
1084
|
+
| ESequential(_, ESequential(_, ESequential(_, before1, before2), before3), after) {
|
|
1085
|
+
safeCommable(before1) && safeCommable(before2) && safeCommable(before3) && safeCommable(after)
|
|
1086
|
+
} =>
|
|
1087
|
+
"(" + self.emitStatements(before1, False, async) + ", " +
|
|
1088
|
+
self.emitStatements(before2, False, async) + ", " +
|
|
1089
|
+
self.emitStatements(before3, False, async) + ", " +
|
|
1090
|
+
self.emitTerm(after, async) + ")"
|
|
1077
1091
|
| ESequential(_, ESequential(_, before1, before2), after) {
|
|
1078
|
-
safeCommable(before1) && safeCommable(before2)
|
|
1092
|
+
safeCommable(before1) && safeCommable(before2) && safeCommable(after)
|
|
1079
1093
|
} =>
|
|
1080
1094
|
"(" + self.emitStatements(before1, False, async) + ", " +
|
|
1081
1095
|
self.emitStatements(before2, False, async) + ", " +
|
|
1082
1096
|
self.emitTerm(after, async) + ")"
|
|
1083
|
-
| ESequential(_, before, after) {
|
|
1097
|
+
| ESequential(_, before, after) {
|
|
1098
|
+
safeCommable(before) && safeCommable(after)
|
|
1099
|
+
} =>
|
|
1084
1100
|
"(" + self.emitStatements(before, False, async) + ", " +
|
|
1085
1101
|
self.emitTerm(after, async) + ")"
|
|
1086
1102
|
| _ =>
|
|
@@ -1127,10 +1143,16 @@ safeCommable(term: Term): Bool {
|
|
|
1127
1143
|
| EAssign _ => True
|
|
1128
1144
|
| EAssignField _ => True
|
|
1129
1145
|
| ECall _ => True
|
|
1146
|
+
| ECopy _ => True
|
|
1147
|
+
| EVariant _ => True
|
|
1130
1148
|
| EString(_, _) => True
|
|
1131
1149
|
| EInt(_, _) => True
|
|
1132
1150
|
| EChar(_, _) => True
|
|
1133
1151
|
| EFloat(_, _) => True
|
|
1152
|
+
| EList _ => True
|
|
1153
|
+
| EPipe _ => True
|
|
1154
|
+
| ERecord _ => True
|
|
1155
|
+
| EWildcard _ => True
|
|
1134
1156
|
| _ => False
|
|
1135
1157
|
}
|
|
1136
1158
|
}
|
|
@@ -210,6 +210,12 @@ return true
|
|
|
210
210
|
if(_1.ECall) {
|
|
211
211
|
return true
|
|
212
212
|
}
|
|
213
|
+
if(_1.ECopy) {
|
|
214
|
+
return true
|
|
215
|
+
}
|
|
216
|
+
if(_1.EVariant) {
|
|
217
|
+
return true
|
|
218
|
+
}
|
|
213
219
|
if(_1.EString) {
|
|
214
220
|
return true
|
|
215
221
|
}
|
|
@@ -222,6 +228,18 @@ return true
|
|
|
222
228
|
if(_1.EFloat) {
|
|
223
229
|
return true
|
|
224
230
|
}
|
|
231
|
+
if(_1.EList) {
|
|
232
|
+
return true
|
|
233
|
+
}
|
|
234
|
+
if(_1.EPipe) {
|
|
235
|
+
return true
|
|
236
|
+
}
|
|
237
|
+
if(_1.ERecord) {
|
|
238
|
+
return true
|
|
239
|
+
}
|
|
240
|
+
if(_1.EWildcard) {
|
|
241
|
+
return true
|
|
242
|
+
}
|
|
225
243
|
{
|
|
226
244
|
return false
|
|
227
245
|
}
|
|
@@ -445,6 +463,12 @@ return true
|
|
|
445
463
|
if(_1.ECall) {
|
|
446
464
|
return true
|
|
447
465
|
}
|
|
466
|
+
if(_1.ECopy) {
|
|
467
|
+
return true
|
|
468
|
+
}
|
|
469
|
+
if(_1.EVariant) {
|
|
470
|
+
return true
|
|
471
|
+
}
|
|
448
472
|
if(_1.EString) {
|
|
449
473
|
return true
|
|
450
474
|
}
|
|
@@ -457,6 +481,18 @@ return true
|
|
|
457
481
|
if(_1.EFloat) {
|
|
458
482
|
return true
|
|
459
483
|
}
|
|
484
|
+
if(_1.EList) {
|
|
485
|
+
return true
|
|
486
|
+
}
|
|
487
|
+
if(_1.EPipe) {
|
|
488
|
+
return true
|
|
489
|
+
}
|
|
490
|
+
if(_1.ERecord) {
|
|
491
|
+
return true
|
|
492
|
+
}
|
|
493
|
+
if(_1.EWildcard) {
|
|
494
|
+
return true
|
|
495
|
+
}
|
|
460
496
|
{
|
|
461
497
|
return false
|
|
462
498
|
}
|
|
@@ -1182,7 +1218,7 @@ return (("(" + ff_core_List.List_foldLeft(list_, ff_compiler_JsEmitter.JsEmitter
|
|
|
1182
1218
|
const otherwise_ = _1;
|
|
1183
1219
|
const condition_ = _2.first_;
|
|
1184
1220
|
const body_ = _2.second_;
|
|
1185
|
-
return ((((ff_compiler_JsEmitter.
|
|
1221
|
+
return ((((ff_compiler_JsEmitter.JsEmitter_emitComma(self_, condition_, async_) + "\n? ") + ff_compiler_JsEmitter.JsEmitter_emitComma(self_, body_, async_)) + "\n: ") + otherwise_)
|
|
1186
1222
|
}
|
|
1187
1223
|
}))) + ")")
|
|
1188
1224
|
return
|
|
@@ -1194,7 +1230,7 @@ return (("(" + ff_core_List.List_foldLeft(list_, "ff_core_Option.None()", ((_1,
|
|
|
1194
1230
|
const otherwise_ = _1;
|
|
1195
1231
|
const condition_ = _2.first_;
|
|
1196
1232
|
const body_ = _2.second_;
|
|
1197
|
-
return ((((ff_compiler_JsEmitter.
|
|
1233
|
+
return ((((ff_compiler_JsEmitter.JsEmitter_emitComma(self_, condition_, async_) + "\n? ff_core_Option.Some(") + ff_compiler_JsEmitter.JsEmitter_emitComma(self_, body_, async_)) + ")\n: ") + otherwise_)
|
|
1198
1234
|
}
|
|
1199
1235
|
}))) + ")")
|
|
1200
1236
|
return
|
|
@@ -1944,37 +1980,10 @@ if(_guard1.length === 2 && _guard1[1].ELambda && _guard1[1].lambda_.cases_.lengt
|
|
|
1944
1980
|
const list_ = _guard1[0];
|
|
1945
1981
|
const name_ = _guard1[1].lambda_.cases_[0].patterns_[0].name_;
|
|
1946
1982
|
const body_ = _guard1[1].lambda_.cases_[0].body_;
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
const
|
|
1950
|
-
|
|
1951
|
-
const a1_ = _1.arguments_[0];
|
|
1952
|
-
const a2_ = _1.arguments_[1];
|
|
1953
|
-
start_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a2_.value_, async_);
|
|
1954
|
-
if((!ff_core_String.String_all(start_, ((_w1) => {
|
|
1955
|
-
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
1956
|
-
})))) {
|
|
1957
|
-
start_ = (("Math.max(" + start_) + ", 0)")
|
|
1958
|
-
};
|
|
1959
|
-
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a1_.value_, async_)
|
|
1960
|
-
}
|
|
1961
|
-
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_dropLast" && _1.arguments_.length === 2) {
|
|
1962
|
-
const a1_ = _1.arguments_[0];
|
|
1963
|
-
const a2_ = _1.arguments_[1];
|
|
1964
|
-
const count_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a2_.value_, async_);
|
|
1965
|
-
if((!ff_core_String.String_all(count_, ((_w1) => {
|
|
1966
|
-
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
1967
|
-
})))) {
|
|
1968
|
-
end_ = (((end_ + " - Math.max(") + count_) + ", 0)")
|
|
1969
|
-
} else {
|
|
1970
|
-
end_ = ((end_ + " - ") + count_)
|
|
1971
|
-
};
|
|
1972
|
-
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a1_.value_, async_)
|
|
1973
|
-
}
|
|
1974
|
-
{
|
|
1975
|
-
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, list_, async_)
|
|
1976
|
-
}
|
|
1977
|
-
}))(list_);
|
|
1983
|
+
const fusion_ = ff_compiler_JsEmitter.JsEmitter_emitLightFusion(self_, list_, async_);
|
|
1984
|
+
const start_ = fusion_.second_.first_;
|
|
1985
|
+
const end_ = fusion_.second_.second_;
|
|
1986
|
+
const listCode_ = fusion_.first_;
|
|
1978
1987
|
return ff_core_Option.Some(((((((((("for(let for_i = " + start_) + ", for_a = ") + listCode_) + ", for_l = ") + end_) + "; for_i < for_l; for_i++) {\n") + ff_core_Option.Option_else(ff_core_Option.Option_map(name_, ((_w1) => {
|
|
1979
1988
|
return (("const " + ff_compiler_JsEmitter.escapeKeyword_(_w1)) + " = for_a[for_i];\n")
|
|
1980
1989
|
})), (() => {
|
|
@@ -1990,37 +1999,10 @@ const list_ = _guard1[0];
|
|
|
1990
1999
|
const name_ = _guard1[1].lambda_.cases_[0].patterns_[0].name_;
|
|
1991
2000
|
const body_ = _guard1[1].lambda_.cases_[0].body_.before_;
|
|
1992
2001
|
const condition_ = _guard1[1].lambda_.cases_[0].body_.after_;
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
const
|
|
1996
|
-
|
|
1997
|
-
const a1_ = _1.arguments_[0];
|
|
1998
|
-
const a2_ = _1.arguments_[1];
|
|
1999
|
-
start_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a2_.value_, async_);
|
|
2000
|
-
if((!ff_core_String.String_all(start_, ((_w1) => {
|
|
2001
|
-
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
2002
|
-
})))) {
|
|
2003
|
-
start_ = (("Math.max(" + start_) + ", 0)")
|
|
2004
|
-
};
|
|
2005
|
-
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a1_.value_, async_)
|
|
2006
|
-
}
|
|
2007
|
-
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_dropLast" && _1.arguments_.length === 2) {
|
|
2008
|
-
const a1_ = _1.arguments_[0];
|
|
2009
|
-
const a2_ = _1.arguments_[1];
|
|
2010
|
-
const count_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a2_.value_, async_);
|
|
2011
|
-
if((!ff_core_String.String_all(count_, ((_w1) => {
|
|
2012
|
-
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
2013
|
-
})))) {
|
|
2014
|
-
end_ = (((end_ + " - Math.max(") + count_) + ", 0)")
|
|
2015
|
-
} else {
|
|
2016
|
-
end_ = ((end_ + " - ") + count_)
|
|
2017
|
-
};
|
|
2018
|
-
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a1_.value_, async_)
|
|
2019
|
-
}
|
|
2020
|
-
{
|
|
2021
|
-
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, list_, async_)
|
|
2022
|
-
}
|
|
2023
|
-
}))(list_);
|
|
2002
|
+
const fusion_ = ff_compiler_JsEmitter.JsEmitter_emitLightFusion(self_, list_, async_);
|
|
2003
|
+
const start_ = fusion_.second_.first_;
|
|
2004
|
+
const end_ = fusion_.second_.second_;
|
|
2005
|
+
const listCode_ = fusion_.first_;
|
|
2024
2006
|
return ff_core_Option.Some(((((((((((((("for(let for_i = " + start_) + ", for_a = ") + listCode_) + ", for_l = ") + end_) + "; for_i < for_l; for_i++) {\n") + ff_core_Option.Option_else(ff_core_Option.Option_map(name_, ((_w1) => {
|
|
2025
2007
|
return (("const " + ff_compiler_JsEmitter.escapeKeyword_(_w1)) + " = for_a[for_i];\n")
|
|
2026
2008
|
})), (() => {
|
|
@@ -2188,6 +2170,66 @@ return ff_core_Option.None()
|
|
|
2188
2170
|
}
|
|
2189
2171
|
}
|
|
2190
2172
|
|
|
2173
|
+
export function JsEmitter_emitLightFusion(self_, list_, async_) {
|
|
2174
|
+
let start_ = "0";
|
|
2175
|
+
let end_ = "for_a.length";
|
|
2176
|
+
const listCode_ = (((_1) => {
|
|
2177
|
+
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_dropFirst" && _1.arguments_.length === 2) {
|
|
2178
|
+
const a1_ = _1.arguments_[0];
|
|
2179
|
+
const a2_ = _1.arguments_[1];
|
|
2180
|
+
start_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a2_.value_, async_);
|
|
2181
|
+
if((!ff_core_String.String_all(start_, ((_w1) => {
|
|
2182
|
+
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
2183
|
+
})))) {
|
|
2184
|
+
start_ = (("Math.max(" + start_) + ", 0)")
|
|
2185
|
+
};
|
|
2186
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a1_.value_, async_)
|
|
2187
|
+
}
|
|
2188
|
+
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_dropLast" && _1.arguments_.length === 2) {
|
|
2189
|
+
const a1_ = _1.arguments_[0];
|
|
2190
|
+
const a2_ = _1.arguments_[1];
|
|
2191
|
+
const count_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a2_.value_, async_);
|
|
2192
|
+
if((!ff_core_String.String_all(count_, ((_w1) => {
|
|
2193
|
+
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
2194
|
+
})))) {
|
|
2195
|
+
end_ = (((end_ + " - Math.max(") + count_) + ", 0)")
|
|
2196
|
+
} else {
|
|
2197
|
+
end_ = ((end_ + " - ") + count_)
|
|
2198
|
+
};
|
|
2199
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a1_.value_, async_)
|
|
2200
|
+
}
|
|
2201
|
+
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_takeFirst" && _1.arguments_.length === 2) {
|
|
2202
|
+
const a1_ = _1.arguments_[0];
|
|
2203
|
+
const a2_ = _1.arguments_[1];
|
|
2204
|
+
end_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a2_.value_, async_);
|
|
2205
|
+
if((!ff_core_String.String_all(end_, ((_w1) => {
|
|
2206
|
+
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
2207
|
+
})))) {
|
|
2208
|
+
end_ = (("Math.max(" + end_) + ", 0)")
|
|
2209
|
+
};
|
|
2210
|
+
end_ = (("Math.min(" + end_) + ", for_a.length)");
|
|
2211
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a1_.value_, async_)
|
|
2212
|
+
}
|
|
2213
|
+
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_takeLast" && _1.arguments_.length === 2) {
|
|
2214
|
+
const a1_ = _1.arguments_[0];
|
|
2215
|
+
const a2_ = _1.arguments_[1];
|
|
2216
|
+
const count_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a2_.value_, async_);
|
|
2217
|
+
if((!ff_core_String.String_all(count_, ((_w1) => {
|
|
2218
|
+
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
2219
|
+
})))) {
|
|
2220
|
+
start_ = (("Math.max(for_a.length - Math.max(" + count_) + ", 0), 0)")
|
|
2221
|
+
} else {
|
|
2222
|
+
start_ = (("Math.max(for_a.length - " + count_) + ", 0)")
|
|
2223
|
+
};
|
|
2224
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a1_.value_, async_)
|
|
2225
|
+
}
|
|
2226
|
+
{
|
|
2227
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, list_, async_)
|
|
2228
|
+
}
|
|
2229
|
+
}))(list_);
|
|
2230
|
+
return ff_core_Pair.Pair(listCode_, ff_core_Pair.Pair(start_, end_))
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2191
2233
|
export function JsEmitter_emitTryCatchFinally(self_, term_, last_, async_) {
|
|
2192
2234
|
function emitCatch_(catchEffect_, cases_) {
|
|
2193
2235
|
const catchAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(catchEffect_));
|
|
@@ -2517,18 +2559,27 @@ return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, value_, async_)
|
|
|
2517
2559
|
export function JsEmitter_emitComma(self_, term_, async_) {
|
|
2518
2560
|
{
|
|
2519
2561
|
const _1 = term_;
|
|
2562
|
+
if(_1.ESequential && _1.before_.ESequential && _1.before_.before_.ESequential) {
|
|
2563
|
+
const before1_ = _1.before_.before_.before_;
|
|
2564
|
+
const before2_ = _1.before_.before_.after_;
|
|
2565
|
+
const before3_ = _1.before_.after_;
|
|
2566
|
+
const after_ = _1.after_;
|
|
2567
|
+
if((((ff_compiler_JsEmitter.safeCommable_(before1_) && ff_compiler_JsEmitter.safeCommable_(before2_)) && ff_compiler_JsEmitter.safeCommable_(before3_)) && ff_compiler_JsEmitter.safeCommable_(after_))) {
|
|
2568
|
+
return (((((((("(" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, before1_, false, async_)) + ", ") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, before2_, false, async_)) + ", ") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, before3_, false, async_)) + ", ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, after_, async_)) + ")")
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2520
2571
|
if(_1.ESequential && _1.before_.ESequential) {
|
|
2521
2572
|
const before1_ = _1.before_.before_;
|
|
2522
2573
|
const before2_ = _1.before_.after_;
|
|
2523
2574
|
const after_ = _1.after_;
|
|
2524
|
-
if((ff_compiler_JsEmitter.safeCommable_(before1_) && ff_compiler_JsEmitter.safeCommable_(before2_))) {
|
|
2575
|
+
if(((ff_compiler_JsEmitter.safeCommable_(before1_) && ff_compiler_JsEmitter.safeCommable_(before2_)) && ff_compiler_JsEmitter.safeCommable_(after_))) {
|
|
2525
2576
|
return (((((("(" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, before1_, false, async_)) + ", ") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, before2_, false, async_)) + ", ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, after_, async_)) + ")")
|
|
2526
2577
|
}
|
|
2527
2578
|
}
|
|
2528
2579
|
if(_1.ESequential) {
|
|
2529
2580
|
const before_ = _1.before_;
|
|
2530
2581
|
const after_ = _1.after_;
|
|
2531
|
-
if(ff_compiler_JsEmitter.safeCommable_(before_)) {
|
|
2582
|
+
if((ff_compiler_JsEmitter.safeCommable_(before_) && ff_compiler_JsEmitter.safeCommable_(after_))) {
|
|
2532
2583
|
return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, before_, false, async_)) + ", ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, after_, async_)) + ")")
|
|
2533
2584
|
}
|
|
2534
2585
|
}
|
|
@@ -3120,7 +3171,7 @@ return (("(" + (await ff_core_List.List_foldLeft$(list_, (await ff_compiler_JsEm
|
|
|
3120
3171
|
const otherwise_ = _1;
|
|
3121
3172
|
const condition_ = _2.first_;
|
|
3122
3173
|
const body_ = _2.second_;
|
|
3123
|
-
return (((((await ff_compiler_JsEmitter.
|
|
3174
|
+
return (((((await ff_compiler_JsEmitter.JsEmitter_emitComma$(self_, condition_, async_, $task)) + "\n? ") + (await ff_compiler_JsEmitter.JsEmitter_emitComma$(self_, body_, async_, $task))) + "\n: ") + otherwise_)
|
|
3124
3175
|
}
|
|
3125
3176
|
}), $task))) + ")")
|
|
3126
3177
|
return
|
|
@@ -3132,7 +3183,7 @@ return (("(" + (await ff_core_List.List_foldLeft$(list_, "ff_core_Option.None()"
|
|
|
3132
3183
|
const otherwise_ = _1;
|
|
3133
3184
|
const condition_ = _2.first_;
|
|
3134
3185
|
const body_ = _2.second_;
|
|
3135
|
-
return (((((await ff_compiler_JsEmitter.
|
|
3186
|
+
return (((((await ff_compiler_JsEmitter.JsEmitter_emitComma$(self_, condition_, async_, $task)) + "\n? ff_core_Option.Some(") + (await ff_compiler_JsEmitter.JsEmitter_emitComma$(self_, body_, async_, $task))) + ")\n: ") + otherwise_)
|
|
3136
3187
|
}
|
|
3137
3188
|
}), $task))) + ")")
|
|
3138
3189
|
return
|
|
@@ -3882,37 +3933,10 @@ if(_guard1.length === 2 && _guard1[1].ELambda && _guard1[1].lambda_.cases_.lengt
|
|
|
3882
3933
|
const list_ = _guard1[0];
|
|
3883
3934
|
const name_ = _guard1[1].lambda_.cases_[0].patterns_[0].name_;
|
|
3884
3935
|
const body_ = _guard1[1].lambda_.cases_[0].body_;
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
const
|
|
3888
|
-
|
|
3889
|
-
const a1_ = _1.arguments_[0];
|
|
3890
|
-
const a2_ = _1.arguments_[1];
|
|
3891
|
-
start_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a2_.value_, async_, $task));
|
|
3892
|
-
if((!ff_core_String.String_all(start_, ((_w1) => {
|
|
3893
|
-
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
3894
|
-
})))) {
|
|
3895
|
-
start_ = (("Math.max(" + start_) + ", 0)")
|
|
3896
|
-
};
|
|
3897
|
-
return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a1_.value_, async_, $task))
|
|
3898
|
-
}
|
|
3899
|
-
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_dropLast" && _1.arguments_.length === 2) {
|
|
3900
|
-
const a1_ = _1.arguments_[0];
|
|
3901
|
-
const a2_ = _1.arguments_[1];
|
|
3902
|
-
const count_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a2_.value_, async_, $task));
|
|
3903
|
-
if((!ff_core_String.String_all(count_, ((_w1) => {
|
|
3904
|
-
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
3905
|
-
})))) {
|
|
3906
|
-
end_ = (((end_ + " - Math.max(") + count_) + ", 0)")
|
|
3907
|
-
} else {
|
|
3908
|
-
end_ = ((end_ + " - ") + count_)
|
|
3909
|
-
};
|
|
3910
|
-
return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a1_.value_, async_, $task))
|
|
3911
|
-
}
|
|
3912
|
-
{
|
|
3913
|
-
return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, list_, async_, $task))
|
|
3914
|
-
}
|
|
3915
|
-
}))(list_, $task));
|
|
3936
|
+
const fusion_ = (await ff_compiler_JsEmitter.JsEmitter_emitLightFusion$(self_, list_, async_, $task));
|
|
3937
|
+
const start_ = fusion_.second_.first_;
|
|
3938
|
+
const end_ = fusion_.second_.second_;
|
|
3939
|
+
const listCode_ = fusion_.first_;
|
|
3916
3940
|
return ff_core_Option.Some(((((((((("for(let for_i = " + start_) + ", for_a = ") + listCode_) + ", for_l = ") + end_) + "; for_i < for_l; for_i++) {\n") + ff_core_Option.Option_else(ff_core_Option.Option_map(name_, ((_w1) => {
|
|
3917
3941
|
return (("const " + ff_compiler_JsEmitter.escapeKeyword_(_w1)) + " = for_a[for_i];\n")
|
|
3918
3942
|
})), (() => {
|
|
@@ -3928,37 +3952,10 @@ const list_ = _guard1[0];
|
|
|
3928
3952
|
const name_ = _guard1[1].lambda_.cases_[0].patterns_[0].name_;
|
|
3929
3953
|
const body_ = _guard1[1].lambda_.cases_[0].body_.before_;
|
|
3930
3954
|
const condition_ = _guard1[1].lambda_.cases_[0].body_.after_;
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
const
|
|
3934
|
-
|
|
3935
|
-
const a1_ = _1.arguments_[0];
|
|
3936
|
-
const a2_ = _1.arguments_[1];
|
|
3937
|
-
start_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a2_.value_, async_, $task));
|
|
3938
|
-
if((!ff_core_String.String_all(start_, ((_w1) => {
|
|
3939
|
-
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
3940
|
-
})))) {
|
|
3941
|
-
start_ = (("Math.max(" + start_) + ", 0)")
|
|
3942
|
-
};
|
|
3943
|
-
return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a1_.value_, async_, $task))
|
|
3944
|
-
}
|
|
3945
|
-
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_dropLast" && _1.arguments_.length === 2) {
|
|
3946
|
-
const a1_ = _1.arguments_[0];
|
|
3947
|
-
const a2_ = _1.arguments_[1];
|
|
3948
|
-
const count_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a2_.value_, async_, $task));
|
|
3949
|
-
if((!ff_core_String.String_all(count_, ((_w1) => {
|
|
3950
|
-
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
3951
|
-
})))) {
|
|
3952
|
-
end_ = (((end_ + " - Math.max(") + count_) + ", 0)")
|
|
3953
|
-
} else {
|
|
3954
|
-
end_ = ((end_ + " - ") + count_)
|
|
3955
|
-
};
|
|
3956
|
-
return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a1_.value_, async_, $task))
|
|
3957
|
-
}
|
|
3958
|
-
{
|
|
3959
|
-
return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, list_, async_, $task))
|
|
3960
|
-
}
|
|
3961
|
-
}))(list_, $task));
|
|
3955
|
+
const fusion_ = (await ff_compiler_JsEmitter.JsEmitter_emitLightFusion$(self_, list_, async_, $task));
|
|
3956
|
+
const start_ = fusion_.second_.first_;
|
|
3957
|
+
const end_ = fusion_.second_.second_;
|
|
3958
|
+
const listCode_ = fusion_.first_;
|
|
3962
3959
|
return ff_core_Option.Some(((((((((((((("for(let for_i = " + start_) + ", for_a = ") + listCode_) + ", for_l = ") + end_) + "; for_i < for_l; for_i++) {\n") + ff_core_Option.Option_else(ff_core_Option.Option_map(name_, ((_w1) => {
|
|
3963
3960
|
return (("const " + ff_compiler_JsEmitter.escapeKeyword_(_w1)) + " = for_a[for_i];\n")
|
|
3964
3961
|
})), (() => {
|
|
@@ -4126,6 +4123,66 @@ return ff_core_Option.None()
|
|
|
4126
4123
|
}
|
|
4127
4124
|
}
|
|
4128
4125
|
|
|
4126
|
+
export async function JsEmitter_emitLightFusion$(self_, list_, async_, $task) {
|
|
4127
|
+
let start_ = "0";
|
|
4128
|
+
let end_ = "for_a.length";
|
|
4129
|
+
const listCode_ = (await ((async (_1, $task) => {
|
|
4130
|
+
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_dropFirst" && _1.arguments_.length === 2) {
|
|
4131
|
+
const a1_ = _1.arguments_[0];
|
|
4132
|
+
const a2_ = _1.arguments_[1];
|
|
4133
|
+
start_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a2_.value_, async_, $task));
|
|
4134
|
+
if((!ff_core_String.String_all(start_, ((_w1) => {
|
|
4135
|
+
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
4136
|
+
})))) {
|
|
4137
|
+
start_ = (("Math.max(" + start_) + ", 0)")
|
|
4138
|
+
};
|
|
4139
|
+
return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a1_.value_, async_, $task))
|
|
4140
|
+
}
|
|
4141
|
+
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_dropLast" && _1.arguments_.length === 2) {
|
|
4142
|
+
const a1_ = _1.arguments_[0];
|
|
4143
|
+
const a2_ = _1.arguments_[1];
|
|
4144
|
+
const count_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a2_.value_, async_, $task));
|
|
4145
|
+
if((!ff_core_String.String_all(count_, ((_w1) => {
|
|
4146
|
+
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
4147
|
+
})))) {
|
|
4148
|
+
end_ = (((end_ + " - Math.max(") + count_) + ", 0)")
|
|
4149
|
+
} else {
|
|
4150
|
+
end_ = ((end_ + " - ") + count_)
|
|
4151
|
+
};
|
|
4152
|
+
return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a1_.value_, async_, $task))
|
|
4153
|
+
}
|
|
4154
|
+
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_takeFirst" && _1.arguments_.length === 2) {
|
|
4155
|
+
const a1_ = _1.arguments_[0];
|
|
4156
|
+
const a2_ = _1.arguments_[1];
|
|
4157
|
+
end_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a2_.value_, async_, $task));
|
|
4158
|
+
if((!ff_core_String.String_all(end_, ((_w1) => {
|
|
4159
|
+
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
4160
|
+
})))) {
|
|
4161
|
+
end_ = (("Math.max(" + end_) + ", 0)")
|
|
4162
|
+
};
|
|
4163
|
+
end_ = (("Math.min(" + end_) + ", for_a.length)");
|
|
4164
|
+
return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a1_.value_, async_, $task))
|
|
4165
|
+
}
|
|
4166
|
+
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_takeLast" && _1.arguments_.length === 2) {
|
|
4167
|
+
const a1_ = _1.arguments_[0];
|
|
4168
|
+
const a2_ = _1.arguments_[1];
|
|
4169
|
+
const count_ = (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a2_.value_, async_, $task));
|
|
4170
|
+
if((!ff_core_String.String_all(count_, ((_w1) => {
|
|
4171
|
+
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
4172
|
+
})))) {
|
|
4173
|
+
start_ = (("Math.max(for_a.length - Math.max(" + count_) + ", 0), 0)")
|
|
4174
|
+
} else {
|
|
4175
|
+
start_ = (("Math.max(for_a.length - " + count_) + ", 0)")
|
|
4176
|
+
};
|
|
4177
|
+
return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, a1_.value_, async_, $task))
|
|
4178
|
+
}
|
|
4179
|
+
{
|
|
4180
|
+
return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, list_, async_, $task))
|
|
4181
|
+
}
|
|
4182
|
+
}))(list_, $task));
|
|
4183
|
+
return ff_core_Pair.Pair(listCode_, ff_core_Pair.Pair(start_, end_))
|
|
4184
|
+
}
|
|
4185
|
+
|
|
4129
4186
|
export async function JsEmitter_emitTryCatchFinally$(self_, term_, last_, async_, $task) {
|
|
4130
4187
|
async function emitCatch_$(catchEffect_, cases_, $task) {
|
|
4131
4188
|
const catchAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(catchEffect_));
|
|
@@ -4455,18 +4512,27 @@ return (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, value_, async_, $
|
|
|
4455
4512
|
export async function JsEmitter_emitComma$(self_, term_, async_, $task) {
|
|
4456
4513
|
{
|
|
4457
4514
|
const _1 = term_;
|
|
4515
|
+
if(_1.ESequential && _1.before_.ESequential && _1.before_.before_.ESequential) {
|
|
4516
|
+
const before1_ = _1.before_.before_.before_;
|
|
4517
|
+
const before2_ = _1.before_.before_.after_;
|
|
4518
|
+
const before3_ = _1.before_.after_;
|
|
4519
|
+
const after_ = _1.after_;
|
|
4520
|
+
if((((ff_compiler_JsEmitter.safeCommable_(before1_) && ff_compiler_JsEmitter.safeCommable_(before2_)) && ff_compiler_JsEmitter.safeCommable_(before3_)) && ff_compiler_JsEmitter.safeCommable_(after_))) {
|
|
4521
|
+
return (((((((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, before1_, false, async_, $task))) + ", ") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, before2_, false, async_, $task))) + ", ") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, before3_, false, async_, $task))) + ", ") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, after_, async_, $task))) + ")")
|
|
4522
|
+
}
|
|
4523
|
+
}
|
|
4458
4524
|
if(_1.ESequential && _1.before_.ESequential) {
|
|
4459
4525
|
const before1_ = _1.before_.before_;
|
|
4460
4526
|
const before2_ = _1.before_.after_;
|
|
4461
4527
|
const after_ = _1.after_;
|
|
4462
|
-
if((ff_compiler_JsEmitter.safeCommable_(before1_) && ff_compiler_JsEmitter.safeCommable_(before2_))) {
|
|
4528
|
+
if(((ff_compiler_JsEmitter.safeCommable_(before1_) && ff_compiler_JsEmitter.safeCommable_(before2_)) && ff_compiler_JsEmitter.safeCommable_(after_))) {
|
|
4463
4529
|
return (((((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, before1_, false, async_, $task))) + ", ") + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, before2_, false, async_, $task))) + ", ") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, after_, async_, $task))) + ")")
|
|
4464
4530
|
}
|
|
4465
4531
|
}
|
|
4466
4532
|
if(_1.ESequential) {
|
|
4467
4533
|
const before_ = _1.before_;
|
|
4468
4534
|
const after_ = _1.after_;
|
|
4469
|
-
if(ff_compiler_JsEmitter.safeCommable_(before_)) {
|
|
4535
|
+
if((ff_compiler_JsEmitter.safeCommable_(before_) && ff_compiler_JsEmitter.safeCommable_(after_))) {
|
|
4470
4536
|
return (((("(" + (await ff_compiler_JsEmitter.JsEmitter_emitStatements$(self_, before_, false, async_, $task))) + ", ") + (await ff_compiler_JsEmitter.JsEmitter_emitTerm$(self_, after_, async_, $task))) + ")")
|
|
4471
4537
|
}
|
|
4472
4538
|
}
|
|
@@ -414,10 +414,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbol
|
|
|
414
414
|
};
|
|
415
415
|
const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
|
|
416
416
|
const variableType_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())
|
|
417
|
-
? (
|
|
418
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
419
|
-
return ff_compiler_Parser.Parser_parseType(self_)
|
|
420
|
-
})()
|
|
417
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon()), ff_compiler_Parser.Parser_parseType(self_))
|
|
421
418
|
: ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(nameToken_)));
|
|
422
419
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
|
|
423
420
|
const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
|
|
@@ -573,10 +570,7 @@ const parameters_ = ((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (
|
|
|
573
570
|
? []
|
|
574
571
|
: ff_compiler_Parser.Parser_parseFunctionParameters(self_, false));
|
|
575
572
|
const returnType_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())
|
|
576
|
-
? (
|
|
577
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
578
|
-
return ff_compiler_Parser.Parser_parseType(self_)
|
|
579
|
-
})()
|
|
573
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon()), ff_compiler_Parser.Parser_parseType(self_))
|
|
580
574
|
: ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "ff:core/Unit.Unit", []));
|
|
581
575
|
const temporaryEffect_ = ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(nameToken_), "TemporaryEffect$", []);
|
|
582
576
|
return ff_compiler_Syntax.Signature(ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_raw(nameToken_), member_, poly_.generics_, poly_.constraints_, parameters_, returnType_, temporaryEffect_)
|
|
@@ -814,10 +808,7 @@ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot())
|
|
|
814
808
|
};
|
|
815
809
|
const fileToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
|
|
816
810
|
const alias_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "as")
|
|
817
|
-
? (
|
|
818
|
-
ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "as");
|
|
819
|
-
return ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper()))
|
|
820
|
-
})()
|
|
811
|
+
? (ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "as"), ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper())))
|
|
821
812
|
: ff_compiler_Token.Token_raw(fileToken_));
|
|
822
813
|
const packagePair_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "from")
|
|
823
814
|
? (function() {
|
|
@@ -908,10 +899,7 @@ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compi
|
|
|
908
899
|
const majorMinor_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LFloat());
|
|
909
900
|
const parts_ = ff_core_String.String_split(ff_compiler_Token.Token_raw(majorMinor_), 46);
|
|
910
901
|
const patch_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDot())
|
|
911
|
-
? (
|
|
912
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot());
|
|
913
|
-
return ff_core_String.String_grabInt(ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt())))
|
|
914
|
-
})()
|
|
902
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot()), ff_core_String.String_grabInt(ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt()))))
|
|
915
903
|
: 0);
|
|
916
904
|
return ff_compiler_Syntax.Version(ff_compiler_Token.Token_at(majorMinor_), ff_core_String.String_grabInt(ff_core_List.List_grab(parts_, 0)), ff_core_String.String_grabInt(ff_core_List.List_grab(parts_, 1)), patch_)
|
|
917
905
|
} else {
|
|
@@ -1398,10 +1386,7 @@ if(self_.lspHook_.trackSymbols_) {
|
|
|
1398
1386
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(nameToken_), ff_compiler_LspHook.SLet(mutable_), ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(mutableToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
|
|
1399
1387
|
};
|
|
1400
1388
|
const body_ = (ff_compiler_Parser.Parser_currentIsSeparator(self_, ff_compiler_Token.LSemicolon())
|
|
1401
|
-
? (
|
|
1402
|
-
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon());
|
|
1403
|
-
return ff_compiler_Parser.Parser_parseStatements(self_)
|
|
1404
|
-
})()
|
|
1389
|
+
? (ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon()), ff_compiler_Parser.Parser_parseStatements(self_))
|
|
1405
1390
|
: ff_compiler_Syntax.EVariant(ff_compiler_Token.Token_at(keywordToken_), "Unit", [], ff_core_Option.None()));
|
|
1406
1391
|
return ff_compiler_Syntax.ELet(ff_compiler_Token.Token_at(nameToken_), mutable_, ff_compiler_Token.Token_raw(nameToken_), valueType_, value_, body_)
|
|
1407
1392
|
}
|
|
@@ -1503,10 +1488,7 @@ return ff_compiler_Parser.Parser_parseFieldsAndCalls(self_)
|
|
|
1503
1488
|
|
|
1504
1489
|
export function Parser_parseFieldsAndCalls(self_) {
|
|
1505
1490
|
const tailCall_ = ((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "tailcall"))
|
|
1506
|
-
? (
|
|
1507
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword());
|
|
1508
|
-
return true
|
|
1509
|
-
})()
|
|
1491
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()), true)
|
|
1510
1492
|
: false);
|
|
1511
1493
|
let result_ = ff_compiler_Parser.Parser_parseAtom(self_);
|
|
1512
1494
|
while(ff_compiler_Token.Token_is5(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketLeft(), ff_compiler_Token.LColon(), ff_compiler_Token.LDot(), ff_compiler_Token.LArrowThin(), ff_compiler_Token.LUnary())) {
|
|
@@ -1608,15 +1590,9 @@ const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_comp
|
|
|
1608
1590
|
return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(member_.at_, ff_core_Option.None(), member_), ...arguments_.first_], [])
|
|
1609
1591
|
} else if(ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign(), ff_compiler_Token.LAssignPlus(), ff_compiler_Token.LAssignMinus())) {
|
|
1610
1592
|
const method_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign())
|
|
1611
|
-
? (
|
|
1612
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
|
|
1613
|
-
return "set"
|
|
1614
|
-
})()
|
|
1593
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign()), "set")
|
|
1615
1594
|
: ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssignPlus())
|
|
1616
|
-
? (
|
|
1617
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignPlus());
|
|
1618
|
-
return "increment"
|
|
1619
|
-
})()
|
|
1595
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignPlus()), "increment")
|
|
1620
1596
|
: (function() {
|
|
1621
1597
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignMinus());
|
|
1622
1598
|
return "decrement"
|
|
@@ -1733,10 +1709,7 @@ return startBracketAt_
|
|
|
1733
1709
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
1734
1710
|
const fieldToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
|
|
1735
1711
|
const field_ = (((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign()))
|
|
1736
|
-
? (
|
|
1737
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
|
|
1738
|
-
return ff_compiler_Syntax.Field(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parseTerm(self_))
|
|
1739
|
-
})()
|
|
1712
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign()), ff_compiler_Syntax.Field(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parseTerm(self_)))
|
|
1740
1713
|
: ff_compiler_Syntax.Field(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_))));
|
|
1741
1714
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
1742
1715
|
if(ff_compiler_LspHook.strictlyBetween_(startAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
@@ -2035,10 +2008,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbol
|
|
|
2035
2008
|
};
|
|
2036
2009
|
const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
|
|
2037
2010
|
const variableType_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())
|
|
2038
|
-
? (
|
|
2039
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
2040
|
-
return ff_compiler_Parser.Parser_parseType(self_)
|
|
2041
|
-
})())
|
|
2011
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon()), ff_compiler_Parser.Parser_parseType(self_))
|
|
2042
2012
|
: ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(nameToken_)));
|
|
2043
2013
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
|
|
2044
2014
|
const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
|
|
@@ -2194,10 +2164,7 @@ const parameters_ = ((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (
|
|
|
2194
2164
|
? []
|
|
2195
2165
|
: ff_compiler_Parser.Parser_parseFunctionParameters(self_, false));
|
|
2196
2166
|
const returnType_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())
|
|
2197
|
-
? (
|
|
2198
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
2199
|
-
return ff_compiler_Parser.Parser_parseType(self_)
|
|
2200
|
-
})())
|
|
2167
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon()), ff_compiler_Parser.Parser_parseType(self_))
|
|
2201
2168
|
: ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "ff:core/Unit.Unit", []));
|
|
2202
2169
|
const temporaryEffect_ = ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(nameToken_), "TemporaryEffect$", []);
|
|
2203
2170
|
return ff_compiler_Syntax.Signature(ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_raw(nameToken_), member_, poly_.generics_, poly_.constraints_, parameters_, returnType_, temporaryEffect_)
|
|
@@ -2435,10 +2402,7 @@ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot())
|
|
|
2435
2402
|
};
|
|
2436
2403
|
const fileToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
|
|
2437
2404
|
const alias_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "as")
|
|
2438
|
-
? (
|
|
2439
|
-
ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "as");
|
|
2440
|
-
return ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper()))
|
|
2441
|
-
})())
|
|
2405
|
+
? (ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "as"), ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper())))
|
|
2442
2406
|
: ff_compiler_Token.Token_raw(fileToken_));
|
|
2443
2407
|
const packagePair_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "from")
|
|
2444
2408
|
? (await (async function() {
|
|
@@ -2529,10 +2493,7 @@ if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compi
|
|
|
2529
2493
|
const majorMinor_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LFloat());
|
|
2530
2494
|
const parts_ = ff_core_String.String_split(ff_compiler_Token.Token_raw(majorMinor_), 46);
|
|
2531
2495
|
const patch_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDot())
|
|
2532
|
-
? (
|
|
2533
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot());
|
|
2534
|
-
return ff_core_String.String_grabInt(ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt())))
|
|
2535
|
-
})())
|
|
2496
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot()), ff_core_String.String_grabInt(ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt()))))
|
|
2536
2497
|
: 0);
|
|
2537
2498
|
return ff_compiler_Syntax.Version(ff_compiler_Token.Token_at(majorMinor_), ff_core_String.String_grabInt(ff_core_List.List_grab(parts_, 0)), ff_core_String.String_grabInt(ff_core_List.List_grab(parts_, 1)), patch_)
|
|
2538
2499
|
} else {
|
|
@@ -3019,10 +2980,7 @@ if(self_.lspHook_.trackSymbols_) {
|
|
|
3019
2980
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(nameToken_), ff_compiler_LspHook.SLet(mutable_), ff_compiler_Token.Token_at(nameToken_), ff_compiler_Token.Token_end(nameToken_), ff_compiler_Token.Token_at(mutableToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
|
|
3020
2981
|
};
|
|
3021
2982
|
const body_ = (ff_compiler_Parser.Parser_currentIsSeparator(self_, ff_compiler_Token.LSemicolon())
|
|
3022
|
-
? (
|
|
3023
|
-
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon());
|
|
3024
|
-
return ff_compiler_Parser.Parser_parseStatements(self_)
|
|
3025
|
-
})())
|
|
2983
|
+
? (ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon()), ff_compiler_Parser.Parser_parseStatements(self_))
|
|
3026
2984
|
: ff_compiler_Syntax.EVariant(ff_compiler_Token.Token_at(keywordToken_), "Unit", [], ff_core_Option.None()));
|
|
3027
2985
|
return ff_compiler_Syntax.ELet(ff_compiler_Token.Token_at(nameToken_), mutable_, ff_compiler_Token.Token_raw(nameToken_), valueType_, value_, body_)
|
|
3028
2986
|
}
|
|
@@ -3124,10 +3082,7 @@ return ff_compiler_Parser.Parser_parseFieldsAndCalls(self_)
|
|
|
3124
3082
|
|
|
3125
3083
|
export async function Parser_parseFieldsAndCalls$(self_, $task) {
|
|
3126
3084
|
const tailCall_ = ((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "tailcall"))
|
|
3127
|
-
? (
|
|
3128
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword());
|
|
3129
|
-
return true
|
|
3130
|
-
})())
|
|
3085
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword()), true)
|
|
3131
3086
|
: false);
|
|
3132
3087
|
let result_ = ff_compiler_Parser.Parser_parseAtom(self_);
|
|
3133
3088
|
while(ff_compiler_Token.Token_is5(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketLeft(), ff_compiler_Token.LColon(), ff_compiler_Token.LDot(), ff_compiler_Token.LArrowThin(), ff_compiler_Token.LUnary())) {
|
|
@@ -3229,15 +3184,9 @@ const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_comp
|
|
|
3229
3184
|
return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(member_.at_, ff_core_Option.None(), member_), ...arguments_.first_], [])
|
|
3230
3185
|
} else if(ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign(), ff_compiler_Token.LAssignPlus(), ff_compiler_Token.LAssignMinus())) {
|
|
3231
3186
|
const method_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign())
|
|
3232
|
-
? (
|
|
3233
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
|
|
3234
|
-
return "set"
|
|
3235
|
-
})())
|
|
3187
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign()), "set")
|
|
3236
3188
|
: ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssignPlus())
|
|
3237
|
-
? (
|
|
3238
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignPlus());
|
|
3239
|
-
return "increment"
|
|
3240
|
-
})())
|
|
3189
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignPlus()), "increment")
|
|
3241
3190
|
: (await (async function() {
|
|
3242
3191
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignMinus());
|
|
3243
3192
|
return "decrement"
|
|
@@ -3354,10 +3303,7 @@ return startBracketAt_
|
|
|
3354
3303
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
3355
3304
|
const fieldToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
|
|
3356
3305
|
const field_ = (((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign()))
|
|
3357
|
-
? (
|
|
3358
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
|
|
3359
|
-
return ff_compiler_Syntax.Field(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parseTerm(self_))
|
|
3360
|
-
})())
|
|
3306
|
+
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign()), ff_compiler_Syntax.Field(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parseTerm(self_)))
|
|
3361
3307
|
: ff_compiler_Syntax.Field(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_))));
|
|
3362
3308
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
3363
3309
|
if(ff_compiler_LspHook.strictlyBetween_(startAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
@@ -413,10 +413,7 @@ let i_ = 0;
|
|
|
413
413
|
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
414
414
|
const x_ = for_a[for_i];
|
|
415
415
|
if(!(body_(x_)
|
|
416
|
-
? (
|
|
417
|
-
result_ = ff_core_Option.Some(i_);
|
|
418
|
-
return false
|
|
419
|
-
})()
|
|
416
|
+
? (result_ = ff_core_Option.Some(i_), false)
|
|
420
417
|
: (function() {
|
|
421
418
|
i_ += 1;
|
|
422
419
|
return true
|
|
@@ -430,10 +427,7 @@ let result_ = ff_core_Option.None();
|
|
|
430
427
|
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
431
428
|
const x_ = for_a[for_i];
|
|
432
429
|
if(!(body_(x_)
|
|
433
|
-
? (
|
|
434
|
-
result_ = ff_core_Option.Some(x_);
|
|
435
|
-
return false
|
|
436
|
-
})()
|
|
430
|
+
? (result_ = ff_core_Option.Some(x_), false)
|
|
437
431
|
: true)) break
|
|
438
432
|
};
|
|
439
433
|
return result_
|
|
@@ -782,10 +776,7 @@ let i_ = 0;
|
|
|
782
776
|
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
783
777
|
const x_ = for_a[for_i];
|
|
784
778
|
if(!((await body_(x_, $task))
|
|
785
|
-
? (
|
|
786
|
-
result_ = ff_core_Option.Some(i_);
|
|
787
|
-
return false
|
|
788
|
-
})())
|
|
779
|
+
? (result_ = ff_core_Option.Some(i_), false)
|
|
789
780
|
: (await (async function() {
|
|
790
781
|
i_ += 1;
|
|
791
782
|
return true
|
|
@@ -799,10 +790,7 @@ let result_ = ff_core_Option.None();
|
|
|
799
790
|
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
800
791
|
const x_ = for_a[for_i];
|
|
801
792
|
if(!((await body_(x_, $task))
|
|
802
|
-
? (
|
|
803
|
-
result_ = ff_core_Option.Some(x_);
|
|
804
|
-
return false
|
|
805
|
-
})())
|
|
793
|
+
? (result_ = ff_core_Option.Some(x_), false)
|
|
806
794
|
: true)) break
|
|
807
795
|
};
|
|
808
796
|
return result_
|
|
@@ -233,7 +233,7 @@ return ff_core_Array.Array_drain(array_)
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
export function Random_sampleArray(self_, count_, array_, body_) {
|
|
236
|
-
for(let for_i = 0, for_a =
|
|
236
|
+
for(let for_i = 0, for_a = ff_core_Random.Random_shuffleList(self_, ff_core_Array.Array_toList(array_, 0, 9007199254740991)), for_l = Math.min(Math.max(count_, 0), for_a.length); for_i < for_l; for_i++) {
|
|
237
237
|
const _w1 = for_a[for_i];
|
|
238
238
|
body_(_w1)
|
|
239
239
|
}
|
|
@@ -295,7 +295,7 @@ return ff_core_Array.Array_drain(array_)
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
export async function Random_sampleArray$(self_, count_, array_, body_, $task) {
|
|
298
|
-
for(let for_i = 0, for_a =
|
|
298
|
+
for(let for_i = 0, for_a = ff_core_Random.Random_shuffleList(self_, ff_core_Array.Array_toList(array_, 0, 9007199254740991)), for_l = Math.min(Math.max(count_, 0), for_a.length); for_i < for_l; for_i++) {
|
|
299
299
|
const _w1 = for_a[for_i];
|
|
300
300
|
(await body_(_w1, $task))
|
|
301
301
|
}
|
package/package.json
CHANGED