firefly-compiler 0.5.16 → 0.5.18
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 +15 -1
- package/compiler/Compiler.ff +8 -3
- package/compiler/JsEmitter.ff +5 -5
- package/output/js/ff/compiler/Builder.mjs +32 -0
- package/output/js/ff/compiler/Compiler.mjs +6 -2
- package/output/js/ff/compiler/JsEmitter.mjs +273 -273
- package/package.json +1 -1
- package/vscode/package.json +1 -1
- package/core/.firefly/include/prepare.sh +0 -1
- package/postgresql/.firefly/include/prepare.sh +0 -2
|
@@ -101,8 +101,8 @@ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
|
101
101
|
import * as ff_core_UnsafeJs from "../../ff/core/UnsafeJs.mjs"
|
|
102
102
|
|
|
103
103
|
// type JsEmitter
|
|
104
|
-
export function JsEmitter(otherModules_, jsImporter_, emitTarget_, isMainModule_,
|
|
105
|
-
return {otherModules_, jsImporter_, emitTarget_, isMainModule_,
|
|
104
|
+
export function JsEmitter(otherModules_, jsImporter_, emitTarget_, isMainModule_, compilerModuleFileUrl_, packagePair_, moduleName_, emittingAsync_, tailCallUsed_) {
|
|
105
|
+
return {otherModules_, jsImporter_, emitTarget_, isMainModule_, compilerModuleFileUrl_, packagePair_, moduleName_, emittingAsync_, tailCallUsed_};
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// type EmitTarget
|
|
@@ -130,11 +130,11 @@ return {variantName_, newtype_, loneVariant_, arguments_};
|
|
|
130
130
|
|
|
131
131
|
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
132
|
|
|
133
|
-
export function new_(otherModules_, emitTarget_, isMainModule_,
|
|
133
|
+
export function new_(otherModules_, emitTarget_, isMainModule_, compilerModuleFileUrl_, packagePair_, moduleName_) {
|
|
134
134
|
return ff_compiler_JsEmitter.JsEmitter(ff_core_List.List_toMap(ff_core_List.List_map(otherModules_, ((m_) => {
|
|
135
135
|
const moduleName_ = ((ff_compiler_Syntax.PackagePair_groupName(m_.packagePair_, ":") + "/") + ff_core_String.String_dropLast(m_.file_, 3));
|
|
136
136
|
return ff_core_Pair.Pair(moduleName_, m_)
|
|
137
|
-
})), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_compiler_JsImporter.new_(), emitTarget_, isMainModule_,
|
|
137
|
+
})), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_compiler_JsImporter.new_(), emitTarget_, isMainModule_, compilerModuleFileUrl_, packagePair_, moduleName_, false, false)
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
export function fail_(at_, message_) {
|
|
@@ -383,11 +383,11 @@ return false
|
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
export async function new_$(otherModules_, emitTarget_, isMainModule_,
|
|
386
|
+
export async function new_$(otherModules_, emitTarget_, isMainModule_, compilerModuleFileUrl_, packagePair_, moduleName_, $task) {
|
|
387
387
|
return ff_compiler_JsEmitter.JsEmitter(ff_core_List.List_toMap(ff_core_List.List_map(otherModules_, ((m_) => {
|
|
388
388
|
const moduleName_ = ((ff_compiler_Syntax.PackagePair_groupName(m_.packagePair_, ":") + "/") + ff_core_String.String_dropLast(m_.file_, 3));
|
|
389
389
|
return ff_core_Pair.Pair(moduleName_, m_)
|
|
390
|
-
})), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_compiler_JsImporter.new_(), emitTarget_, isMainModule_,
|
|
390
|
+
})), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_compiler_JsImporter.new_(), emitTarget_, isMainModule_, compilerModuleFileUrl_, packagePair_, moduleName_, false, false)
|
|
391
391
|
}
|
|
392
392
|
|
|
393
393
|
export async function fail_$(at_, message_, $task) {
|
|
@@ -638,8 +638,8 @@ return false
|
|
|
638
638
|
|
|
639
639
|
export function JsEmitter_emitModule(self_, packagePair_, module_) {
|
|
640
640
|
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\"");
|
|
641
|
-
const imports_ = ff_core_List.List_flatten([ff_core_Option.Option_toList(ff_core_Option.Option_map(self_.
|
|
642
|
-
return (("import * as $firefly_compiler from '" +
|
|
641
|
+
const imports_ = ff_core_List.List_flatten([ff_core_Option.Option_toList(ff_core_Option.Option_map(self_.compilerModuleFileUrl_, ((_w1) => {
|
|
642
|
+
return (("import * as $firefly_compiler from '" + _w1) + "'")
|
|
643
643
|
}))), ff_core_List.List_map(ff_core_List.List_sortBy(module_.imports_, ((i_) => {
|
|
644
644
|
return ff_core_Pair.Pair(i_.package_, i_.file_)
|
|
645
645
|
}), 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) => {
|
|
@@ -2625,33 +2625,33 @@ return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, term_, async_)
|
|
|
2625
2625
|
|
|
2626
2626
|
export async function JsEmitter_emitModule$(self_, packagePair_, module_, $task) {
|
|
2627
2627
|
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\"");
|
|
2628
|
-
const imports_ = ff_core_List.List_flatten([ff_core_Option.Option_toList(
|
|
2629
|
-
return (("import * as $firefly_compiler from '" +
|
|
2630
|
-
})
|
|
2628
|
+
const imports_ = ff_core_List.List_flatten([ff_core_Option.Option_toList(ff_core_Option.Option_map(self_.compilerModuleFileUrl_, ((_w1) => {
|
|
2629
|
+
return (("import * as $firefly_compiler from '" + _w1) + "'")
|
|
2630
|
+
}))), ff_core_List.List_map(ff_core_List.List_sortBy(module_.imports_, ((i_) => {
|
|
2631
2631
|
return ff_core_Pair.Pair(i_.package_, i_.file_)
|
|
2632
|
-
}), 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)), (
|
|
2633
|
-
return
|
|
2634
|
-
})
|
|
2632
|
+
}), 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) => {
|
|
2633
|
+
return ff_compiler_JsEmitter.JsEmitter_emitImportDefinition(self_, _w1)
|
|
2634
|
+
}))]);
|
|
2635
2635
|
const parts_ = [(ff_core_List.List_any(imports_, ((_w1) => {
|
|
2636
2636
|
return (_w1 === selfImport_)
|
|
2637
2637
|
}))
|
|
2638
2638
|
? imports_
|
|
2639
|
-
: [selfImport_, ...imports_]),
|
|
2640
|
-
return
|
|
2641
|
-
})
|
|
2642
|
-
return ("export " +
|
|
2643
|
-
})
|
|
2644
|
-
return ("export " +
|
|
2645
|
-
})
|
|
2646
|
-
return
|
|
2647
|
-
return ("export " +
|
|
2648
|
-
})
|
|
2649
|
-
})
|
|
2650
|
-
return
|
|
2651
|
-
})
|
|
2652
|
-
return
|
|
2653
|
-
})
|
|
2654
|
-
?
|
|
2639
|
+
: [selfImport_, ...imports_]), ff_core_List.List_map(module_.types_, ((_w1) => {
|
|
2640
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTypeDefinition(self_, _w1)
|
|
2641
|
+
})), ff_core_List.List_map(module_.lets_, ((_w1) => {
|
|
2642
|
+
return ("export " + ff_compiler_JsEmitter.JsEmitter_emitLetDefinition(self_, _w1, false, false))
|
|
2643
|
+
})), ff_core_List.List_map(module_.functions_, ((_w1) => {
|
|
2644
|
+
return ("export " + ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_, _w1, false, ""))
|
|
2645
|
+
})), ff_compiler_JsEmitter.JsEmitter_withEmittingAsync(self_, (() => {
|
|
2646
|
+
return ff_core_List.List_map(module_.functions_, ((_w1) => {
|
|
2647
|
+
return ("export " + ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_, _w1, true, ""))
|
|
2648
|
+
}))
|
|
2649
|
+
})), ff_core_List.List_map(module_.extends_, ((_w1) => {
|
|
2650
|
+
return ff_compiler_JsEmitter.JsEmitter_emitExtendsDefinition(self_, _w1)
|
|
2651
|
+
})), ff_core_List.List_map(module_.instances_, ((_w1) => {
|
|
2652
|
+
return ff_compiler_JsEmitter.JsEmitter_emitInstanceDefinition(self_, _w1)
|
|
2653
|
+
})), (self_.isMainModule_
|
|
2654
|
+
? ff_compiler_JsEmitter.JsEmitter_emitRun(self_, module_.functions_, packagePair_, ((packagePair_.group_ === "ff") && (packagePair_.name_ === "compiler")))
|
|
2655
2655
|
: [])];
|
|
2656
2656
|
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"))
|
|
2657
2657
|
? ["esbuild"]
|
|
@@ -2732,7 +2732,7 @@ export async function JsEmitter_emitLetDefinition$(self_, definition_, mutable_,
|
|
|
2732
2732
|
const mutability_ = (mutable_
|
|
2733
2733
|
? "let"
|
|
2734
2734
|
: "const");
|
|
2735
|
-
const valueCode_ =
|
|
2735
|
+
const valueCode_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, definition_.value_, async_);
|
|
2736
2736
|
const assignmentCode_ = (((!mutable_) || (valueCode_ !== "(void 0)"))
|
|
2737
2737
|
? (" = " + valueCode_)
|
|
2738
2738
|
: "");
|
|
@@ -2755,31 +2755,31 @@ return
|
|
|
2755
2755
|
}
|
|
2756
2756
|
}
|
|
2757
2757
|
}));
|
|
2758
|
-
const syncMethods_ =
|
|
2759
|
-
return ("export " +
|
|
2760
|
-
})
|
|
2761
|
-
const asyncMethods_ =
|
|
2762
|
-
return
|
|
2763
|
-
return ("export " +
|
|
2764
|
-
})
|
|
2765
|
-
})
|
|
2758
|
+
const syncMethods_ = ff_core_List.List_map(methods_, ((_w1) => {
|
|
2759
|
+
return ("export " + ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_, _w1, false, ""))
|
|
2760
|
+
}));
|
|
2761
|
+
const asyncMethods_ = ff_compiler_JsEmitter.JsEmitter_withEmittingAsync(self_, (() => {
|
|
2762
|
+
return ff_core_List.List_map(methods_, ((_w1) => {
|
|
2763
|
+
return ("export " + ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_, _w1, true, ""))
|
|
2764
|
+
}))
|
|
2765
|
+
}));
|
|
2766
2766
|
return ff_core_List.List_join([...syncMethods_, ...asyncMethods_], "\n\n")
|
|
2767
2767
|
}
|
|
2768
2768
|
|
|
2769
2769
|
export async function JsEmitter_emitInstanceDefinition$(self_, definition_, $task) {
|
|
2770
2770
|
const name_ = ff_compiler_JsEmitter.makeDictionaryName_(definition_.traitName_, ff_compiler_JsEmitter.firstTypeName_(definition_.typeArguments_));
|
|
2771
|
-
const methods_ = ff_core_List.List_map(
|
|
2772
|
-
return
|
|
2773
|
-
})
|
|
2771
|
+
const methods_ = ff_core_List.List_map(ff_core_List.List_map(definition_.methods_, ((_w1) => {
|
|
2772
|
+
return ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_, _w1, false, "")
|
|
2773
|
+
})), ((_w1) => {
|
|
2774
2774
|
return ff_core_String.String_dropFirst(_w1, ff_core_String.String_size("function "))
|
|
2775
2775
|
}));
|
|
2776
|
-
const asyncMethods_ =
|
|
2777
|
-
return ff_core_List.List_map(
|
|
2778
|
-
return
|
|
2779
|
-
})
|
|
2776
|
+
const asyncMethods_ = ff_compiler_JsEmitter.JsEmitter_withEmittingAsync(self_, (() => {
|
|
2777
|
+
return ff_core_List.List_map(ff_core_List.List_map(definition_.methods_, ((_w1) => {
|
|
2778
|
+
return ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_, _w1, true, "")
|
|
2779
|
+
})), ((_w1) => {
|
|
2780
2780
|
return ("async " + ff_core_String.String_dropFirst(_w1, ff_core_String.String_size("async function ")))
|
|
2781
2781
|
}))
|
|
2782
|
-
})
|
|
2782
|
+
}));
|
|
2783
2783
|
const body_ = (("{\n" + ff_core_List.List_join([...methods_, ...asyncMethods_], ",\n")) + "\n}");
|
|
2784
2784
|
{
|
|
2785
2785
|
const _1 = definition_.constraints_;
|
|
@@ -2797,7 +2797,7 @@ return (((((("export function " + name_) + "(") + ff_core_List.List_join(diction
|
|
|
2797
2797
|
}
|
|
2798
2798
|
|
|
2799
2799
|
export async function JsEmitter_emitFunctionDefinition$(self_, definition_, async_, suffix_ = "", $task) {
|
|
2800
|
-
const signature_ =
|
|
2800
|
+
const signature_ = ff_compiler_JsEmitter.JsEmitter_emitSignature(self_, definition_.signature_, async_, suffix_);
|
|
2801
2801
|
{
|
|
2802
2802
|
const _1 = ff_core_Pair.Pair(async_, definition_.body_);
|
|
2803
2803
|
if(!_1.first_ && _1.second_.ForeignTarget && _1.second_.syncCode_.None) {
|
|
@@ -2829,9 +2829,9 @@ return true
|
|
|
2829
2829
|
return false
|
|
2830
2830
|
}
|
|
2831
2831
|
}))) {
|
|
2832
|
-
const body_ =
|
|
2833
|
-
return
|
|
2834
|
-
})
|
|
2832
|
+
const body_ = ff_compiler_JsEmitter.JsEmitter_emitTailCall(self_, (() => {
|
|
2833
|
+
return ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, matchCase_.body_, true, async_)
|
|
2834
|
+
}));
|
|
2835
2835
|
return (((signature_ + " {\n") + body_) + "\n}")
|
|
2836
2836
|
}
|
|
2837
2837
|
}
|
|
@@ -2845,12 +2845,12 @@ return (_w1.name_ + "_a")
|
|
|
2845
2845
|
const shadowingWorkaround_ = ff_core_List.List_join(ff_core_List.List_map(definition_.signature_.parameters_, ((p_) => {
|
|
2846
2846
|
return (((("const " + p_.name_) + "_a = ") + ff_compiler_JsEmitter.escapeKeyword_(p_.name_)) + ";")
|
|
2847
2847
|
})), "\n");
|
|
2848
|
-
const body_ =
|
|
2849
|
-
const casesString_ = ff_core_List.List_join(
|
|
2850
|
-
return
|
|
2851
|
-
})
|
|
2848
|
+
const body_ = ff_compiler_JsEmitter.JsEmitter_emitTailCall(self_, (() => {
|
|
2849
|
+
const casesString_ = ff_core_List.List_join(ff_core_List.List_map(cases_, ((_w1) => {
|
|
2850
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, escapedArguments_, _w1, [], [], true, true, async_)
|
|
2851
|
+
})), "\n");
|
|
2852
2852
|
return ((shadowingWorkaround_ + "\n") + casesString_)
|
|
2853
|
-
})
|
|
2853
|
+
}));
|
|
2854
2854
|
return (((signature_ + " {\n") + body_) + "\n}")
|
|
2855
2855
|
}
|
|
2856
2856
|
}
|
|
@@ -2873,9 +2873,9 @@ return result_
|
|
|
2873
2873
|
}
|
|
2874
2874
|
|
|
2875
2875
|
export async function JsEmitter_emitSignature$(self_, signature_, async_, suffix_ = "", $task) {
|
|
2876
|
-
const parameterStrings_ =
|
|
2877
|
-
return
|
|
2878
|
-
})
|
|
2876
|
+
const parameterStrings_ = ff_core_List.List_map(signature_.parameters_, ((_w1) => {
|
|
2877
|
+
return ff_compiler_JsEmitter.JsEmitter_emitParameter(self_, _w1, async_)
|
|
2878
|
+
}));
|
|
2879
2879
|
const dictionaryStrings_ = ff_core_List.List_map(signature_.constraints_, ((c_) => {
|
|
2880
2880
|
return ff_compiler_JsEmitter.makeDictionaryName_(c_.name_, ff_compiler_JsEmitter.firstTypeName_(c_.generics_))
|
|
2881
2881
|
}));
|
|
@@ -2893,9 +2893,9 @@ return (((((prefix_ + "function ") + ff_compiler_JsEmitter.escapeKeyword_(signat
|
|
|
2893
2893
|
}
|
|
2894
2894
|
|
|
2895
2895
|
export async function JsEmitter_emitParameter$(self_, parameter_, async_, $task) {
|
|
2896
|
-
const defaultValue_ = ff_core_Option.Option_else(
|
|
2897
|
-
return (" = " +
|
|
2898
|
-
})
|
|
2896
|
+
const defaultValue_ = ff_core_Option.Option_else(ff_core_Option.Option_map(parameter_.default_, ((_w1) => {
|
|
2897
|
+
return (" = " + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, _w1, async_))
|
|
2898
|
+
})), (() => {
|
|
2899
2899
|
return ""
|
|
2900
2900
|
}));
|
|
2901
2901
|
return (ff_compiler_JsEmitter.escapeKeyword_(parameter_.name_) + defaultValue_)
|
|
@@ -2905,9 +2905,9 @@ export async function JsEmitter_emitTypeDefinition$(self_, definition_, $task) {
|
|
|
2905
2905
|
if(definition_.newtype_) {
|
|
2906
2906
|
return ("// newtype " + definition_.name_)
|
|
2907
2907
|
} else {
|
|
2908
|
-
return ((("// type " + definition_.name_) + "\n") + ff_core_List.List_join(
|
|
2909
|
-
return
|
|
2910
|
-
})
|
|
2908
|
+
return ((("// type " + definition_.name_) + "\n") + ff_core_List.List_join(ff_core_List.List_map(definition_.variants_, ((_w1) => {
|
|
2909
|
+
return ff_compiler_JsEmitter.JsEmitter_emitVariantDefinition(self_, definition_, _w1)
|
|
2910
|
+
})), "\n"))
|
|
2911
2911
|
}
|
|
2912
2912
|
}
|
|
2913
2913
|
|
|
@@ -2963,7 +2963,7 @@ return ff_compiler_JsEmitter.escapeResolved_(name_)
|
|
|
2963
2963
|
if(_1.EList) {
|
|
2964
2964
|
const at_ = _1.at_;
|
|
2965
2965
|
const items_ = _1.items_;
|
|
2966
|
-
return
|
|
2966
|
+
return ff_compiler_JsEmitter.JsEmitter_emitList(self_, items_, async_)
|
|
2967
2967
|
}
|
|
2968
2968
|
if(_1.EVariant && _1.name_ === "ff:core/Bool.False") {
|
|
2969
2969
|
const at_ = _1.at_;
|
|
@@ -2981,10 +2981,10 @@ if(_1.EVariant) {
|
|
|
2981
2981
|
const at_ = _1.at_;
|
|
2982
2982
|
const name_ = _1.name_;
|
|
2983
2983
|
const arguments_ = _1.arguments_;
|
|
2984
|
-
const argumentsString_ = ff_core_List.List_join(
|
|
2985
|
-
return
|
|
2986
|
-
})
|
|
2987
|
-
const newtype_ =
|
|
2984
|
+
const argumentsString_ = ff_core_List.List_join(ff_core_List.List_map(ff_core_List.List_flatten(ff_core_Option.Option_toList(arguments_)), ((_w1) => {
|
|
2985
|
+
return ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, _w1, async_)
|
|
2986
|
+
})), ", ");
|
|
2987
|
+
const newtype_ = ff_compiler_JsEmitter.JsEmitter_processVariant(self_, name_);
|
|
2988
2988
|
if(newtype_) {
|
|
2989
2989
|
return argumentsString_
|
|
2990
2990
|
} else {
|
|
@@ -3017,10 +3017,10 @@ const at_ = _1.at_;
|
|
|
3017
3017
|
const name_ = _1.name_;
|
|
3018
3018
|
const record_ = _1.record_;
|
|
3019
3019
|
const fields_ = _1.arguments_;
|
|
3020
|
-
const fieldCode_ = ff_core_List.List_join(
|
|
3021
|
-
return ((ff_compiler_JsEmitter.escapeKeyword_(f_.name_) + " = ") +
|
|
3022
|
-
})
|
|
3023
|
-
return (((("{..." +
|
|
3020
|
+
const fieldCode_ = ff_core_List.List_join(ff_core_List.List_map(fields_, ((f_) => {
|
|
3021
|
+
return ((ff_compiler_JsEmitter.escapeKeyword_(f_.name_) + " = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, f_.value_, async_))
|
|
3022
|
+
})), ", ");
|
|
3023
|
+
return (((("{..." + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, record_, async_)) + ", ") + fieldCode_) + "}")
|
|
3024
3024
|
}
|
|
3025
3025
|
if(_1.EField) {
|
|
3026
3026
|
const at_ = _1.at_;
|
|
@@ -3028,9 +3028,9 @@ const newtype_ = _1.newtype_;
|
|
|
3028
3028
|
const record_ = _1.record_;
|
|
3029
3029
|
const field_ = _1.field_;
|
|
3030
3030
|
if(newtype_) {
|
|
3031
|
-
return
|
|
3031
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, record_, async_)
|
|
3032
3032
|
} else {
|
|
3033
|
-
return ((
|
|
3033
|
+
return ((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, record_, async_) + ".") + ff_compiler_JsEmitter.escapeKeyword_(field_))
|
|
3034
3034
|
}
|
|
3035
3035
|
return
|
|
3036
3036
|
}
|
|
@@ -3069,7 +3069,7 @@ const parameters_ = ff_core_List.List_join([...patternParameters_, ...controller
|
|
|
3069
3069
|
const prefix_ = (newAsync_
|
|
3070
3070
|
? "async "
|
|
3071
3071
|
: "");
|
|
3072
|
-
return (((((("(" + prefix_) + "(") + parameters_) + ") => {\n") +
|
|
3072
|
+
return (((((("(" + prefix_) + "(") + parameters_) + ") => {\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, true, newAsync_)) + "\n})")
|
|
3073
3073
|
}
|
|
3074
3074
|
}
|
|
3075
3075
|
if(_1.ELambda) {
|
|
@@ -3087,9 +3087,9 @@ return ("_" + (_w1.first_ + 1))
|
|
|
3087
3087
|
const escapedArguments_ = ff_core_List.List_map(arguments_, ((word_) => {
|
|
3088
3088
|
return ff_compiler_JsEmitter.escapeKeyword_(word_)
|
|
3089
3089
|
}));
|
|
3090
|
-
const caseStrings_ =
|
|
3091
|
-
return
|
|
3092
|
-
})
|
|
3090
|
+
const caseStrings_ = ff_core_List.List_map(cases_, ((_w1) => {
|
|
3091
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, escapedArguments_, _w1, [], [], true, true, newAsync_)
|
|
3092
|
+
}));
|
|
3093
3093
|
const prefix_ = (newAsync_
|
|
3094
3094
|
? "async "
|
|
3095
3095
|
: "");
|
|
@@ -3104,7 +3104,7 @@ const await_ = (async_ && ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
|
|
|
3104
3104
|
const c_ = (await_
|
|
3105
3105
|
? ", $task"
|
|
3106
3106
|
: "");
|
|
3107
|
-
const call_ = ((((("(" +
|
|
3107
|
+
const call_ = ((((("(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, function_, async_)) + ")(") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, value_, async_)) + c_) + ")");
|
|
3108
3108
|
if(await_) {
|
|
3109
3109
|
return (("(await " + call_) + ")")
|
|
3110
3110
|
} else {
|
|
@@ -3117,9 +3117,9 @@ const at_ = _1.at_;
|
|
|
3117
3117
|
const name_ = _1.target_.name_;
|
|
3118
3118
|
const arguments_ = _1.arguments_;
|
|
3119
3119
|
const dictionaries_ = _1.dictionaries_;
|
|
3120
|
-
const _guard1 =
|
|
3120
|
+
const _guard1 = ff_compiler_JsEmitter.JsEmitter_emitSpecialCall(self_, term_, async_, name_, ff_core_List.List_map(arguments_, ((_w1) => {
|
|
3121
3121
|
return _w1.value_
|
|
3122
|
-
})), dictionaries_
|
|
3122
|
+
})), dictionaries_);
|
|
3123
3123
|
if(_guard1.Some) {
|
|
3124
3124
|
const code_ = _guard1.value_;
|
|
3125
3125
|
return code_
|
|
@@ -3133,9 +3133,9 @@ const typeArguments_ = _1.typeArguments_;
|
|
|
3133
3133
|
const arguments_ = _1.arguments_;
|
|
3134
3134
|
const dictionaries_ = _1.dictionaries_;
|
|
3135
3135
|
const await_ = (async_ && ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
|
|
3136
|
-
const dictionaryStrings_ =
|
|
3137
|
-
return
|
|
3138
|
-
})
|
|
3136
|
+
const dictionaryStrings_ = ff_core_List.List_map(dictionaries_, ((_w1) => {
|
|
3137
|
+
return ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, _w1)
|
|
3138
|
+
}));
|
|
3139
3139
|
const ds_ = ff_core_List.List_dropFirst(dictionaryStrings_, 1);
|
|
3140
3140
|
const d_ = ff_core_List.List_grabFirst(dictionaryStrings_);
|
|
3141
3141
|
const asyncSuffix_ = (await_
|
|
@@ -3144,9 +3144,9 @@ const asyncSuffix_ = (await_
|
|
|
3144
3144
|
const n_ = (ff_compiler_JsEmitter.escapeKeyword_(ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(name_), ((_w1) => {
|
|
3145
3145
|
return (_w1 !== 46)
|
|
3146
3146
|
})))) + asyncSuffix_);
|
|
3147
|
-
const emittedArguments_ =
|
|
3148
|
-
return
|
|
3149
|
-
})
|
|
3147
|
+
const emittedArguments_ = ff_core_List.List_map(arguments_, ((_w1) => {
|
|
3148
|
+
return ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, _w1, async_)
|
|
3149
|
+
}));
|
|
3150
3150
|
const controller_ = (await_
|
|
3151
3151
|
? ["$task"]
|
|
3152
3152
|
: []);
|
|
@@ -3177,15 +3177,15 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.G
|
|
|
3177
3177
|
const _1 = ff_compiler_JsEmitter.detectIfElse_(term_);
|
|
3178
3178
|
if(_1.length === 0) {
|
|
3179
3179
|
const await_ = (async_ && ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
|
|
3180
|
-
const ds_ =
|
|
3181
|
-
return
|
|
3182
|
-
})
|
|
3180
|
+
const ds_ = ff_core_List.List_map(dictionaries_, ((_w1) => {
|
|
3181
|
+
return ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, _w1)
|
|
3182
|
+
}));
|
|
3183
3183
|
const functionCode_ = (ff_compiler_JsEmitter.escapeResolved_(name_) + (await_
|
|
3184
3184
|
? "$"
|
|
3185
3185
|
: ""));
|
|
3186
|
-
const emittedArguments_ =
|
|
3187
|
-
return
|
|
3188
|
-
})
|
|
3186
|
+
const emittedArguments_ = ff_core_List.List_map(arguments_, ((_w1) => {
|
|
3187
|
+
return ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, _w1, async_)
|
|
3188
|
+
}));
|
|
3189
3189
|
const controller_ = (await_
|
|
3190
3190
|
? ["$task"]
|
|
3191
3191
|
: []);
|
|
@@ -3200,26 +3200,26 @@ return
|
|
|
3200
3200
|
if(_1.length >= 1 && _1[0].first_.EVariant && _1[0].first_.name_ === "ff:core/Bool.True") {
|
|
3201
3201
|
const elseBody_ = _1[0].second_;
|
|
3202
3202
|
const list_ = _1.slice(1);
|
|
3203
|
-
return (("(" +
|
|
3203
|
+
return (("(" + ff_core_List.List_foldLeft(list_, ff_compiler_JsEmitter.JsEmitter_emitComma(self_, elseBody_, async_), ((_1, _2) => {
|
|
3204
3204
|
{
|
|
3205
3205
|
const otherwise_ = _1;
|
|
3206
3206
|
const condition_ = _2.first_;
|
|
3207
3207
|
const body_ = _2.second_;
|
|
3208
|
-
return ((((
|
|
3208
|
+
return ((((ff_compiler_JsEmitter.JsEmitter_emitComma(self_, condition_, async_) + "\n? ") + ff_compiler_JsEmitter.JsEmitter_emitComma(self_, body_, async_)) + "\n: ") + otherwise_)
|
|
3209
3209
|
}
|
|
3210
|
-
})
|
|
3210
|
+
}))) + ")")
|
|
3211
3211
|
return
|
|
3212
3212
|
}
|
|
3213
3213
|
{
|
|
3214
3214
|
const list_ = _1;
|
|
3215
|
-
return (("(" +
|
|
3215
|
+
return (("(" + ff_core_List.List_foldLeft(list_, "ff_core_Option.None()", ((_1, _2) => {
|
|
3216
3216
|
{
|
|
3217
3217
|
const otherwise_ = _1;
|
|
3218
3218
|
const condition_ = _2.first_;
|
|
3219
3219
|
const body_ = _2.second_;
|
|
3220
|
-
return ((((
|
|
3220
|
+
return ((((ff_compiler_JsEmitter.JsEmitter_emitComma(self_, condition_, async_) + "\n? ff_core_Option.Some(") + ff_compiler_JsEmitter.JsEmitter_emitComma(self_, body_, async_)) + ")\n: ") + otherwise_)
|
|
3221
3221
|
}
|
|
3222
|
-
})
|
|
3222
|
+
}))) + ")")
|
|
3223
3223
|
return
|
|
3224
3224
|
}
|
|
3225
3225
|
}
|
|
@@ -3236,10 +3236,10 @@ const await_ = (async_ && ff_compiler_JsEmitter.effectTypeIsAsync_(effect_));
|
|
|
3236
3236
|
if((!ff_core_List.List_isEmpty(dictionaries_))) {
|
|
3237
3237
|
ff_compiler_JsEmitter.fail_(at_, "Internal error: Dictionaries in lambda call")
|
|
3238
3238
|
};
|
|
3239
|
-
const functionCode_ =
|
|
3240
|
-
const emittedArguments_ =
|
|
3241
|
-
return
|
|
3242
|
-
})
|
|
3239
|
+
const functionCode_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, function_, async_);
|
|
3240
|
+
const emittedArguments_ = ff_core_List.List_map(arguments_, ((_w1) => {
|
|
3241
|
+
return ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, at_, _w1, async_)
|
|
3242
|
+
}));
|
|
3243
3243
|
const controller_ = (await_
|
|
3244
3244
|
? ["$task"]
|
|
3245
3245
|
: []);
|
|
@@ -3257,9 +3257,9 @@ const fields_ = _1.fields_;
|
|
|
3257
3257
|
if(ff_core_List.List_isEmpty(fields_)) {
|
|
3258
3258
|
return "{}"
|
|
3259
3259
|
} else {
|
|
3260
|
-
const list_ =
|
|
3261
|
-
return ((ff_compiler_JsEmitter.escapeKeyword_(f_.name_) + ": ") +
|
|
3262
|
-
})
|
|
3260
|
+
const list_ = ff_core_List.List_map(fields_, ((f_) => {
|
|
3261
|
+
return ((ff_compiler_JsEmitter.escapeKeyword_(f_.name_) + ": ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, f_.value_, async_))
|
|
3262
|
+
}));
|
|
3263
3263
|
return (("{\n" + ff_core_List.List_join(list_, ",\n")) + "\n}")
|
|
3264
3264
|
}
|
|
3265
3265
|
return
|
|
@@ -3273,10 +3273,10 @@ ff_compiler_JsEmitter.fail_(at_, "Unbound wildcard")
|
|
|
3273
3273
|
return ("_w" + index_)
|
|
3274
3274
|
}
|
|
3275
3275
|
if(async_) {
|
|
3276
|
-
return (("(await (async function() {\n" +
|
|
3276
|
+
return (("(await (async function() {\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, term_, true, async_)) + "\n})())")
|
|
3277
3277
|
}
|
|
3278
3278
|
{
|
|
3279
|
-
return (("(function() {\n" +
|
|
3279
|
+
return (("(function() {\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, term_, true, async_)) + "\n})()")
|
|
3280
3280
|
}
|
|
3281
3281
|
}
|
|
3282
3282
|
}
|
|
@@ -3293,7 +3293,7 @@ return (dot_ + s_)
|
|
|
3293
3293
|
}
|
|
3294
3294
|
}
|
|
3295
3295
|
{
|
|
3296
|
-
return (("[" +
|
|
3296
|
+
return (("[" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, term_, async_)) + "]")
|
|
3297
3297
|
}
|
|
3298
3298
|
}
|
|
3299
3299
|
}
|
|
@@ -3306,9 +3306,9 @@ const c_ = (m_ + ff_compiler_JsEmitter.makeDictionaryName_(d_.traitName_, d_.typ
|
|
|
3306
3306
|
if(ff_core_List.List_isEmpty(d_.dictionaries_)) {
|
|
3307
3307
|
return c_
|
|
3308
3308
|
} else {
|
|
3309
|
-
return (((c_ + "(") + ff_core_List.List_join(
|
|
3310
|
-
return
|
|
3311
|
-
})
|
|
3309
|
+
return (((c_ + "(") + ff_core_List.List_join(ff_core_List.List_map(d_.dictionaries_, ((_w1) => {
|
|
3310
|
+
return ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, _w1)
|
|
3311
|
+
})), ", ")) + ")")
|
|
3312
3312
|
}
|
|
3313
3313
|
}
|
|
3314
3314
|
|
|
@@ -3319,11 +3319,11 @@ if(_1.EFunctions) {
|
|
|
3319
3319
|
const at_ = _1.at_;
|
|
3320
3320
|
const functions_ = _1.functions_;
|
|
3321
3321
|
const body_ = _1.body_;
|
|
3322
|
-
const functionStrings_ =
|
|
3322
|
+
const functionStrings_ = ff_core_List.List_map(functions_, ((f_) => {
|
|
3323
3323
|
const newAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(f_.signature_.effect_));
|
|
3324
|
-
return
|
|
3325
|
-
})
|
|
3326
|
-
return ((ff_core_List.List_join(functionStrings_, "\n") + "\n") +
|
|
3324
|
+
return ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_, f_, newAsync_, "")
|
|
3325
|
+
}));
|
|
3326
|
+
return ((ff_core_List.List_join(functionStrings_, "\n") + "\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, last_, async_))
|
|
3327
3327
|
}
|
|
3328
3328
|
if(_1.ELet) {
|
|
3329
3329
|
const at_ = _1.at_;
|
|
@@ -3332,7 +3332,7 @@ const name_ = _1.name_;
|
|
|
3332
3332
|
const valueType_ = _1.valueType_;
|
|
3333
3333
|
const value_ = _1.value_;
|
|
3334
3334
|
const body_ = _1.body_;
|
|
3335
|
-
return ((
|
|
3335
|
+
return ((ff_compiler_JsEmitter.JsEmitter_emitLetDefinition(self_, ff_compiler_Syntax.DLet(at_, name_, valueType_, value_), mutable_, async_) + "\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, last_, async_))
|
|
3336
3336
|
}
|
|
3337
3337
|
if(_1.EVariant && _1.name_ === "ff:core/Unit.Unit") {
|
|
3338
3338
|
const at_ = _1.at_;
|
|
@@ -3340,24 +3340,24 @@ return ""
|
|
|
3340
3340
|
}
|
|
3341
3341
|
if(_1.ESequential && _1.before_.EVariant && _1.before_.name_ === "ff:core/Unit.Unit") {
|
|
3342
3342
|
const after_ = _1.after_;
|
|
3343
|
-
return
|
|
3343
|
+
return ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, after_, last_, async_)
|
|
3344
3344
|
}
|
|
3345
3345
|
if(_1.ESequential && _1.after_.EVariant && _1.after_.name_ === "ff:core/Unit.Unit") {
|
|
3346
3346
|
const before_ = _1.before_;
|
|
3347
|
-
return
|
|
3347
|
+
return ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, before_, false, async_)
|
|
3348
3348
|
}
|
|
3349
3349
|
if(_1.ESequential) {
|
|
3350
3350
|
const at_ = _1.at_;
|
|
3351
3351
|
const before_ = _1.before_;
|
|
3352
3352
|
const after_ = _1.after_;
|
|
3353
|
-
return ((
|
|
3353
|
+
return ((ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, before_, false, async_) + ";\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, after_, last_, async_))
|
|
3354
3354
|
}
|
|
3355
3355
|
if(_1.EAssign) {
|
|
3356
3356
|
const at_ = _1.at_;
|
|
3357
3357
|
const operator_ = _1.operator_;
|
|
3358
3358
|
const name_ = _1.variable_;
|
|
3359
3359
|
const value_ = _1.value_;
|
|
3360
|
-
return ((((ff_compiler_JsEmitter.escapeKeyword_(name_) + " ") + operator_) + "= ") +
|
|
3360
|
+
return ((((ff_compiler_JsEmitter.escapeKeyword_(name_) + " ") + operator_) + "= ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, value_, async_))
|
|
3361
3361
|
}
|
|
3362
3362
|
if(_1.EAssignField) {
|
|
3363
3363
|
const at_ = _1.at_;
|
|
@@ -3365,7 +3365,7 @@ const operator_ = _1.operator_;
|
|
|
3365
3365
|
const record_ = _1.record_;
|
|
3366
3366
|
const field_ = _1.field_;
|
|
3367
3367
|
const value_ = _1.value_;
|
|
3368
|
-
return ((((((
|
|
3368
|
+
return ((((((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, record_, async_) + ".") + ff_compiler_JsEmitter.escapeKeyword_(field_)) + " ") + operator_) + "= ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, value_, async_))
|
|
3369
3369
|
}
|
|
3370
3370
|
if(_1.ECall && _1.target_.StaticCall && _1.target_.tailCall_) {
|
|
3371
3371
|
const at_ = _1.at_;
|
|
@@ -3377,9 +3377,9 @@ if(instanceCall_) {
|
|
|
3377
3377
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "Not yet implemented: Tail calls on trait methods."), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
3378
3378
|
};
|
|
3379
3379
|
self_.tailCallUsed_ = true;
|
|
3380
|
-
const pair_ = ff_core_List.List_unzip(ff_core_List.List_collect(
|
|
3381
|
-
return ff_core_Option.Some(ff_core_Pair.Pair((((("const " + ff_compiler_JsEmitter.escapeKeyword_((ff_core_Option.Option_grab(a_.name_) + "_r"))) + " = ") +
|
|
3382
|
-
})
|
|
3380
|
+
const pair_ = ff_core_List.List_unzip(ff_core_List.List_collect(ff_core_List.List_map(arguments_, ((a_) => {
|
|
3381
|
+
return ff_core_Option.Some(ff_core_Pair.Pair((((("const " + ff_compiler_JsEmitter.escapeKeyword_((ff_core_Option.Option_grab(a_.name_) + "_r"))) + " = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a_.value_, async_)) + ";"), ((ff_compiler_JsEmitter.escapeKeyword_(ff_core_Option.Option_grab(a_.name_)) + " = ") + ff_compiler_JsEmitter.escapeKeyword_((ff_core_Option.Option_grab(a_.name_) + "_r")))))
|
|
3382
|
+
})), ((_w1) => {
|
|
3383
3383
|
return _w1
|
|
3384
3384
|
})));
|
|
3385
3385
|
return (((("{\n" + ff_core_List.List_join(pair_.first_, "\n")) + "\n") + ff_core_List.List_join(pair_.second_, "\n")) + "\ncontinue _tailcall\n}")
|
|
@@ -3389,9 +3389,9 @@ const at_ = _1.at_;
|
|
|
3389
3389
|
const name_ = _1.target_.name_;
|
|
3390
3390
|
const arguments_ = _1.arguments_;
|
|
3391
3391
|
const dictionaries_ = _1.dictionaries_;
|
|
3392
|
-
const _guard1 =
|
|
3392
|
+
const _guard1 = ff_compiler_JsEmitter.JsEmitter_emitSpecialStatement(self_, term_, last_, async_, name_, ff_core_List.List_map(arguments_, ((_w1) => {
|
|
3393
3393
|
return _w1.value_
|
|
3394
|
-
})), dictionaries_
|
|
3394
|
+
})), dictionaries_);
|
|
3395
3395
|
if(_guard1.Some) {
|
|
3396
3396
|
const code_ = _guard1.value_;
|
|
3397
3397
|
return code_
|
|
@@ -3404,9 +3404,9 @@ const cases_ = _1.function_.lambda_.cases_;
|
|
|
3404
3404
|
ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
|
|
3405
3405
|
return ((((((((!last_)
|
|
3406
3406
|
? "do "
|
|
3407
|
-
: "") + "{\nconst _1 = ") +
|
|
3408
|
-
return
|
|
3409
|
-
})
|
|
3407
|
+
: "") + "{\nconst _1 = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, value_, async_)) + ";\n") + ff_core_List.List_join(ff_core_List.List_map(cases_, ((_w1) => {
|
|
3408
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, ["_1"], _w1, [], [], true, last_, async_)
|
|
3409
|
+
})), "\n")) + "\n}") + ((!last_)
|
|
3410
3410
|
? " while(false)"
|
|
3411
3411
|
: ""))
|
|
3412
3412
|
return
|
|
@@ -3416,50 +3416,50 @@ return
|
|
|
3416
3416
|
const _1 = ff_compiler_JsEmitter.detectIfElse_(term_);
|
|
3417
3417
|
if(_1.length === 0) {
|
|
3418
3418
|
if(last_) {
|
|
3419
|
-
return ("return " +
|
|
3419
|
+
return ("return " + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, term_, async_))
|
|
3420
3420
|
} else {
|
|
3421
|
-
return
|
|
3421
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, term_, async_)
|
|
3422
3422
|
}
|
|
3423
3423
|
return
|
|
3424
3424
|
}
|
|
3425
3425
|
if(_1.length >= 1 && _1[0].first_.EVariant && _1[0].first_.name_ === "ff:core/Bool.True") {
|
|
3426
3426
|
const elseBody_ = _1[0].second_;
|
|
3427
3427
|
const list_ = _1.slice(1);
|
|
3428
|
-
const initial_ = (("{\n" +
|
|
3429
|
-
return
|
|
3428
|
+
const initial_ = (("{\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, elseBody_, last_, async_)) + "\n}");
|
|
3429
|
+
return ff_core_List.List_foldLeft(list_, initial_, ((_1, _2) => {
|
|
3430
3430
|
{
|
|
3431
3431
|
const otherwise_ = _1;
|
|
3432
3432
|
const condition_ = _2.first_;
|
|
3433
3433
|
const body_ = _2.second_;
|
|
3434
|
-
return ((((("if(" +
|
|
3434
|
+
return ((((("if(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, condition_, async_)) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, last_, async_)) + "\n} else ") + otherwise_)
|
|
3435
3435
|
}
|
|
3436
|
-
})
|
|
3436
|
+
}))
|
|
3437
3437
|
return
|
|
3438
3438
|
}
|
|
3439
3439
|
{
|
|
3440
3440
|
const list_ = _1;
|
|
3441
3441
|
if((!last_)) {
|
|
3442
|
-
return
|
|
3442
|
+
return ff_core_List.List_foldLeft(list_, "{}", ((_1, _2) => {
|
|
3443
3443
|
{
|
|
3444
3444
|
const otherwise_ = _1;
|
|
3445
3445
|
const condition_ = _2.first_;
|
|
3446
3446
|
const body_ = _2.second_;
|
|
3447
|
-
return ((((("if(" +
|
|
3447
|
+
return ((((("if(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, condition_, async_)) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, last_, async_)) + "\n} else ") + otherwise_)
|
|
3448
3448
|
}
|
|
3449
|
-
})
|
|
3449
|
+
}))
|
|
3450
3450
|
return
|
|
3451
3451
|
}
|
|
3452
3452
|
}
|
|
3453
3453
|
{
|
|
3454
3454
|
const list_ = _1;
|
|
3455
|
-
return
|
|
3455
|
+
return ff_core_List.List_foldLeft(list_, "return ff_core_Option.None()", ((_1, _2) => {
|
|
3456
3456
|
{
|
|
3457
3457
|
const otherwise_ = _1;
|
|
3458
3458
|
const condition_ = _2.first_;
|
|
3459
3459
|
const body_ = _2.second_;
|
|
3460
|
-
return (((((("if(" +
|
|
3460
|
+
return (((((("if(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, condition_, async_)) + ") {\n") + "return ff_core_Option.Some(") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, body_, async_)) + ")\n} else ") + otherwise_)
|
|
3461
3461
|
}
|
|
3462
|
-
})
|
|
3462
|
+
}))
|
|
3463
3463
|
return
|
|
3464
3464
|
}
|
|
3465
3465
|
}
|
|
@@ -3478,7 +3478,7 @@ if(_guard2) {
|
|
|
3478
3478
|
const _guard1 = arguments_;
|
|
3479
3479
|
if(_guard1.length === 1) {
|
|
3480
3480
|
const value_ = _guard1[0];
|
|
3481
|
-
return ff_core_Option.Some(((("(" + operator_) +
|
|
3481
|
+
return ff_core_Option.Some(((("(" + operator_) + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, value_, async_)) + ")"))
|
|
3482
3482
|
}
|
|
3483
3483
|
}
|
|
3484
3484
|
}
|
|
@@ -3490,7 +3490,7 @@ const _guard1 = arguments_;
|
|
|
3490
3490
|
if(_guard1.length === 2) {
|
|
3491
3491
|
const left_ = _guard1[0];
|
|
3492
3492
|
const right_ = _guard1[1];
|
|
3493
|
-
return ff_core_Option.Some((((((("(" +
|
|
3493
|
+
return ff_core_Option.Some((((((("(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, left_, async_)) + " ") + operator_) + " ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, right_, async_)) + ")"))
|
|
3494
3494
|
}
|
|
3495
3495
|
}
|
|
3496
3496
|
}
|
|
@@ -3500,8 +3500,8 @@ if(_guard2.length === 2) {
|
|
|
3500
3500
|
const e1_ = _guard2[0];
|
|
3501
3501
|
const e2_ = _guard2[1];
|
|
3502
3502
|
if((ff_compiler_JsEmitter.noSideEffects_(e1_) && ff_compiler_JsEmitter.noSideEffects_(e2_))) {
|
|
3503
|
-
const code1_ =
|
|
3504
|
-
const code2_ =
|
|
3503
|
+
const code1_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e1_, async_);
|
|
3504
|
+
const code2_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e2_, async_);
|
|
3505
3505
|
return ff_core_Option.Some(((((((((("(" + code1_) + "[") + code2_) + "] ?? ") + "ff_core_List.internalGrab_(") + code1_) + ", ") + code2_) + "))"))
|
|
3506
3506
|
}
|
|
3507
3507
|
}
|
|
@@ -3511,8 +3511,8 @@ const _guard1 = arguments_;
|
|
|
3511
3511
|
if(_guard1.length === 2) {
|
|
3512
3512
|
const e1_ = _guard1[0];
|
|
3513
3513
|
const e2_ = _guard1[1];
|
|
3514
|
-
const code1_ =
|
|
3515
|
-
const code2_ =
|
|
3514
|
+
const code1_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e1_, async_);
|
|
3515
|
+
const code2_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e2_, async_);
|
|
3516
3516
|
return ff_core_Option.Some(((((((((("(" + code1_) + ".array[") + code2_) + "] ?? ") + "ff_core_Array.internalGrab_(") + code1_) + ", ") + code2_) + "))"))
|
|
3517
3517
|
}
|
|
3518
3518
|
}
|
|
@@ -3520,14 +3520,14 @@ if(_1 === "ff:core/List.List_size") {
|
|
|
3520
3520
|
const _guard1 = arguments_;
|
|
3521
3521
|
if(_guard1.length === 1) {
|
|
3522
3522
|
const e_ = _guard1[0];
|
|
3523
|
-
return ff_core_Option.Some((
|
|
3523
|
+
return ff_core_Option.Some((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_) + ".length"))
|
|
3524
3524
|
}
|
|
3525
3525
|
}
|
|
3526
3526
|
if(_1 === "ff:core/Array.Array_size") {
|
|
3527
3527
|
const _guard1 = arguments_;
|
|
3528
3528
|
if(_guard1.length === 1) {
|
|
3529
3529
|
const e_ = _guard1[0];
|
|
3530
|
-
return ff_core_Option.Some((
|
|
3530
|
+
return ff_core_Option.Some((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_) + ".array.length"))
|
|
3531
3531
|
}
|
|
3532
3532
|
}
|
|
3533
3533
|
if(_1 === "ff:core/Equal.equals") {
|
|
@@ -3539,7 +3539,7 @@ const _guard2 = dictionaries_;
|
|
|
3539
3539
|
if(_guard2.length === 1 && _guard2[0].dictionaries_.length === 0) {
|
|
3540
3540
|
const typeName_ = _guard2[0].typeName_;
|
|
3541
3541
|
if((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"))) {
|
|
3542
|
-
return ff_core_Option.Some((((("(" +
|
|
3542
|
+
return ff_core_Option.Some((((("(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, left_, async_)) + " === ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, right_, async_)) + ")"))
|
|
3543
3543
|
}
|
|
3544
3544
|
}
|
|
3545
3545
|
}
|
|
@@ -3553,7 +3553,7 @@ const _guard2 = dictionaries_;
|
|
|
3553
3553
|
if(_guard2.length === 1 && _guard2[0].dictionaries_.length === 0) {
|
|
3554
3554
|
const typeName_ = _guard2[0].typeName_;
|
|
3555
3555
|
if((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"))) {
|
|
3556
|
-
return ff_core_Option.Some((((("(" +
|
|
3556
|
+
return ff_core_Option.Some((((("(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, left_, async_)) + " !== ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, right_, async_)) + ")"))
|
|
3557
3557
|
}
|
|
3558
3558
|
}
|
|
3559
3559
|
}
|
|
@@ -3567,7 +3567,7 @@ const _guard2 = dictionaries_;
|
|
|
3567
3567
|
if(_guard2.length === 1 && _guard2[0].dictionaries_.length === 0) {
|
|
3568
3568
|
const typeName_ = _guard2[0].typeName_;
|
|
3569
3569
|
if(ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
|
|
3570
|
-
return ff_core_Option.Some((((("(" +
|
|
3570
|
+
return ff_core_Option.Some((((("(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, left_, async_)) + " < ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, right_, async_)) + ")"))
|
|
3571
3571
|
}
|
|
3572
3572
|
}
|
|
3573
3573
|
}
|
|
@@ -3581,7 +3581,7 @@ const _guard2 = dictionaries_;
|
|
|
3581
3581
|
if(_guard2.length === 1 && _guard2[0].dictionaries_.length === 0) {
|
|
3582
3582
|
const typeName_ = _guard2[0].typeName_;
|
|
3583
3583
|
if(ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
|
|
3584
|
-
return ff_core_Option.Some((((("(" +
|
|
3584
|
+
return ff_core_Option.Some((((("(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, left_, async_)) + " >= ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, right_, async_)) + ")"))
|
|
3585
3585
|
}
|
|
3586
3586
|
}
|
|
3587
3587
|
}
|
|
@@ -3595,7 +3595,7 @@ const _guard2 = dictionaries_;
|
|
|
3595
3595
|
if(_guard2.length === 1 && _guard2[0].dictionaries_.length === 0) {
|
|
3596
3596
|
const typeName_ = _guard2[0].typeName_;
|
|
3597
3597
|
if(ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
|
|
3598
|
-
return ff_core_Option.Some((((("(" +
|
|
3598
|
+
return ff_core_Option.Some((((("(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, left_, async_)) + " > ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, right_, async_)) + ")"))
|
|
3599
3599
|
}
|
|
3600
3600
|
}
|
|
3601
3601
|
}
|
|
@@ -3609,7 +3609,7 @@ const _guard2 = dictionaries_;
|
|
|
3609
3609
|
if(_guard2.length === 1 && _guard2[0].dictionaries_.length === 0) {
|
|
3610
3610
|
const typeName_ = _guard2[0].typeName_;
|
|
3611
3611
|
if(ff_core_Set.Set_contains(ff_compiler_JsEmitter.primitiveTypes_, typeName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
|
|
3612
|
-
return ff_core_Option.Some((((("(" +
|
|
3612
|
+
return ff_core_Option.Some((((("(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, left_, async_)) + " <= ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, right_, async_)) + ")"))
|
|
3613
3613
|
}
|
|
3614
3614
|
}
|
|
3615
3615
|
}
|
|
@@ -3636,7 +3636,7 @@ const newAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsy
|
|
|
3636
3636
|
const await_ = (newAsync_
|
|
3637
3637
|
? "await "
|
|
3638
3638
|
: "");
|
|
3639
|
-
return ff_core_Option.Some(((((((((((((((((((await_ + "((() => {\n") + "const size = ") +
|
|
3639
|
+
return ff_core_Option.Some(((((((((((((((((((await_ + "((() => {\n") + "const size = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, size_, async_)) + ";\n") + "const result = [];\n") + "for(let ") + n_) + " = 0; ") + n_) + " < size; ") + n_) + "++) {\n") + "result.push(") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, body_, newAsync_)) + ");\n") + "}\n") + "return result;\n") + "})())"))
|
|
3640
3640
|
}
|
|
3641
3641
|
}
|
|
3642
3642
|
}
|
|
@@ -3653,9 +3653,9 @@ const _guard1 = arguments_;
|
|
|
3653
3653
|
if(_guard1.length === 1) {
|
|
3654
3654
|
const body_ = _guard1[0];
|
|
3655
3655
|
if(async_) {
|
|
3656
|
-
return ff_core_Option.Some((("(await " +
|
|
3656
|
+
return ff_core_Option.Some((("(await " + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, body_, async_)) + "($task))"))
|
|
3657
3657
|
} else {
|
|
3658
|
-
return ff_core_Option.Some(
|
|
3658
|
+
return ff_core_Option.Some(ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, ff_compiler_JsEmitter.invokeImmediately_(body_), async_))
|
|
3659
3659
|
}
|
|
3660
3660
|
return
|
|
3661
3661
|
}
|
|
@@ -3700,14 +3700,14 @@ if(_1 === "ff:core/UnsafeJs.value") {
|
|
|
3700
3700
|
const _guard1 = arguments_;
|
|
3701
3701
|
if(_guard1.length === 1) {
|
|
3702
3702
|
const e_ = _guard1[0];
|
|
3703
|
-
return ff_core_Option.Some(
|
|
3703
|
+
return ff_core_Option.Some(ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_))
|
|
3704
3704
|
}
|
|
3705
3705
|
}
|
|
3706
3706
|
if(_1 === "ff:core/UnsafeJs.fromValue") {
|
|
3707
3707
|
const _guard1 = arguments_;
|
|
3708
3708
|
if(_guard1.length === 1) {
|
|
3709
3709
|
const e_ = _guard1[0];
|
|
3710
|
-
return ff_core_Option.Some(
|
|
3710
|
+
return ff_core_Option.Some(ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_))
|
|
3711
3711
|
}
|
|
3712
3712
|
}
|
|
3713
3713
|
if(_1 === "ff:core/JsValue.JsValue_get") {
|
|
@@ -3715,7 +3715,7 @@ const _guard1 = arguments_;
|
|
|
3715
3715
|
if(_guard1.length === 2) {
|
|
3716
3716
|
const e1_ = _guard1[0];
|
|
3717
3717
|
const e2_ = _guard1[1];
|
|
3718
|
-
return ff_core_Option.Some((
|
|
3718
|
+
return ff_core_Option.Some((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e1_, async_) + ff_compiler_JsEmitter.JsEmitter_emitField(self_, e2_, async_, ".")))
|
|
3719
3719
|
}
|
|
3720
3720
|
}
|
|
3721
3721
|
{
|
|
@@ -3732,10 +3732,10 @@ if(_guard1.length >= 2) {
|
|
|
3732
3732
|
const e1_ = _guard1[0];
|
|
3733
3733
|
const e2_ = _guard1[1];
|
|
3734
3734
|
const es_ = _guard1.slice(2);
|
|
3735
|
-
const argumentCode_ = ff_core_List.List_join(
|
|
3736
|
-
return
|
|
3737
|
-
})
|
|
3738
|
-
return ff_core_Option.Some(((((
|
|
3735
|
+
const argumentCode_ = ff_core_List.List_join(ff_core_List.List_map(es_, ((_w1) => {
|
|
3736
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, _w1, async_)
|
|
3737
|
+
})), ", ");
|
|
3738
|
+
return ff_core_Option.Some(((((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e1_, async_) + ff_compiler_JsEmitter.JsEmitter_emitField(self_, e2_, async_, ".")) + "(") + argumentCode_) + ")"))
|
|
3739
3739
|
}
|
|
3740
3740
|
}
|
|
3741
3741
|
}
|
|
@@ -3753,10 +3753,10 @@ const _guard1 = arguments_;
|
|
|
3753
3753
|
if(_guard1.length >= 1) {
|
|
3754
3754
|
const e1_ = _guard1[0];
|
|
3755
3755
|
const es_ = _guard1.slice(1);
|
|
3756
|
-
const argumentCode_ = ff_core_List.List_join(
|
|
3757
|
-
return
|
|
3758
|
-
})
|
|
3759
|
-
return ff_core_Option.Some((((
|
|
3756
|
+
const argumentCode_ = ff_core_List.List_join(ff_core_List.List_map(es_, ((_w1) => {
|
|
3757
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, _w1, async_)
|
|
3758
|
+
})), ", ");
|
|
3759
|
+
return ff_core_Option.Some((((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e1_, async_) + "(") + argumentCode_) + ")"))
|
|
3760
3760
|
}
|
|
3761
3761
|
}
|
|
3762
3762
|
}
|
|
@@ -3774,44 +3774,44 @@ const _guard1 = arguments_;
|
|
|
3774
3774
|
if(_guard1.length >= 1) {
|
|
3775
3775
|
const e1_ = _guard1[0];
|
|
3776
3776
|
const es_ = _guard1.slice(1);
|
|
3777
|
-
const argumentCode_ = ff_core_List.List_join(
|
|
3778
|
-
return
|
|
3779
|
-
})
|
|
3780
|
-
return ff_core_Option.Some(((((("(new " +
|
|
3777
|
+
const argumentCode_ = ff_core_List.List_join(ff_core_List.List_map(es_, ((_w1) => {
|
|
3778
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, _w1, async_)
|
|
3779
|
+
})), ", ");
|
|
3780
|
+
return ff_core_Option.Some(((((("(new " + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e1_, async_)) + "(") + argumentCode_) + ")") + ")"))
|
|
3781
3781
|
}
|
|
3782
3782
|
}
|
|
3783
3783
|
}
|
|
3784
3784
|
}
|
|
3785
3785
|
if(_1 === "ff:core/JsValue.JsValue_with") {
|
|
3786
|
-
|
|
3786
|
+
function go_(e_, fields_) {
|
|
3787
3787
|
{
|
|
3788
3788
|
const _1 = e_;
|
|
3789
3789
|
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/JsValue.JsValue_with" && _1.arguments_.length === 3) {
|
|
3790
3790
|
const a1_ = _1.arguments_[0];
|
|
3791
3791
|
const a2_ = _1.arguments_[1];
|
|
3792
3792
|
const a3_ = _1.arguments_[2];
|
|
3793
|
-
return
|
|
3793
|
+
return go_(a1_.value_, [ff_core_Pair.Pair(a2_.value_, a3_.value_), ...fields_])
|
|
3794
3794
|
}
|
|
3795
3795
|
if(_1.ECall && _1.target_.StaticCall && _1.arguments_.length === 1) {
|
|
3796
3796
|
const name_ = _1.target_.name_;
|
|
3797
3797
|
const a_ = _1.arguments_[0];
|
|
3798
3798
|
const _guard2 = ((name_ === "ff:core/JsSystem.JsSystem_object") || (name_ === "ff:core/JsSystem.JsSystem_new0"));
|
|
3799
3799
|
if(_guard2 && ff_compiler_JsEmitter.noSideEffects_(a_.value_)) {
|
|
3800
|
-
return (("{" + ff_core_List.List_join(
|
|
3801
|
-
return ((
|
|
3802
|
-
})
|
|
3800
|
+
return (("{" + ff_core_List.List_join(ff_core_List.List_map(fields_, ((p_) => {
|
|
3801
|
+
return ((ff_compiler_JsEmitter.JsEmitter_emitField(self_, p_.first_, async_, "") + ": ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, p_.second_, async_))
|
|
3802
|
+
})), ", ")) + "}")
|
|
3803
3803
|
return
|
|
3804
3804
|
}
|
|
3805
3805
|
}
|
|
3806
3806
|
{
|
|
3807
|
-
return (((("{..." +
|
|
3808
|
-
return ((
|
|
3809
|
-
})
|
|
3807
|
+
return (((("{..." + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_)) + ", ") + ff_core_List.List_join(ff_core_List.List_map(fields_, ((p_) => {
|
|
3808
|
+
return ((ff_compiler_JsEmitter.JsEmitter_emitField(self_, p_.first_, async_, "") + ": ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, p_.second_, async_))
|
|
3809
|
+
})), ", ")) + "}")
|
|
3810
3810
|
return
|
|
3811
3811
|
}
|
|
3812
3812
|
}
|
|
3813
3813
|
}
|
|
3814
|
-
return ff_core_Option.Some(
|
|
3814
|
+
return ff_core_Option.Some(go_(term_, []))
|
|
3815
3815
|
}
|
|
3816
3816
|
{
|
|
3817
3817
|
const name_ = _1;
|
|
@@ -3829,12 +3829,12 @@ const e2_ = _guard2[1];
|
|
|
3829
3829
|
const q_ = _guard2[1].value_;
|
|
3830
3830
|
const es_ = _guard2.slice(2);
|
|
3831
3831
|
if(ff_compiler_JsEmitter.noSideEffects_(e1_)) {
|
|
3832
|
-
const argumentCode_ = ff_core_List.List_join(
|
|
3833
|
-
return
|
|
3834
|
-
})
|
|
3835
|
-
return ff_core_Option.Some((((
|
|
3836
|
-
return (("globalThis[" +
|
|
3837
|
-
})
|
|
3832
|
+
const argumentCode_ = ff_core_List.List_join(ff_core_List.List_map(es_, ((_w1) => {
|
|
3833
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, _w1, async_)
|
|
3834
|
+
})), ", ");
|
|
3835
|
+
return ff_core_Option.Some((((ff_core_Option.Option_else(ff_compiler_JsEmitter.safeBare_(q_), (() => {
|
|
3836
|
+
return (("globalThis[" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e2_, async_)) + "]")
|
|
3837
|
+
})) + "(") + argumentCode_) + ")"))
|
|
3838
3838
|
return
|
|
3839
3839
|
}
|
|
3840
3840
|
}
|
|
@@ -3860,7 +3860,7 @@ const _guard2 = term_;
|
|
|
3860
3860
|
if(_guard2.ECall) {
|
|
3861
3861
|
const call_ = _guard2;
|
|
3862
3862
|
if((!ff_compiler_JsEmitter.effectTypeIsAsync_(call_.effect_))) {
|
|
3863
|
-
return ff_core_Option.Some(
|
|
3863
|
+
return ff_core_Option.Some(ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e2_, async_))
|
|
3864
3864
|
}
|
|
3865
3865
|
}
|
|
3866
3866
|
}
|
|
@@ -3875,9 +3875,9 @@ const e1_ = _guard2[0];
|
|
|
3875
3875
|
const e2_ = _guard2[1];
|
|
3876
3876
|
const q_ = _guard2[1].value_;
|
|
3877
3877
|
if(ff_compiler_JsEmitter.noSideEffects_(e1_)) {
|
|
3878
|
-
return ff_core_Option.Some(
|
|
3879
|
-
return (("globalThis[" +
|
|
3880
|
-
})
|
|
3878
|
+
return ff_core_Option.Some(ff_core_Option.Option_else(ff_compiler_JsEmitter.safeBare_(q_), (() => {
|
|
3879
|
+
return (("globalThis[" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e2_, async_)) + "]")
|
|
3880
|
+
})))
|
|
3881
3881
|
return
|
|
3882
3882
|
}
|
|
3883
3883
|
}
|
|
@@ -3932,7 +3932,7 @@ const _guard1 = arguments_;
|
|
|
3932
3932
|
if(_guard1.length === 2) {
|
|
3933
3933
|
const condition_ = _guard1[0];
|
|
3934
3934
|
const body_ = _guard1[1];
|
|
3935
|
-
return ff_core_Option.Some((((("while(" +
|
|
3935
|
+
return ff_core_Option.Some((((("while(" + ff_compiler_JsEmitter.JsEmitter_emitComma(self_, ff_compiler_JsEmitter.invokeImmediately_(condition_), async_)) + ") {\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, ff_compiler_JsEmitter.invokeImmediately_(body_), false, async_)) + "\n}"))
|
|
3936
3936
|
}
|
|
3937
3937
|
}
|
|
3938
3938
|
if(_1 === "ff:core/Core.doWhile") {
|
|
@@ -3943,7 +3943,7 @@ const _guard1 = ff_compiler_JsEmitter.invokeImmediately_(doWhileBody_);
|
|
|
3943
3943
|
if(_guard1.ESequential) {
|
|
3944
3944
|
const body_ = _guard1.before_;
|
|
3945
3945
|
const condition_ = _guard1.after_;
|
|
3946
|
-
return ff_core_Option.Some(((((("while(true) {\n" +
|
|
3946
|
+
return ff_core_Option.Some(((((("while(true) {\n" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, false, async_)) + "\nif(!") + ff_compiler_JsEmitter.JsEmitter_emitComma(self_, condition_, async_)) + ") break") + "\n}"))
|
|
3947
3947
|
}
|
|
3948
3948
|
}
|
|
3949
3949
|
}
|
|
@@ -3954,7 +3954,7 @@ const doWhileBody_ = _guard2[0];
|
|
|
3954
3954
|
const _guard1 = ff_compiler_JsEmitter.invokeImmediately_(doWhileBody_);
|
|
3955
3955
|
{
|
|
3956
3956
|
const body_ = _guard1;
|
|
3957
|
-
return ff_core_Option.Some((("while(" +
|
|
3957
|
+
return ff_core_Option.Some((("while(" + ff_compiler_JsEmitter.JsEmitter_emitComma(self_, body_, async_)) + ") {}"))
|
|
3958
3958
|
}
|
|
3959
3959
|
}
|
|
3960
3960
|
}
|
|
@@ -3964,11 +3964,11 @@ if(_guard1.length === 2 && _guard1[1].ELambda && _guard1[1].lambda_.cases_.lengt
|
|
|
3964
3964
|
const list_ = _guard1[0];
|
|
3965
3965
|
const name_ = _guard1[1].lambda_.cases_[0].patterns_[0].name_;
|
|
3966
3966
|
const body_ = _guard1[1].lambda_.cases_[0].body_;
|
|
3967
|
-
return ff_core_Option.Some(((((("for(const for_o = " +
|
|
3967
|
+
return ff_core_Option.Some(((((("for(const 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) => {
|
|
3968
3968
|
return (("const " + ff_compiler_JsEmitter.escapeKeyword_(_w1)) + " = for_o.value_;\n")
|
|
3969
3969
|
})), (() => {
|
|
3970
3970
|
return ""
|
|
3971
|
-
}))) +
|
|
3971
|
+
}))) + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, last_, async_)) + "\nbreak\n}"))
|
|
3972
3972
|
return
|
|
3973
3973
|
}
|
|
3974
3974
|
}
|
|
@@ -3981,8 +3981,8 @@ const end_ = _guard2[0].arguments_[1];
|
|
|
3981
3981
|
const name_ = _guard2[1].lambda_.cases_[0].patterns_[0].name_;
|
|
3982
3982
|
const body_ = _guard2[1].lambda_.cases_[0].body_;
|
|
3983
3983
|
if(((r_ === "ff:core/Int.Int_until") || (r_ === "ff:core/Int.Int_to"))) {
|
|
3984
|
-
const startCode_ =
|
|
3985
|
-
const endCode_ =
|
|
3984
|
+
const startCode_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, start_.value_, async_);
|
|
3985
|
+
const endCode_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, end_.value_, async_);
|
|
3986
3986
|
const op_ = ((r_ === "ff:core/Int.Int_until")
|
|
3987
3987
|
? "<"
|
|
3988
3988
|
: "<=");
|
|
@@ -3990,7 +3990,7 @@ return ff_core_Option.Some((((((((((("for(let " + "for_i = ") + startCode_) + ",
|
|
|
3990
3990
|
return (("const " + ff_compiler_JsEmitter.escapeKeyword_(_w1)) + " = for_i;\n")
|
|
3991
3991
|
})), (() => {
|
|
3992
3992
|
return ""
|
|
3993
|
-
}))) +
|
|
3993
|
+
}))) + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, last_, async_)) + "\n}"))
|
|
3994
3994
|
return
|
|
3995
3995
|
}
|
|
3996
3996
|
}
|
|
@@ -4001,7 +4001,7 @@ if(_guard1.length === 2 && _guard1[1].ELambda && _guard1[1].lambda_.cases_.lengt
|
|
|
4001
4001
|
const list_ = _guard1[0];
|
|
4002
4002
|
const name_ = _guard1[1].lambda_.cases_[0].patterns_[0].name_;
|
|
4003
4003
|
const body_ = _guard1[1].lambda_.cases_[0].body_;
|
|
4004
|
-
const fusion_ =
|
|
4004
|
+
const fusion_ = ff_compiler_JsEmitter.JsEmitter_emitLightFusion(self_, list_, async_);
|
|
4005
4005
|
const start_ = fusion_.second_.first_;
|
|
4006
4006
|
const end_ = fusion_.second_.second_;
|
|
4007
4007
|
const listCode_ = fusion_.first_;
|
|
@@ -4009,7 +4009,7 @@ return ff_core_Option.Some(((((((((("for(let for_i = " + start_) + ", for_a = ")
|
|
|
4009
4009
|
return (("const " + ff_compiler_JsEmitter.escapeKeyword_(_w1)) + " = for_a[for_i];\n")
|
|
4010
4010
|
})), (() => {
|
|
4011
4011
|
return ""
|
|
4012
|
-
}))) +
|
|
4012
|
+
}))) + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, last_, async_)) + "\n}"))
|
|
4013
4013
|
return
|
|
4014
4014
|
}
|
|
4015
4015
|
}
|
|
@@ -4020,7 +4020,7 @@ const list_ = _guard1[0];
|
|
|
4020
4020
|
const name_ = _guard1[1].lambda_.cases_[0].patterns_[0].name_;
|
|
4021
4021
|
const body_ = _guard1[1].lambda_.cases_[0].body_.before_;
|
|
4022
4022
|
const condition_ = _guard1[1].lambda_.cases_[0].body_.after_;
|
|
4023
|
-
const fusion_ =
|
|
4023
|
+
const fusion_ = ff_compiler_JsEmitter.JsEmitter_emitLightFusion(self_, list_, async_);
|
|
4024
4024
|
const start_ = fusion_.second_.first_;
|
|
4025
4025
|
const end_ = fusion_.second_.second_;
|
|
4026
4026
|
const listCode_ = fusion_.first_;
|
|
@@ -4028,7 +4028,7 @@ return ff_core_Option.Some(((((((((((((("for(let for_i = " + start_) + ", for_a
|
|
|
4028
4028
|
return (("const " + ff_compiler_JsEmitter.escapeKeyword_(_w1)) + " = for_a[for_i];\n")
|
|
4029
4029
|
})), (() => {
|
|
4030
4030
|
return ""
|
|
4031
|
-
}))) +
|
|
4031
|
+
}))) + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, body_, last_, async_)) + ";\n") + "if(!") + ff_compiler_JsEmitter.JsEmitter_emitComma(self_, condition_, async_)) + ") break") + "\n}"))
|
|
4032
4032
|
return
|
|
4033
4033
|
}
|
|
4034
4034
|
}
|
|
@@ -4038,12 +4038,12 @@ if(_guard1.length === 2 && _guard1[1].ELambda && _guard1[1].lambda_.cases_.lengt
|
|
|
4038
4038
|
const list_ = _guard1[0];
|
|
4039
4039
|
const name_ = _guard1[1].lambda_.cases_[0].patterns_[0].name_;
|
|
4040
4040
|
const condition_ = _guard1[1].lambda_.cases_[0].body_;
|
|
4041
|
-
const listCode_ =
|
|
4041
|
+
const listCode_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, list_, async_);
|
|
4042
4042
|
return ff_core_Option.Some(((((((((("for(let " + "for_i = 0, for_a = ") + listCode_) + ", for_l = for_a.length") + "; for_i < for_l; for_i++) {\n") + ff_core_Option.Option_else(ff_core_Option.Option_map(name_, ((_w1) => {
|
|
4043
4043
|
return (("const " + ff_compiler_JsEmitter.escapeKeyword_(_w1)) + " = for_a[for_i];\n")
|
|
4044
4044
|
})), (() => {
|
|
4045
4045
|
return ""
|
|
4046
|
-
}))) + "if(!") +
|
|
4046
|
+
}))) + "if(!") + ff_compiler_JsEmitter.JsEmitter_emitComma(self_, condition_, async_)) + ") break") + "\n}"))
|
|
4047
4047
|
return
|
|
4048
4048
|
}
|
|
4049
4049
|
}
|
|
@@ -4052,7 +4052,7 @@ const _guard1 = arguments_;
|
|
|
4052
4052
|
if(_guard1.length === 2) {
|
|
4053
4053
|
const array_ = _guard1[0];
|
|
4054
4054
|
const value_ = _guard1[1];
|
|
4055
|
-
return ff_core_Option.Some((((
|
|
4055
|
+
return ff_core_Option.Some((((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, array_, async_) + ".array.push(") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, value_, async_)) + ")"))
|
|
4056
4056
|
}
|
|
4057
4057
|
}
|
|
4058
4058
|
if(_1 === "ff:core/Core.if") {
|
|
@@ -4060,9 +4060,9 @@ const _guard1 = arguments_;
|
|
|
4060
4060
|
if(_guard1.length === 2) {
|
|
4061
4061
|
const condition_ = _guard1[0];
|
|
4062
4062
|
const body_ = _guard1[1];
|
|
4063
|
-
return ff_core_Option.Some(((("if(" +
|
|
4064
|
-
? (("return ff_core_Option.Some(" +
|
|
4065
|
-
: (
|
|
4063
|
+
return ff_core_Option.Some(((("if(" + ff_compiler_JsEmitter.JsEmitter_emitComma(self_, condition_, async_)) + ") {\n") + (last_
|
|
4064
|
+
? (("return ff_core_Option.Some(" + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, ff_compiler_JsEmitter.invokeImmediately_(body_), async_)) + ")\n} else return ff_core_Option.None()")
|
|
4065
|
+
: (ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, ff_compiler_JsEmitter.invokeImmediately_(body_), false, async_) + "\n}"))))
|
|
4066
4066
|
return
|
|
4067
4067
|
}
|
|
4068
4068
|
}
|
|
@@ -4076,29 +4076,29 @@ const argument_ = _guard2[0];
|
|
|
4076
4076
|
const _guard1 = dictionaries_;
|
|
4077
4077
|
if(_guard1.length === 1) {
|
|
4078
4078
|
const dictionary_ = _guard1[0];
|
|
4079
|
-
const d_ =
|
|
4080
|
-
const a_ =
|
|
4079
|
+
const d_ = ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, dictionary_);
|
|
4080
|
+
const a_ = ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, term_.at_, argument_, async_);
|
|
4081
4081
|
return ff_core_Option.Some((((("throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(" + a_) + ", ") + d_) + ")})"))
|
|
4082
4082
|
}
|
|
4083
4083
|
}
|
|
4084
4084
|
}
|
|
4085
4085
|
}
|
|
4086
4086
|
if(_1 === "ff:core/Try.Try_catch") {
|
|
4087
|
-
const _guard1 =
|
|
4087
|
+
const _guard1 = ff_compiler_JsEmitter.JsEmitter_emitTryCatchFinally(self_, term_, last_, async_);
|
|
4088
4088
|
if(_guard1.Some) {
|
|
4089
4089
|
const code_ = _guard1.value_;
|
|
4090
4090
|
return ff_core_Option.Some(code_)
|
|
4091
4091
|
}
|
|
4092
4092
|
}
|
|
4093
4093
|
if(_1 === "ff:core/Try.Try_catchAny") {
|
|
4094
|
-
const _guard1 =
|
|
4094
|
+
const _guard1 = ff_compiler_JsEmitter.JsEmitter_emitTryCatchFinally(self_, term_, last_, async_);
|
|
4095
4095
|
if(_guard1.Some) {
|
|
4096
4096
|
const code_ = _guard1.value_;
|
|
4097
4097
|
return ff_core_Option.Some(code_)
|
|
4098
4098
|
}
|
|
4099
4099
|
}
|
|
4100
4100
|
if(_1 === "ff:core/Try.Try_finally") {
|
|
4101
|
-
const _guard1 =
|
|
4101
|
+
const _guard1 = ff_compiler_JsEmitter.JsEmitter_emitTryCatchFinally(self_, term_, last_, async_);
|
|
4102
4102
|
if(_guard1.Some) {
|
|
4103
4103
|
const code_ = _guard1.value_;
|
|
4104
4104
|
return ff_core_Option.Some(code_)
|
|
@@ -4116,7 +4116,7 @@ if(_guard1.length === 3) {
|
|
|
4116
4116
|
const e1_ = _guard1[0];
|
|
4117
4117
|
const e2_ = _guard1[1];
|
|
4118
4118
|
const e3_ = _guard1[2];
|
|
4119
|
-
return ff_core_Option.Some((((
|
|
4119
|
+
return ff_core_Option.Some((((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e1_, async_) + ff_compiler_JsEmitter.JsEmitter_emitField(self_, e2_, async_, ".")) + " = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e3_, async_)))
|
|
4120
4120
|
}
|
|
4121
4121
|
}
|
|
4122
4122
|
if(_1 === "ff:core/JsValue.JsValue_increment") {
|
|
@@ -4125,7 +4125,7 @@ if(_guard1.length === 3) {
|
|
|
4125
4125
|
const e1_ = _guard1[0];
|
|
4126
4126
|
const e2_ = _guard1[1];
|
|
4127
4127
|
const e3_ = _guard1[2];
|
|
4128
|
-
return ff_core_Option.Some((((
|
|
4128
|
+
return ff_core_Option.Some((((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e1_, async_) + ff_compiler_JsEmitter.JsEmitter_emitField(self_, e2_, async_, ".")) + " += ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e3_, async_)))
|
|
4129
4129
|
}
|
|
4130
4130
|
}
|
|
4131
4131
|
if(_1 === "ff:core/JsValue.JsValue_decrement") {
|
|
@@ -4134,7 +4134,7 @@ if(_guard1.length === 3) {
|
|
|
4134
4134
|
const e1_ = _guard1[0];
|
|
4135
4135
|
const e2_ = _guard1[1];
|
|
4136
4136
|
const e3_ = _guard1[2];
|
|
4137
|
-
return ff_core_Option.Some((((
|
|
4137
|
+
return ff_core_Option.Some((((ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e1_, async_) + ff_compiler_JsEmitter.JsEmitter_emitField(self_, e2_, async_, ".")) + " -= ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e3_, async_)))
|
|
4138
4138
|
}
|
|
4139
4139
|
}
|
|
4140
4140
|
if(_1 === "ff:core/JsSystem.JsSystem_set") {
|
|
@@ -4148,7 +4148,7 @@ if(_guard2) {
|
|
|
4148
4148
|
const _guard1 = ff_compiler_JsEmitter.safeBare_(q_);
|
|
4149
4149
|
if(_guard1.Some) {
|
|
4150
4150
|
const s_ = _guard1.value_;
|
|
4151
|
-
return ff_core_Option.Some(((s_ + " = ") +
|
|
4151
|
+
return ff_core_Option.Some(((s_ + " = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e3_, async_)))
|
|
4152
4152
|
}
|
|
4153
4153
|
}
|
|
4154
4154
|
}
|
|
@@ -4164,7 +4164,7 @@ if(_guard2) {
|
|
|
4164
4164
|
const _guard1 = ff_compiler_JsEmitter.safeBare_(q_);
|
|
4165
4165
|
if(_guard1.Some) {
|
|
4166
4166
|
const s_ = _guard1.value_;
|
|
4167
|
-
return ff_core_Option.Some(((s_ + " += ") +
|
|
4167
|
+
return ff_core_Option.Some(((s_ + " += ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e3_, async_)))
|
|
4168
4168
|
}
|
|
4169
4169
|
}
|
|
4170
4170
|
}
|
|
@@ -4180,7 +4180,7 @@ if(_guard2) {
|
|
|
4180
4180
|
const _guard1 = ff_compiler_JsEmitter.safeBare_(q_);
|
|
4181
4181
|
if(_guard1.Some) {
|
|
4182
4182
|
const s_ = _guard1.value_;
|
|
4183
|
-
return ff_core_Option.Some(((s_ + " -= ") +
|
|
4183
|
+
return ff_core_Option.Some(((s_ + " -= ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e3_, async_)))
|
|
4184
4184
|
}
|
|
4185
4185
|
}
|
|
4186
4186
|
}
|
|
@@ -4194,22 +4194,22 @@ return ff_core_Option.None()
|
|
|
4194
4194
|
export async function JsEmitter_emitLightFusion$(self_, list_, async_, $task) {
|
|
4195
4195
|
let start_ = "0";
|
|
4196
4196
|
let end_ = "for_a.length";
|
|
4197
|
-
const listCode_ = (
|
|
4197
|
+
const listCode_ = (((_1) => {
|
|
4198
4198
|
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_dropFirst" && _1.arguments_.length === 2) {
|
|
4199
4199
|
const a1_ = _1.arguments_[0];
|
|
4200
4200
|
const a2_ = _1.arguments_[1];
|
|
4201
|
-
start_ =
|
|
4201
|
+
start_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a2_.value_, async_);
|
|
4202
4202
|
if((!ff_core_String.String_all(start_, ((_w1) => {
|
|
4203
4203
|
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
4204
4204
|
})))) {
|
|
4205
4205
|
start_ = (("Math.max(" + start_) + ", 0)")
|
|
4206
4206
|
};
|
|
4207
|
-
return
|
|
4207
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a1_.value_, async_)
|
|
4208
4208
|
}
|
|
4209
4209
|
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_dropLast" && _1.arguments_.length === 2) {
|
|
4210
4210
|
const a1_ = _1.arguments_[0];
|
|
4211
4211
|
const a2_ = _1.arguments_[1];
|
|
4212
|
-
const count_ =
|
|
4212
|
+
const count_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a2_.value_, async_);
|
|
4213
4213
|
if((!ff_core_String.String_all(count_, ((_w1) => {
|
|
4214
4214
|
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
4215
4215
|
})))) {
|
|
@@ -4217,24 +4217,24 @@ end_ = (((end_ + " - Math.max(") + count_) + ", 0)")
|
|
|
4217
4217
|
} else {
|
|
4218
4218
|
end_ = ((end_ + " - ") + count_)
|
|
4219
4219
|
};
|
|
4220
|
-
return
|
|
4220
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a1_.value_, async_)
|
|
4221
4221
|
}
|
|
4222
4222
|
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_takeFirst" && _1.arguments_.length === 2) {
|
|
4223
4223
|
const a1_ = _1.arguments_[0];
|
|
4224
4224
|
const a2_ = _1.arguments_[1];
|
|
4225
|
-
end_ =
|
|
4225
|
+
end_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a2_.value_, async_);
|
|
4226
4226
|
if((!ff_core_String.String_all(end_, ((_w1) => {
|
|
4227
4227
|
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
4228
4228
|
})))) {
|
|
4229
4229
|
end_ = (("Math.max(" + end_) + ", 0)")
|
|
4230
4230
|
};
|
|
4231
4231
|
end_ = (("Math.min(" + end_) + ", for_a.length)");
|
|
4232
|
-
return
|
|
4232
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a1_.value_, async_)
|
|
4233
4233
|
}
|
|
4234
4234
|
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/List.List_takeLast" && _1.arguments_.length === 2) {
|
|
4235
4235
|
const a1_ = _1.arguments_[0];
|
|
4236
4236
|
const a2_ = _1.arguments_[1];
|
|
4237
|
-
const count_ =
|
|
4237
|
+
const count_ = ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a2_.value_, async_);
|
|
4238
4238
|
if((!ff_core_String.String_all(count_, ((_w1) => {
|
|
4239
4239
|
return ff_core_Char.Char_isAsciiDigit(_w1)
|
|
4240
4240
|
})))) {
|
|
@@ -4242,17 +4242,17 @@ start_ = (("Math.max(for_a.length - Math.max(" + count_) + ", 0), 0)")
|
|
|
4242
4242
|
} else {
|
|
4243
4243
|
start_ = (("Math.max(for_a.length - " + count_) + ", 0)")
|
|
4244
4244
|
};
|
|
4245
|
-
return
|
|
4245
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, a1_.value_, async_)
|
|
4246
4246
|
}
|
|
4247
4247
|
{
|
|
4248
|
-
return
|
|
4248
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, list_, async_)
|
|
4249
4249
|
}
|
|
4250
|
-
}))(list_
|
|
4250
|
+
}))(list_);
|
|
4251
4251
|
return ff_core_Pair.Pair(listCode_, ff_core_Pair.Pair(start_, end_))
|
|
4252
4252
|
}
|
|
4253
4253
|
|
|
4254
4254
|
export async function JsEmitter_emitTryCatchFinally$(self_, term_, last_, async_, $task) {
|
|
4255
|
-
|
|
4255
|
+
function emitCatch_(catchEffect_, cases_) {
|
|
4256
4256
|
const catchAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(catchEffect_));
|
|
4257
4257
|
ff_compiler_Patterns.convertAndCheck_(self_.otherModules_, cases_);
|
|
4258
4258
|
const arguments_ = ["_exception.value_", "_error"];
|
|
@@ -4260,13 +4260,13 @@ const arguments_ = ["_exception.value_", "_error"];
|
|
|
4260
4260
|
const _1 = cases_;
|
|
4261
4261
|
if(_1.length === 1) {
|
|
4262
4262
|
const case_ = _1[0];
|
|
4263
|
-
return
|
|
4263
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, case_, [], [], false, last_, catchAsync_)
|
|
4264
4264
|
}
|
|
4265
4265
|
{
|
|
4266
4266
|
const cs_ = _1;
|
|
4267
|
-
const caseStrings_ =
|
|
4268
|
-
return
|
|
4269
|
-
})
|
|
4267
|
+
const caseStrings_ = ff_core_List.List_map(cases_, ((_w1) => {
|
|
4268
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, _w1, [], [], true, last_, catchAsync_)
|
|
4269
|
+
}));
|
|
4270
4270
|
if(last_) {
|
|
4271
4271
|
return ff_core_List.List_join(caseStrings_, "\n")
|
|
4272
4272
|
} else {
|
|
@@ -4285,7 +4285,7 @@ const finallyEffect_ = _1.arguments_[1].value_.lambda_.effect_;
|
|
|
4285
4285
|
const finallyBody_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
|
|
4286
4286
|
const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
|
|
4287
4287
|
const finallyAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(finallyEffect_));
|
|
4288
|
-
return ff_core_Option.Some((((("try {\n" +
|
|
4288
|
+
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}"))
|
|
4289
4289
|
}
|
|
4290
4290
|
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_catch" && _1.arguments_.length === 2 && _1.arguments_[0].value_.ECall && _1.arguments_[0].value_.target_.StaticCall && _1.arguments_[0].value_.target_.name_ === "ff:core/Core.try" && _1.arguments_[0].value_.arguments_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.ELambda && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0 && _1.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0 && _1.arguments_[1].value_.ELambda && _1.dictionaries_.length === 1) {
|
|
4291
4291
|
const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
|
|
@@ -4294,8 +4294,8 @@ const catchEffect_ = _1.arguments_[1].value_.lambda_.effect_;
|
|
|
4294
4294
|
const cases_ = _1.arguments_[1].value_.lambda_.cases_;
|
|
4295
4295
|
const dictionary_ = _1.dictionaries_[0];
|
|
4296
4296
|
const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
|
|
4297
|
-
const d_ =
|
|
4298
|
-
return ff_core_Option.Some(((((((((("try {\n" +
|
|
4297
|
+
const d_ = ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, dictionary_);
|
|
4298
|
+
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}"))
|
|
4299
4299
|
}
|
|
4300
4300
|
if(_1.ECall && _1.target_.StaticCall && _1.target_.name_ === "ff:core/Try.Try_finally" && _1.arguments_.length === 2 && _1.arguments_[0].value_.ECall && _1.arguments_[0].value_.target_.StaticCall && _1.arguments_[0].value_.target_.name_ === "ff:core/Try.Try_catch" && _1.arguments_[0].value_.arguments_.length === 2 && _1.arguments_[0].value_.arguments_[0].value_.ECall && _1.arguments_[0].value_.arguments_[0].value_.target_.StaticCall && _1.arguments_[0].value_.arguments_[0].value_.target_.name_ === "ff:core/Core.try" && _1.arguments_[0].value_.arguments_[0].value_.arguments_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.ELambda && _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_.length === 1 && _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].patterns_.length === 0 && _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.cases_[0].guards_.length === 0 && _1.arguments_[0].value_.arguments_[1].value_.ELambda && _1.arguments_[0].value_.dictionaries_.length === 1 && _1.arguments_[1].value_.ELambda && _1.arguments_[1].value_.lambda_.cases_.length === 1 && _1.arguments_[1].value_.lambda_.cases_[0].patterns_.length === 0 && _1.arguments_[1].value_.lambda_.cases_[0].guards_.length === 0) {
|
|
4301
4301
|
const tryEffect_ = _1.arguments_[0].value_.arguments_[0].value_.arguments_[0].value_.lambda_.effect_;
|
|
@@ -4307,8 +4307,8 @@ const finallyEffect_ = _1.arguments_[1].value_.lambda_.effect_;
|
|
|
4307
4307
|
const finallyBody_ = _1.arguments_[1].value_.lambda_.cases_[0].body_;
|
|
4308
4308
|
const tryAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(tryEffect_));
|
|
4309
4309
|
const finallyAsync_ = (self_.emittingAsync_ && ff_compiler_JsEmitter.effectTypeIsAsync_(finallyEffect_));
|
|
4310
|
-
const d_ =
|
|
4311
|
-
return ff_core_Option.Some(((((((((((("try {\n" +
|
|
4310
|
+
const d_ = ff_compiler_JsEmitter.JsEmitter_emitDictionary(self_, dictionary_);
|
|
4311
|
+
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} finally {\n") + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, finallyBody_, last_, finallyAsync_)) + "\n}"))
|
|
4312
4312
|
}
|
|
4313
4313
|
{
|
|
4314
4314
|
return ff_core_Option.None()
|
|
@@ -4327,9 +4327,9 @@ const _1 = ff_core_Pair.Pair(matchCase_.patterns_, matchCase_.guards_);
|
|
|
4327
4327
|
if(_1.first_.length >= 1) {
|
|
4328
4328
|
const p_ = _1.first_[0];
|
|
4329
4329
|
const ps_ = _1.first_.slice(1);
|
|
4330
|
-
return
|
|
4330
|
+
return ff_compiler_JsEmitter.JsEmitter_emitPattern(self_, (arguments_[0] ?? ff_core_List.internalGrab_(arguments_, 0)), p_, ff_core_List.List_dropFirst(arguments_, 1), (((_c) => {
|
|
4331
4331
|
return ff_compiler_Syntax.MatchCase(_c.at_, ps_, _c.guards_, _c.body_)
|
|
4332
|
-
}))(matchCase_), conditions_, variables_, jump_, last_, async_
|
|
4332
|
+
}))(matchCase_), conditions_, variables_, jump_, last_, async_)
|
|
4333
4333
|
return
|
|
4334
4334
|
}
|
|
4335
4335
|
if(_1.first_.length === 0 && _1.second_.length === 1 && _1.second_[0].pattern_.PVariant && _1.second_[0].pattern_.name_ === "ff:core/Bool.True") {
|
|
@@ -4338,7 +4338,7 @@ if(ff_core_List.List_isEmpty(variables_)) {
|
|
|
4338
4338
|
const newCase_ = (((_c) => {
|
|
4339
4339
|
return ff_compiler_Syntax.MatchCase(_c.at_, [], [], _c.body_)
|
|
4340
4340
|
}))(matchCase_);
|
|
4341
|
-
return
|
|
4341
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, [], newCase_, [...conditions_, ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_)], [], jump_, last_, async_)
|
|
4342
4342
|
}
|
|
4343
4343
|
}
|
|
4344
4344
|
if(_1.first_.length === 0 && _1.second_.length === 1 && _1.second_[0].pattern_.PVariant && _1.second_[0].pattern_.name_ === "ff:core/Bool.True") {
|
|
@@ -4346,7 +4346,7 @@ const e_ = _1.second_[0].term_;
|
|
|
4346
4346
|
const newCase_ = (((_c) => {
|
|
4347
4347
|
return ff_compiler_Syntax.MatchCase(_c.at_, [], [], _c.body_)
|
|
4348
4348
|
}))(matchCase_);
|
|
4349
|
-
const code_ =
|
|
4349
|
+
const code_ = ff_compiler_JsEmitter.JsEmitter_emitCase(self_, [], newCase_, [ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, e_, async_)], [], jump_, last_, async_);
|
|
4350
4350
|
return emitWrapper_(code_)
|
|
4351
4351
|
}
|
|
4352
4352
|
if(_1.first_.length === 0 && _1.second_.length >= 1) {
|
|
@@ -4356,11 +4356,11 @@ const guardName_ = ("_guard" + (guards_.length + 1));
|
|
|
4356
4356
|
const newCase_ = (((_c) => {
|
|
4357
4357
|
return ff_compiler_Syntax.MatchCase(_c.at_, [guard_.pattern_], guards_, _c.body_)
|
|
4358
4358
|
}))(matchCase_);
|
|
4359
|
-
const code_ = ((((("const " + guardName_) + " = ") +
|
|
4359
|
+
const code_ = ((((("const " + guardName_) + " = ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, guard_.term_, async_)) + ";\n") + ff_compiler_JsEmitter.JsEmitter_emitCase(self_, [guardName_], newCase_, [], [], jump_, last_, async_));
|
|
4360
4360
|
return emitWrapper_(code_)
|
|
4361
4361
|
}
|
|
4362
4362
|
if(_1.first_.length === 0 && _1.second_.length === 0) {
|
|
4363
|
-
const statementsCode_ =
|
|
4363
|
+
const statementsCode_ = ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, matchCase_.body_, last_, async_);
|
|
4364
4364
|
const lastLine_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(statementsCode_), ((_w1) => {
|
|
4365
4365
|
return (_w1 !== 10)
|
|
4366
4366
|
})));
|
|
@@ -4381,20 +4381,20 @@ const _1 = pattern_;
|
|
|
4381
4381
|
if(_1.PString) {
|
|
4382
4382
|
const value_ = _1.value_;
|
|
4383
4383
|
const newConditions_ = [...conditions_, ((argument_ + " === ") + value_)];
|
|
4384
|
-
return
|
|
4384
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, newConditions_, variables_, jump_, last_, async_)
|
|
4385
4385
|
}
|
|
4386
4386
|
if(_1.PInt) {
|
|
4387
4387
|
const value_ = _1.value_;
|
|
4388
4388
|
const newConditions_ = [...conditions_, ((argument_ + " === ") + value_)];
|
|
4389
|
-
return
|
|
4389
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, newConditions_, variables_, jump_, last_, async_)
|
|
4390
4390
|
}
|
|
4391
4391
|
if(_1.PChar) {
|
|
4392
4392
|
const value_ = _1.value_;
|
|
4393
4393
|
const newConditions_ = [...conditions_, ((argument_ + " === ") + ff_compiler_JsEmitter.charLiteralToNumber_(value_))];
|
|
4394
|
-
return
|
|
4394
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, newConditions_, variables_, jump_, last_, async_)
|
|
4395
4395
|
}
|
|
4396
4396
|
if(_1.PVariable && _1.name_.None) {
|
|
4397
|
-
return
|
|
4397
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, conditions_, variables_, jump_, last_, async_)
|
|
4398
4398
|
}
|
|
4399
4399
|
if(_1.PVariable && _1.name_.Some) {
|
|
4400
4400
|
const name_ = _1.name_.value_;
|
|
@@ -4402,13 +4402,13 @@ const escaped_ = ff_compiler_JsEmitter.escapeKeyword_(name_);
|
|
|
4402
4402
|
const newVariables_ = ((escaped_ !== argument_)
|
|
4403
4403
|
? [...variables_, (((("const " + escaped_) + " = ") + argument_) + ";\n")]
|
|
4404
4404
|
: variables_);
|
|
4405
|
-
return
|
|
4405
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, conditions_, newVariables_, jump_, last_, async_)
|
|
4406
4406
|
}
|
|
4407
4407
|
if(_1.PVariant && _1.name_ === "ff:core/Bool.False" && _1.patterns_.length === 0) {
|
|
4408
|
-
return
|
|
4408
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, [...conditions_, ("!" + argument_)], variables_, jump_, last_, async_)
|
|
4409
4409
|
}
|
|
4410
4410
|
if(_1.PVariant && _1.name_ === "ff:core/Bool.True" && _1.patterns_.length === 0) {
|
|
4411
|
-
return
|
|
4411
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, [...conditions_, argument_], variables_, jump_, last_, async_)
|
|
4412
4412
|
}
|
|
4413
4413
|
if(_1.PVariant) {
|
|
4414
4414
|
const emptyOrLink_ = _1.name_;
|
|
@@ -4450,13 +4450,13 @@ return ">="
|
|
|
4450
4450
|
return "==="
|
|
4451
4451
|
}));
|
|
4452
4452
|
const newConditions_ = [...conditions_, ((((argument_ + ".length ") + operator_) + " ") + patterns_.length)];
|
|
4453
|
-
return
|
|
4453
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, newArguments_, newMatchCase_, newConditions_, variables_, jump_, last_, async_)
|
|
4454
4454
|
}
|
|
4455
4455
|
}
|
|
4456
4456
|
if(_1.PVariant) {
|
|
4457
4457
|
const name_ = _1.name_;
|
|
4458
4458
|
const patterns_ = _1.patterns_;
|
|
4459
|
-
const processed_ =
|
|
4459
|
+
const processed_ = ff_compiler_JsEmitter.JsEmitter_processVariantCase(self_, name_, argument_);
|
|
4460
4460
|
const newMatchCase_ = (((_c) => {
|
|
4461
4461
|
return ff_compiler_Syntax.MatchCase(_c.at_, [...patterns_, ...matchCase_.patterns_], _c.guards_, _c.body_)
|
|
4462
4462
|
}))(matchCase_);
|
|
@@ -4464,14 +4464,14 @@ const newConditions_ = (processed_.loneVariant_
|
|
|
4464
4464
|
? conditions_
|
|
4465
4465
|
: [...conditions_, ((argument_ + ".") + processed_.variantName_)]);
|
|
4466
4466
|
const newArguments_ = [...processed_.arguments_, ...arguments_];
|
|
4467
|
-
return
|
|
4467
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, newArguments_, newMatchCase_, newConditions_, variables_, jump_, last_, async_)
|
|
4468
4468
|
}
|
|
4469
4469
|
if(_1.PVariantAs) {
|
|
4470
4470
|
const at_ = _1.at_;
|
|
4471
4471
|
const name_ = _1.name_;
|
|
4472
4472
|
const variableAt_ = _1.variableAt_;
|
|
4473
4473
|
const variable_ = _1.variable_;
|
|
4474
|
-
const processed_ =
|
|
4474
|
+
const processed_ = ff_compiler_JsEmitter.JsEmitter_processVariantCase(self_, name_, argument_);
|
|
4475
4475
|
const newConditions_ = (processed_.loneVariant_
|
|
4476
4476
|
? conditions_
|
|
4477
4477
|
: [...conditions_, ((argument_ + ".") + processed_.variantName_)]);
|
|
@@ -4484,7 +4484,7 @@ return [...variables_, (((("const " + _w1) + " = ") + argument_) + ";\n")]
|
|
|
4484
4484
|
})), (() => {
|
|
4485
4485
|
return []
|
|
4486
4486
|
}));
|
|
4487
|
-
return
|
|
4487
|
+
return ff_compiler_JsEmitter.JsEmitter_emitCase(self_, arguments_, matchCase_, newConditions_, newVariables_, jump_, last_, async_)
|
|
4488
4488
|
}
|
|
4489
4489
|
if(_1.PAlias) {
|
|
4490
4490
|
const pattern_ = _1.pattern_;
|
|
@@ -4493,22 +4493,22 @@ const escaped_ = ff_compiler_JsEmitter.escapeKeyword_(variable_);
|
|
|
4493
4493
|
const newVariables_ = ((escaped_ !== argument_)
|
|
4494
4494
|
? [...variables_, (((("const " + escaped_) + " = ") + argument_) + ";\n")]
|
|
4495
4495
|
: variables_);
|
|
4496
|
-
return
|
|
4496
|
+
return ff_compiler_JsEmitter.JsEmitter_emitPattern(self_, argument_, pattern_, arguments_, matchCase_, conditions_, newVariables_, jump_, last_, async_)
|
|
4497
4497
|
}
|
|
4498
4498
|
}
|
|
4499
4499
|
}
|
|
4500
4500
|
|
|
4501
4501
|
export async function JsEmitter_emitList$(self_, items_, async_, $task) {
|
|
4502
|
-
return (("[" + ff_core_List.List_join(
|
|
4502
|
+
return (("[" + ff_core_List.List_join(ff_core_List.List_map(items_, ((_1) => {
|
|
4503
4503
|
if(!_1.second_) {
|
|
4504
4504
|
const item_ = _1.first_;
|
|
4505
|
-
return
|
|
4505
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, item_, async_)
|
|
4506
4506
|
}
|
|
4507
4507
|
if(_1.second_) {
|
|
4508
4508
|
const item_ = _1.first_;
|
|
4509
|
-
return ("..." +
|
|
4509
|
+
return ("..." + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, item_, async_))
|
|
4510
4510
|
}
|
|
4511
|
-
})
|
|
4511
|
+
})), ", ")) + "]")
|
|
4512
4512
|
}
|
|
4513
4513
|
|
|
4514
4514
|
export async function JsEmitter_processVariantCase$(self_, name_, argument_, $task) {
|
|
@@ -4572,7 +4572,7 @@ return (((((((((("\"" + self_.moduleName_) + ":") + callAt_.line_) + ":") + call
|
|
|
4572
4572
|
}
|
|
4573
4573
|
{
|
|
4574
4574
|
const value_ = _1;
|
|
4575
|
-
return
|
|
4575
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, value_, async_)
|
|
4576
4576
|
}
|
|
4577
4577
|
}
|
|
4578
4578
|
}
|
|
@@ -4586,7 +4586,7 @@ const before2_ = _1.before_.before_.after_;
|
|
|
4586
4586
|
const before3_ = _1.before_.after_;
|
|
4587
4587
|
const after_ = _1.after_;
|
|
4588
4588
|
if((((ff_compiler_JsEmitter.safeCommable_(before1_) && ff_compiler_JsEmitter.safeCommable_(before2_)) && ff_compiler_JsEmitter.safeCommable_(before3_)) && ff_compiler_JsEmitter.safeCommable_(after_))) {
|
|
4589
|
-
return (((((((("(" +
|
|
4589
|
+
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_)) + ")")
|
|
4590
4590
|
}
|
|
4591
4591
|
}
|
|
4592
4592
|
if(_1.ESequential && _1.before_.ESequential) {
|
|
@@ -4594,18 +4594,18 @@ const before1_ = _1.before_.before_;
|
|
|
4594
4594
|
const before2_ = _1.before_.after_;
|
|
4595
4595
|
const after_ = _1.after_;
|
|
4596
4596
|
if(((ff_compiler_JsEmitter.safeCommable_(before1_) && ff_compiler_JsEmitter.safeCommable_(before2_)) && ff_compiler_JsEmitter.safeCommable_(after_))) {
|
|
4597
|
-
return (((((("(" +
|
|
4597
|
+
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_)) + ")")
|
|
4598
4598
|
}
|
|
4599
4599
|
}
|
|
4600
4600
|
if(_1.ESequential) {
|
|
4601
4601
|
const before_ = _1.before_;
|
|
4602
4602
|
const after_ = _1.after_;
|
|
4603
4603
|
if((ff_compiler_JsEmitter.safeCommable_(before_) && ff_compiler_JsEmitter.safeCommable_(after_))) {
|
|
4604
|
-
return (((("(" +
|
|
4604
|
+
return (((("(" + ff_compiler_JsEmitter.JsEmitter_emitStatements(self_, before_, false, async_)) + ", ") + ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, after_, async_)) + ")")
|
|
4605
4605
|
}
|
|
4606
4606
|
}
|
|
4607
4607
|
{
|
|
4608
|
-
return
|
|
4608
|
+
return ff_compiler_JsEmitter.JsEmitter_emitTerm(self_, term_, async_)
|
|
4609
4609
|
}
|
|
4610
4610
|
}
|
|
4611
4611
|
}
|