firefly-compiler 0.5.8 → 0.5.10
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 +89 -1
- package/output/js/ff/compiler/Builder.mjs +22 -16
- package/output/js/ff/compiler/Compiler.mjs +2 -2
- package/output/js/ff/compiler/Inference.mjs +32 -22
- package/output/js/ff/compiler/JsEmitter.mjs +276 -2
- package/output/js/ff/compiler/LspHook.mjs +2 -2
- package/output/js/ff/compiler/Parser.mjs +84 -82
- package/output/js/ff/compiler/Resolver.mjs +38 -28
- package/output/js/ff/compiler/Tokenizer.mjs +10 -10
- package/output/js/ff/compiler/Unification.mjs +10 -8
- package/output/js/ff/core/Array.mjs +8 -8
- package/output/js/ff/core/Int.mjs +4 -4
- package/output/js/ff/core/IntMap.mjs +8 -8
- package/output/js/ff/core/Json.mjs +12 -10
- package/output/js/ff/core/List.mjs +130 -104
- package/output/js/ff/core/Map.mjs +8 -6
- package/output/js/ff/core/Random.mjs +18 -12
- package/output/js/ff/core/RbMap.mjs +2 -2
- package/output/js/ff/core/Serializable.mjs +6 -4
- package/output/js/ff/core/Set.mjs +6 -4
- package/output/js/ff/core/Stream.mjs +8 -8
- package/output/js/ff/core/StringMap.mjs +8 -8
- package/output/js/ff/core/Task.mjs +6 -4
- package/package.json +1 -1
- package/vscode/package.json +1 -1
|
@@ -354,14 +354,14 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Sy
|
|
|
354
354
|
};
|
|
355
355
|
const dependencies_ = ff_core_Array.new_();
|
|
356
356
|
while((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_), "dependency"))) {
|
|
357
|
-
|
|
357
|
+
dependencies_.array.push(ff_compiler_Parser.Parser_parseDependencyDefinition(self_, package_.targets_));
|
|
358
358
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
|
|
359
359
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
|
|
360
360
|
}
|
|
361
361
|
};
|
|
362
362
|
const includes_ = ff_core_Array.new_();
|
|
363
363
|
while((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_), "include"))) {
|
|
364
|
-
|
|
364
|
+
includes_.array.push(ff_compiler_Parser.Parser_parseIncludeDefinition(self_));
|
|
365
365
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
|
|
366
366
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
|
|
367
367
|
}
|
|
@@ -379,19 +379,19 @@ const lets_ = ff_core_Array.new_();
|
|
|
379
379
|
const functions_ = ff_core_Array.new_();
|
|
380
380
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
|
|
381
381
|
if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower()) && (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LAssign()) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LColon())))) {
|
|
382
|
-
|
|
382
|
+
lets_.array.push(ff_compiler_Parser.Parser_parseLetDefinition(self_))
|
|
383
383
|
} else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
|
|
384
|
-
|
|
384
|
+
functions_.array.push(ff_compiler_Parser.Parser_parseFunctionDefinition(self_, false))
|
|
385
385
|
} else if((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_), "extend"))) {
|
|
386
|
-
|
|
386
|
+
extends_.array.push(ff_compiler_Parser.Parser_parseExtendDefinition(self_))
|
|
387
387
|
} else if((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_), "trait"))) {
|
|
388
|
-
|
|
388
|
+
traits_.array.push(ff_compiler_Parser.Parser_parseTraitDefinition(self_))
|
|
389
389
|
} else if((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_), "instance"))) {
|
|
390
|
-
|
|
390
|
+
instances_.array.push(ff_compiler_Parser.Parser_parseInstanceDefinition(self_))
|
|
391
391
|
} else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs4(ff_compiler_Parser.Parser_current(self_), "data", "class", "capability", "newtype"))) {
|
|
392
|
-
|
|
392
|
+
types_.array.push(ff_compiler_Parser.Parser_parseTypeDefinition(self_))
|
|
393
393
|
} else if((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_), "import"))) {
|
|
394
|
-
|
|
394
|
+
imports_.array.push(ff_compiler_Parser.Parser_parseImportDefinition(self_, self_.packagePair_))
|
|
395
395
|
} else if((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_), "include"))) {
|
|
396
396
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Includes must be at the top of the file or below 'package'"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
397
397
|
} else if((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_), "dependency"))) {
|
|
@@ -596,7 +596,7 @@ const type_ = ff_compiler_Parser.Parser_parseType(self_);
|
|
|
596
596
|
ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{");
|
|
597
597
|
const methods_ = ff_core_Array.new_();
|
|
598
598
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
599
|
-
|
|
599
|
+
methods_.array.push(ff_compiler_Parser.Parser_parseFunctionDefinition(self_, true));
|
|
600
600
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
601
601
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
|
|
602
602
|
}
|
|
@@ -636,7 +636,7 @@ while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_co
|
|
|
636
636
|
ff_compiler_Parser.Parser_fail(self_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Trait constraints is not yet implemented");
|
|
637
637
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
638
638
|
const constraint_ = ff_compiler_Parser.Parser_parseConstraint(self_);
|
|
639
|
-
|
|
639
|
+
constraints_.array.push((((_c) => {
|
|
640
640
|
return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, [ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(typeParameterToken_), ff_compiler_Token.Token_raw(typeParameterToken_), []), ...constraint_.generics_])
|
|
641
641
|
}))(constraint_))
|
|
642
642
|
};
|
|
@@ -659,14 +659,14 @@ const signature_ = ff_compiler_Parser.Parser_parseSignature(self_, true);
|
|
|
659
659
|
if(self_.lspHook_.trackSymbols_) {
|
|
660
660
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(signatureNameToken_), ff_compiler_LspHook.STraitFunction(), ff_compiler_Token.Token_at(signatureNameToken_), ff_compiler_Token.Token_end(signatureNameToken_), ff_compiler_Token.Token_at(signatureNameToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
|
|
661
661
|
};
|
|
662
|
-
|
|
662
|
+
signatures_.array.push(signature_);
|
|
663
663
|
if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
|
|
664
664
|
const generator_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_ahead(self_), "generate"));
|
|
665
665
|
const body_ = ff_compiler_Parser.Parser_parseLambda(self_, ff_core_List.List_size(signature_.parameters_), true, false);
|
|
666
666
|
if(generator_) {
|
|
667
|
-
|
|
667
|
+
methodGenerators_.array.push(ff_core_Pair.Pair(signature_.name_, body_))
|
|
668
668
|
} else {
|
|
669
|
-
|
|
669
|
+
methodDefaults_.array.push(ff_core_Pair.Pair(signature_.name_, body_))
|
|
670
670
|
}
|
|
671
671
|
};
|
|
672
672
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
@@ -692,7 +692,7 @@ const poly_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current
|
|
|
692
692
|
? ff_compiler_Parser.Poly([], [])
|
|
693
693
|
: ff_compiler_Parser.Parser_parseTypeParameters(self_));
|
|
694
694
|
const typeArguments_ = ff_core_Array.new_();
|
|
695
|
-
|
|
695
|
+
typeArguments_.array.push(ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_), ff_core_List.List_map(poly_.generics_, ((_w1) => {
|
|
696
696
|
return ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), _w1, [])
|
|
697
697
|
}))));
|
|
698
698
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
@@ -700,7 +700,7 @@ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUppe
|
|
|
700
700
|
if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "[")) {
|
|
701
701
|
ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "[");
|
|
702
702
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
703
|
-
|
|
703
|
+
typeArguments_.array.push(ff_compiler_Parser.Parser_parseType(self_));
|
|
704
704
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
705
705
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
|
|
706
706
|
}
|
|
@@ -714,7 +714,7 @@ const methods_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_curr
|
|
|
714
714
|
const definitions_ = ff_core_Array.new_();
|
|
715
715
|
ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{");
|
|
716
716
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
717
|
-
|
|
717
|
+
definitions_.array.push(ff_compiler_Parser.Parser_parseFunctionDefinition(self_, false));
|
|
718
718
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
719
719
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
|
|
720
720
|
}
|
|
@@ -775,7 +775,7 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Sy
|
|
|
775
775
|
return _w1.mutable_
|
|
776
776
|
}))).at_, "Only classes can have mutable fields"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
777
777
|
};
|
|
778
|
-
|
|
778
|
+
variantsBuilder_.array.push(ff_compiler_Syntax.Variant(ff_compiler_Token.Token_at(variantNameToken_), ff_compiler_Token.Token_raw(variantNameToken_), variantFields_));
|
|
779
779
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
780
780
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
|
|
781
781
|
};
|
|
@@ -809,7 +809,7 @@ export function Parser_parseImportDefinition(self_, currentPackagePair_) {
|
|
|
809
809
|
const importToken_ = ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "import");
|
|
810
810
|
const path_ = ff_core_Array.new_();
|
|
811
811
|
while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
|
|
812
|
-
|
|
812
|
+
path_.array.push(ff_compiler_Parser.Parser_parseDashedName(self_));
|
|
813
813
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot())
|
|
814
814
|
};
|
|
815
815
|
const fileToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
|
|
@@ -960,14 +960,14 @@ const parameters_ = ff_core_Array.new_();
|
|
|
960
960
|
const constraints_ = ff_core_Array.new_();
|
|
961
961
|
while(((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight())) && (!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LSemicolon())))) {
|
|
962
962
|
if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LBracketLeft())) {
|
|
963
|
-
|
|
963
|
+
constraints_.array.push(ff_compiler_Parser.Parser_parseConstraint(self_))
|
|
964
964
|
} else {
|
|
965
965
|
const parameterNameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
|
|
966
|
-
|
|
966
|
+
parameters_.array.push(ff_compiler_Token.Token_raw(parameterNameToken_));
|
|
967
967
|
while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())) {
|
|
968
968
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
969
969
|
const constraint_ = ff_compiler_Parser.Parser_parseConstraint(self_);
|
|
970
|
-
|
|
970
|
+
constraints_.array.push((((_c) => {
|
|
971
971
|
return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, [ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(parameterNameToken_), ff_compiler_Token.Token_raw(parameterNameToken_), []), ...constraint_.generics_])
|
|
972
972
|
}))(constraint_))
|
|
973
973
|
}
|
|
@@ -986,7 +986,7 @@ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), (pare
|
|
|
986
986
|
: "["));
|
|
987
987
|
const types_ = ff_core_Array.new_();
|
|
988
988
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
989
|
-
|
|
989
|
+
types_.array.push(ff_compiler_Parser.Parser_parseType(self_));
|
|
990
990
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
991
991
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
|
|
992
992
|
}
|
|
@@ -1013,7 +1013,7 @@ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword())
|
|
|
1013
1013
|
const parameterNameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
|
|
1014
1014
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())))) {
|
|
1015
1015
|
const t_ = ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(parameterNameToken_), "ff:core/Nothing.Nothing", []);
|
|
1016
|
-
|
|
1016
|
+
parameters_.array.push(ff_compiler_Syntax.Parameter(ff_compiler_Token.Token_at(parameterNameToken_), mutable_, ff_compiler_Token.Token_raw(parameterNameToken_), t_, ff_core_Option.None()));
|
|
1017
1017
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
1018
1018
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
1019
1019
|
}
|
|
@@ -1026,7 +1026,7 @@ const default_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current
|
|
|
1026
1026
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
|
|
1027
1027
|
return ff_core_Option.Some(ff_compiler_Parser.Parser_parseTerm(self_))
|
|
1028
1028
|
})());
|
|
1029
|
-
|
|
1029
|
+
parameters_.array.push(ff_compiler_Syntax.Parameter(ff_compiler_Token.Token_at(parameterNameToken_), mutable_, ff_compiler_Token.Token_raw(parameterNameToken_), parameterType_, default_));
|
|
1030
1030
|
if(lspTrackSymbols_) {
|
|
1031
1031
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(parameterNameToken_), ff_compiler_LspHook.SParameter(), ff_compiler_Token.Token_at(parameterNameToken_), ff_compiler_Token.Token_end(parameterNameToken_), ff_compiler_Token.Token_at(lspFirst_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
|
|
1032
1032
|
};
|
|
@@ -1061,7 +1061,7 @@ return ff_compiler_Token.Token_raw(_w1)
|
|
|
1061
1061
|
self_.lspEmittedArgumentHook_ = true
|
|
1062
1062
|
}
|
|
1063
1063
|
};
|
|
1064
|
-
|
|
1064
|
+
arguments_.array.push(ff_compiler_Syntax.Argument(ff_compiler_Token.Token_at(argumentToken_), ff_core_Option.Option_map(nameToken_, ((_w1) => {
|
|
1065
1065
|
return ff_compiler_Token.Token_raw(_w1)
|
|
1066
1066
|
})), value_));
|
|
1067
1067
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
@@ -1089,7 +1089,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgume
|
|
|
1089
1089
|
self_.lspEmittedArgumentHook_ = true
|
|
1090
1090
|
}
|
|
1091
1091
|
};
|
|
1092
|
-
|
|
1092
|
+
arguments_.array.push(ff_compiler_Syntax.Argument(term_.at_, ff_core_Option.None(), ff_compiler_Syntax.ELambda(term_.at_, ff_compiler_Syntax.Lambda(term_.at_, temporaryEffect_, cases_))))
|
|
1093
1093
|
} else {
|
|
1094
1094
|
while((ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{") || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon()))) {
|
|
1095
1095
|
lastWasCurly_ = ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{");
|
|
@@ -1100,7 +1100,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgume
|
|
|
1100
1100
|
self_.lspEmittedArgumentHook_ = true
|
|
1101
1101
|
}
|
|
1102
1102
|
};
|
|
1103
|
-
|
|
1103
|
+
arguments_.array.push(ff_compiler_Syntax.Argument(lambda_.at_, ff_core_Option.None(), ff_compiler_Syntax.ELambda(lambda_.at_, lambda_)))
|
|
1104
1104
|
}
|
|
1105
1105
|
}
|
|
1106
1106
|
};
|
|
@@ -1119,7 +1119,7 @@ const result_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(se
|
|
|
1119
1119
|
? (function() {
|
|
1120
1120
|
const cases_ = ff_core_Array.new_();
|
|
1121
1121
|
while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe())) {
|
|
1122
|
-
|
|
1122
|
+
cases_.array.push(ff_compiler_Parser.Parser_parseCase(self_))
|
|
1123
1123
|
};
|
|
1124
1124
|
return ff_core_Array.Array_toList(cases_, 0, 9007199254740991)
|
|
1125
1125
|
})()
|
|
@@ -1131,7 +1131,7 @@ const isVariable_ = ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current
|
|
|
1131
1131
|
const parameterToken_ = (isVariable_
|
|
1132
1132
|
? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower())
|
|
1133
1133
|
: ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LWildcard()));
|
|
1134
|
-
|
|
1134
|
+
parameters_.array.push(ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(parameterToken_), (isVariable_
|
|
1135
1135
|
? ff_core_Option.Some(ff_compiler_Token.Token_raw(parameterToken_))
|
|
1136
1136
|
: ff_core_Option.None())));
|
|
1137
1137
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick()))) {
|
|
@@ -1166,14 +1166,14 @@ export function Parser_parseCase(self_) {
|
|
|
1166
1166
|
const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LPipe());
|
|
1167
1167
|
const patterns_ = ff_core_Array.new_();
|
|
1168
1168
|
while(((!ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick(), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))) {
|
|
1169
|
-
|
|
1169
|
+
patterns_.array.push(ff_compiler_Parser.Parser_parsePattern(self_));
|
|
1170
1170
|
if(((!ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick(), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))) {
|
|
1171
1171
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
|
|
1172
1172
|
}
|
|
1173
1173
|
};
|
|
1174
1174
|
const guards_ = ff_core_Array.new_();
|
|
1175
1175
|
while(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
|
|
1176
|
-
|
|
1176
|
+
guards_.array.push(ff_compiler_Parser.Parser_parseCaseGuard(self_))
|
|
1177
1177
|
};
|
|
1178
1178
|
if(((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || (!ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())))) {
|
|
1179
1179
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThick())
|
|
@@ -1242,7 +1242,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgume
|
|
|
1242
1242
|
self_.lspEmittedArgumentHook_ = true
|
|
1243
1243
|
}
|
|
1244
1244
|
};
|
|
1245
|
-
|
|
1245
|
+
patterns_.array.push(pattern_);
|
|
1246
1246
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
1247
1247
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
|
|
1248
1248
|
}
|
|
@@ -1422,7 +1422,7 @@ const temporaryEffect_ = ff_compiler_Syntax.TConstructor(functionAt_, "Temporary
|
|
|
1422
1422
|
return ff_compiler_Syntax.Lambda(functionAt_, temporaryEffect_, [])
|
|
1423
1423
|
})()
|
|
1424
1424
|
: ff_compiler_Parser.Parser_parseLambda(self_, ff_core_List.List_size(signature_.parameters_), false, false));
|
|
1425
|
-
|
|
1425
|
+
functions_.array.push(ff_compiler_Syntax.DFunction(signature_.at_, signature_, ff_compiler_Syntax.FireflyTarget(body_)));
|
|
1426
1426
|
if(self_.lspHook_.trackSymbols_) {
|
|
1427
1427
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(signature_.name_, ff_compiler_LspHook.SFunction(false), signature_.at_, (((_c) => {
|
|
1428
1428
|
return ff_compiler_Syntax.Location(_c.file_, _c.line_, (signature_.at_.column_ + ff_core_String.String_size(signature_.name_)))
|
|
@@ -1566,13 +1566,14 @@ return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], arguments_.fi
|
|
|
1566
1566
|
if(_1.Some && _1.value_ === 0) {
|
|
1567
1567
|
const objectTarget_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, "object"), false);
|
|
1568
1568
|
let result_ = ff_compiler_Syntax.ECall(record_.at_, objectTarget_, effect_, [], [], []);
|
|
1569
|
-
|
|
1569
|
+
for(let for_i = 0, for_a = arguments_.first_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
1570
|
+
const argument_ = for_a[for_i];
|
|
1570
1571
|
if(ff_core_Option.Option_isEmpty(argument_.name_)) {
|
|
1571
1572
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(argument_.at_, "Expected a named argument"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
1572
1573
|
};
|
|
1573
1574
|
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, result_, "with"), false);
|
|
1574
1575
|
result_ = ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(argument_.at_, ff_core_Option.None(), ff_compiler_Syntax.EString(argument_.at_, (("\"" + ff_core_Option.Option_grab(argument_.name_)) + "\""))), ff_compiler_Syntax.Argument(argument_.value_.at_, ff_core_Option.None(), argument_.value_)], [])
|
|
1575
|
-
}
|
|
1576
|
+
};
|
|
1576
1577
|
return result_
|
|
1577
1578
|
}
|
|
1578
1579
|
if(_1.Some) {
|
|
@@ -1745,7 +1746,7 @@ return (_w1 !== "")
|
|
|
1745
1746
|
self_.lspEmittedArgumentHook_ = true
|
|
1746
1747
|
}
|
|
1747
1748
|
};
|
|
1748
|
-
|
|
1749
|
+
fields_.array.push(field_);
|
|
1749
1750
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
1750
1751
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
1751
1752
|
}
|
|
@@ -1766,7 +1767,7 @@ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
|
|
|
1766
1767
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
1767
1768
|
const fieldToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
|
|
1768
1769
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LColon());
|
|
1769
|
-
|
|
1770
|
+
fields_.array.push(ff_core_Pair.Pair(ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parseType(self_)));
|
|
1770
1771
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
1771
1772
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
1772
1773
|
}
|
|
@@ -1783,7 +1784,7 @@ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
|
|
|
1783
1784
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
1784
1785
|
const fieldToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
|
|
1785
1786
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
|
|
1786
|
-
|
|
1787
|
+
fields_.array.push(ff_core_Pair.Pair(ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parsePattern(self_)));
|
|
1787
1788
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
1788
1789
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
1789
1790
|
}
|
|
@@ -1825,7 +1826,7 @@ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDotDotDot())
|
|
|
1825
1826
|
const pattern_ = ((spread_ && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))
|
|
1826
1827
|
? ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), ff_core_Option.None())
|
|
1827
1828
|
: ff_compiler_Parser.Parser_parsePattern(self_));
|
|
1828
|
-
|
|
1829
|
+
items_.array.push(ff_core_Pair.Pair(pattern_, spread_));
|
|
1829
1830
|
if((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))) {
|
|
1830
1831
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
1831
1832
|
}
|
|
@@ -1842,7 +1843,7 @@ const spread_ = ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(sel
|
|
|
1842
1843
|
if(spread_) {
|
|
1843
1844
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDotDotDot())
|
|
1844
1845
|
};
|
|
1845
|
-
|
|
1846
|
+
items_.array.push(ff_core_Pair.Pair(ff_compiler_Parser.Parser_parseTerm(self_), spread_));
|
|
1846
1847
|
if((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))) {
|
|
1847
1848
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
1848
1849
|
}
|
|
@@ -1974,14 +1975,14 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Sy
|
|
|
1974
1975
|
};
|
|
1975
1976
|
const dependencies_ = ff_core_Array.new_();
|
|
1976
1977
|
while((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_), "dependency"))) {
|
|
1977
|
-
|
|
1978
|
+
dependencies_.array.push(ff_compiler_Parser.Parser_parseDependencyDefinition(self_, package_.targets_));
|
|
1978
1979
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
|
|
1979
1980
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
|
|
1980
1981
|
}
|
|
1981
1982
|
};
|
|
1982
1983
|
const includes_ = ff_core_Array.new_();
|
|
1983
1984
|
while((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_), "include"))) {
|
|
1984
|
-
|
|
1985
|
+
includes_.array.push(ff_compiler_Parser.Parser_parseIncludeDefinition(self_));
|
|
1985
1986
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
|
|
1986
1987
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
|
|
1987
1988
|
}
|
|
@@ -1999,19 +2000,19 @@ const lets_ = ff_core_Array.new_();
|
|
|
1999
2000
|
const functions_ = ff_core_Array.new_();
|
|
2000
2001
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LEnd()))) {
|
|
2001
2002
|
if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower()) && (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LAssign()) || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LColon())))) {
|
|
2002
|
-
|
|
2003
|
+
lets_.array.push(ff_compiler_Parser.Parser_parseLetDefinition(self_))
|
|
2003
2004
|
} else if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
|
|
2004
|
-
|
|
2005
|
+
functions_.array.push(ff_compiler_Parser.Parser_parseFunctionDefinition(self_, false))
|
|
2005
2006
|
} else if((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_), "extend"))) {
|
|
2006
|
-
|
|
2007
|
+
extends_.array.push(ff_compiler_Parser.Parser_parseExtendDefinition(self_))
|
|
2007
2008
|
} else if((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_), "trait"))) {
|
|
2008
|
-
|
|
2009
|
+
traits_.array.push(ff_compiler_Parser.Parser_parseTraitDefinition(self_))
|
|
2009
2010
|
} else if((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_), "instance"))) {
|
|
2010
|
-
|
|
2011
|
+
instances_.array.push(ff_compiler_Parser.Parser_parseInstanceDefinition(self_))
|
|
2011
2012
|
} else if((ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs4(ff_compiler_Parser.Parser_current(self_), "data", "class", "capability", "newtype"))) {
|
|
2012
|
-
|
|
2013
|
+
types_.array.push(ff_compiler_Parser.Parser_parseTypeDefinition(self_))
|
|
2013
2014
|
} else if((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_), "import"))) {
|
|
2014
|
-
|
|
2015
|
+
imports_.array.push(ff_compiler_Parser.Parser_parseImportDefinition(self_, self_.packagePair_))
|
|
2015
2016
|
} else if((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_), "include"))) {
|
|
2016
2017
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Includes must be at the top of the file or below 'package'"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
2017
2018
|
} else if((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_), "dependency"))) {
|
|
@@ -2216,7 +2217,7 @@ const type_ = ff_compiler_Parser.Parser_parseType(self_);
|
|
|
2216
2217
|
ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{");
|
|
2217
2218
|
const methods_ = ff_core_Array.new_();
|
|
2218
2219
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
2219
|
-
|
|
2220
|
+
methods_.array.push(ff_compiler_Parser.Parser_parseFunctionDefinition(self_, true));
|
|
2220
2221
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
2221
2222
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
|
|
2222
2223
|
}
|
|
@@ -2256,7 +2257,7 @@ while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_co
|
|
|
2256
2257
|
ff_compiler_Parser.Parser_fail(self_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), "Trait constraints is not yet implemented");
|
|
2257
2258
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
2258
2259
|
const constraint_ = ff_compiler_Parser.Parser_parseConstraint(self_);
|
|
2259
|
-
|
|
2260
|
+
constraints_.array.push((((_c) => {
|
|
2260
2261
|
return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, [ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(typeParameterToken_), ff_compiler_Token.Token_raw(typeParameterToken_), []), ...constraint_.generics_])
|
|
2261
2262
|
}))(constraint_))
|
|
2262
2263
|
};
|
|
@@ -2279,14 +2280,14 @@ const signature_ = ff_compiler_Parser.Parser_parseSignature(self_, true);
|
|
|
2279
2280
|
if(self_.lspHook_.trackSymbols_) {
|
|
2280
2281
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(signatureNameToken_), ff_compiler_LspHook.STraitFunction(), ff_compiler_Token.Token_at(signatureNameToken_), ff_compiler_Token.Token_end(signatureNameToken_), ff_compiler_Token.Token_at(signatureNameToken_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
|
|
2281
2282
|
};
|
|
2282
|
-
|
|
2283
|
+
signatures_.array.push(signature_);
|
|
2283
2284
|
if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
|
|
2284
2285
|
const generator_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LKeyword()) && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_ahead(self_), "generate"));
|
|
2285
2286
|
const body_ = ff_compiler_Parser.Parser_parseLambda(self_, ff_core_List.List_size(signature_.parameters_), true, false);
|
|
2286
2287
|
if(generator_) {
|
|
2287
|
-
|
|
2288
|
+
methodGenerators_.array.push(ff_core_Pair.Pair(signature_.name_, body_))
|
|
2288
2289
|
} else {
|
|
2289
|
-
|
|
2290
|
+
methodDefaults_.array.push(ff_core_Pair.Pair(signature_.name_, body_))
|
|
2290
2291
|
}
|
|
2291
2292
|
};
|
|
2292
2293
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
@@ -2312,7 +2313,7 @@ const poly_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current
|
|
|
2312
2313
|
? ff_compiler_Parser.Poly([], [])
|
|
2313
2314
|
: ff_compiler_Parser.Parser_parseTypeParameters(self_));
|
|
2314
2315
|
const typeArguments_ = ff_core_Array.new_();
|
|
2315
|
-
|
|
2316
|
+
typeArguments_.array.push(ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_raw(token_), ff_core_List.List_map(poly_.generics_, ((_w1) => {
|
|
2316
2317
|
return ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), _w1, [])
|
|
2317
2318
|
}))));
|
|
2318
2319
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
@@ -2320,7 +2321,7 @@ const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUppe
|
|
|
2320
2321
|
if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "[")) {
|
|
2321
2322
|
ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "[");
|
|
2322
2323
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
2323
|
-
|
|
2324
|
+
typeArguments_.array.push(ff_compiler_Parser.Parser_parseType(self_));
|
|
2324
2325
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
2325
2326
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
|
|
2326
2327
|
}
|
|
@@ -2334,7 +2335,7 @@ const methods_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_curr
|
|
|
2334
2335
|
const definitions_ = ff_core_Array.new_();
|
|
2335
2336
|
ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "{");
|
|
2336
2337
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
2337
|
-
|
|
2338
|
+
definitions_.array.push(ff_compiler_Parser.Parser_parseFunctionDefinition(self_, false));
|
|
2338
2339
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
2339
2340
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
|
|
2340
2341
|
}
|
|
@@ -2395,7 +2396,7 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Sy
|
|
|
2395
2396
|
return _w1.mutable_
|
|
2396
2397
|
}))).at_, "Only classes can have mutable fields"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
2397
2398
|
};
|
|
2398
|
-
|
|
2399
|
+
variantsBuilder_.array.push(ff_compiler_Syntax.Variant(ff_compiler_Token.Token_at(variantNameToken_), ff_compiler_Token.Token_raw(variantNameToken_), variantFields_));
|
|
2399
2400
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
2400
2401
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LSemicolon())
|
|
2401
2402
|
};
|
|
@@ -2429,7 +2430,7 @@ export async function Parser_parseImportDefinition$(self_, currentPackagePair_,
|
|
|
2429
2430
|
const importToken_ = ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LKeyword(), "import");
|
|
2430
2431
|
const path_ = ff_core_Array.new_();
|
|
2431
2432
|
while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())) {
|
|
2432
|
-
|
|
2433
|
+
path_.array.push(ff_compiler_Parser.Parser_parseDashedName(self_));
|
|
2433
2434
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot())
|
|
2434
2435
|
};
|
|
2435
2436
|
const fileToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
|
|
@@ -2580,14 +2581,14 @@ const parameters_ = ff_core_Array.new_();
|
|
|
2580
2581
|
const constraints_ = ff_core_Array.new_();
|
|
2581
2582
|
while(((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight())) && (!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LSemicolon())))) {
|
|
2582
2583
|
if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_ahead(self_), ff_compiler_Token.LBracketLeft())) {
|
|
2583
|
-
|
|
2584
|
+
constraints_.array.push(ff_compiler_Parser.Parser_parseConstraint(self_))
|
|
2584
2585
|
} else {
|
|
2585
2586
|
const parameterNameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper());
|
|
2586
|
-
|
|
2587
|
+
parameters_.array.push(ff_compiler_Token.Token_raw(parameterNameToken_));
|
|
2587
2588
|
while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())) {
|
|
2588
2589
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
2589
2590
|
const constraint_ = ff_compiler_Parser.Parser_parseConstraint(self_);
|
|
2590
|
-
|
|
2591
|
+
constraints_.array.push((((_c) => {
|
|
2591
2592
|
return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, [ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(parameterNameToken_), ff_compiler_Token.Token_raw(parameterNameToken_), []), ...constraint_.generics_])
|
|
2592
2593
|
}))(constraint_))
|
|
2593
2594
|
}
|
|
@@ -2606,7 +2607,7 @@ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), (pare
|
|
|
2606
2607
|
: "["));
|
|
2607
2608
|
const types_ = ff_core_Array.new_();
|
|
2608
2609
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
2609
|
-
|
|
2610
|
+
types_.array.push(ff_compiler_Parser.Parser_parseType(self_));
|
|
2610
2611
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
2611
2612
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
|
|
2612
2613
|
}
|
|
@@ -2633,7 +2634,7 @@ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LKeyword())
|
|
|
2633
2634
|
const parameterNameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
|
|
2634
2635
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon())))) {
|
|
2635
2636
|
const t_ = ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(parameterNameToken_), "ff:core/Nothing.Nothing", []);
|
|
2636
|
-
|
|
2637
|
+
parameters_.array.push(ff_compiler_Syntax.Parameter(ff_compiler_Token.Token_at(parameterNameToken_), mutable_, ff_compiler_Token.Token_raw(parameterNameToken_), t_, ff_core_Option.None()));
|
|
2637
2638
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
2638
2639
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
2639
2640
|
}
|
|
@@ -2646,7 +2647,7 @@ const default_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current
|
|
|
2646
2647
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
|
|
2647
2648
|
return ff_core_Option.Some(ff_compiler_Parser.Parser_parseTerm(self_))
|
|
2648
2649
|
})()));
|
|
2649
|
-
|
|
2650
|
+
parameters_.array.push(ff_compiler_Syntax.Parameter(ff_compiler_Token.Token_at(parameterNameToken_), mutable_, ff_compiler_Token.Token_raw(parameterNameToken_), parameterType_, default_));
|
|
2650
2651
|
if(lspTrackSymbols_) {
|
|
2651
2652
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(parameterNameToken_), ff_compiler_LspHook.SParameter(), ff_compiler_Token.Token_at(parameterNameToken_), ff_compiler_Token.Token_end(parameterNameToken_), ff_compiler_Token.Token_at(lspFirst_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
|
|
2652
2653
|
};
|
|
@@ -2681,7 +2682,7 @@ return ff_compiler_Token.Token_raw(_w1)
|
|
|
2681
2682
|
self_.lspEmittedArgumentHook_ = true
|
|
2682
2683
|
}
|
|
2683
2684
|
};
|
|
2684
|
-
|
|
2685
|
+
arguments_.array.push(ff_compiler_Syntax.Argument(ff_compiler_Token.Token_at(argumentToken_), ff_core_Option.Option_map(nameToken_, ((_w1) => {
|
|
2685
2686
|
return ff_compiler_Token.Token_raw(_w1)
|
|
2686
2687
|
})), value_));
|
|
2687
2688
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
@@ -2709,7 +2710,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgume
|
|
|
2709
2710
|
self_.lspEmittedArgumentHook_ = true
|
|
2710
2711
|
}
|
|
2711
2712
|
};
|
|
2712
|
-
|
|
2713
|
+
arguments_.array.push(ff_compiler_Syntax.Argument(term_.at_, ff_core_Option.None(), ff_compiler_Syntax.ELambda(term_.at_, ff_compiler_Syntax.Lambda(term_.at_, temporaryEffect_, cases_))))
|
|
2713
2714
|
} else {
|
|
2714
2715
|
while((ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{") || ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon()))) {
|
|
2715
2716
|
lastWasCurly_ = ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{");
|
|
@@ -2720,7 +2721,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgume
|
|
|
2720
2721
|
self_.lspEmittedArgumentHook_ = true
|
|
2721
2722
|
}
|
|
2722
2723
|
};
|
|
2723
|
-
|
|
2724
|
+
arguments_.array.push(ff_compiler_Syntax.Argument(lambda_.at_, ff_core_Option.None(), ff_compiler_Syntax.ELambda(lambda_.at_, lambda_)))
|
|
2724
2725
|
}
|
|
2725
2726
|
}
|
|
2726
2727
|
};
|
|
@@ -2739,7 +2740,7 @@ const result_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(se
|
|
|
2739
2740
|
? (await (async function() {
|
|
2740
2741
|
const cases_ = ff_core_Array.new_();
|
|
2741
2742
|
while(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe())) {
|
|
2742
|
-
|
|
2743
|
+
cases_.array.push(ff_compiler_Parser.Parser_parseCase(self_))
|
|
2743
2744
|
};
|
|
2744
2745
|
return ff_core_Array.Array_toList(cases_, 0, 9007199254740991)
|
|
2745
2746
|
})())
|
|
@@ -2751,7 +2752,7 @@ const isVariable_ = ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current
|
|
|
2751
2752
|
const parameterToken_ = (isVariable_
|
|
2752
2753
|
? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower())
|
|
2753
2754
|
: ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LWildcard()));
|
|
2754
|
-
|
|
2755
|
+
parameters_.array.push(ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(parameterToken_), (isVariable_
|
|
2755
2756
|
? ff_core_Option.Some(ff_compiler_Token.Token_raw(parameterToken_))
|
|
2756
2757
|
: ff_core_Option.None())));
|
|
2757
2758
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick()))) {
|
|
@@ -2786,14 +2787,14 @@ export async function Parser_parseCase$(self_, $task) {
|
|
|
2786
2787
|
const token_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LPipe());
|
|
2787
2788
|
const patterns_ = ff_core_Array.new_();
|
|
2788
2789
|
while(((!ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick(), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))) {
|
|
2789
|
-
|
|
2790
|
+
patterns_.array.push(ff_compiler_Parser.Parser_parsePattern(self_));
|
|
2790
2791
|
if(((!ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick(), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())) && (!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")))) {
|
|
2791
2792
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
|
|
2792
2793
|
}
|
|
2793
2794
|
};
|
|
2794
2795
|
const guards_ = ff_core_Array.new_();
|
|
2795
2796
|
while(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
|
|
2796
|
-
|
|
2797
|
+
guards_.array.push(ff_compiler_Parser.Parser_parseCaseGuard(self_))
|
|
2797
2798
|
};
|
|
2798
2799
|
if(((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || (!ff_compiler_Token.Token_is2(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe(), ff_compiler_Token.LBracketRight())))) {
|
|
2799
2800
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThick())
|
|
@@ -2862,7 +2863,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgume
|
|
|
2862
2863
|
self_.lspEmittedArgumentHook_ = true
|
|
2863
2864
|
}
|
|
2864
2865
|
};
|
|
2865
|
-
|
|
2866
|
+
patterns_.array.push(pattern_);
|
|
2866
2867
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
2867
2868
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
|
|
2868
2869
|
}
|
|
@@ -3042,7 +3043,7 @@ const temporaryEffect_ = ff_compiler_Syntax.TConstructor(functionAt_, "Temporary
|
|
|
3042
3043
|
return ff_compiler_Syntax.Lambda(functionAt_, temporaryEffect_, [])
|
|
3043
3044
|
})())
|
|
3044
3045
|
: ff_compiler_Parser.Parser_parseLambda(self_, ff_core_List.List_size(signature_.parameters_), false, false));
|
|
3045
|
-
|
|
3046
|
+
functions_.array.push(ff_compiler_Syntax.DFunction(signature_.at_, signature_, ff_compiler_Syntax.FireflyTarget(body_)));
|
|
3046
3047
|
if(self_.lspHook_.trackSymbols_) {
|
|
3047
3048
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(signature_.name_, ff_compiler_LspHook.SFunction(false), signature_.at_, (((_c) => {
|
|
3048
3049
|
return ff_compiler_Syntax.Location(_c.file_, _c.line_, (signature_.at_.column_ + ff_core_String.String_size(signature_.name_)))
|
|
@@ -3186,13 +3187,14 @@ return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], arguments_.fi
|
|
|
3186
3187
|
if(_1.Some && _1.value_ === 0) {
|
|
3187
3188
|
const objectTarget_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, "object"), false);
|
|
3188
3189
|
let result_ = ff_compiler_Syntax.ECall(record_.at_, objectTarget_, effect_, [], [], []);
|
|
3189
|
-
|
|
3190
|
+
for(let for_i = 0, for_a = arguments_.first_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
3191
|
+
const argument_ = for_a[for_i];
|
|
3190
3192
|
if(ff_core_Option.Option_isEmpty(argument_.name_)) {
|
|
3191
3193
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(argument_.at_, "Expected a named argument"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
3192
3194
|
};
|
|
3193
3195
|
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, result_, "with"), false);
|
|
3194
3196
|
result_ = ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(argument_.at_, ff_core_Option.None(), ff_compiler_Syntax.EString(argument_.at_, (("\"" + ff_core_Option.Option_grab(argument_.name_)) + "\""))), ff_compiler_Syntax.Argument(argument_.value_.at_, ff_core_Option.None(), argument_.value_)], [])
|
|
3195
|
-
}
|
|
3197
|
+
};
|
|
3196
3198
|
return result_
|
|
3197
3199
|
}
|
|
3198
3200
|
if(_1.Some) {
|
|
@@ -3365,7 +3367,7 @@ return (_w1 !== "")
|
|
|
3365
3367
|
self_.lspEmittedArgumentHook_ = true
|
|
3366
3368
|
}
|
|
3367
3369
|
};
|
|
3368
|
-
|
|
3370
|
+
fields_.array.push(field_);
|
|
3369
3371
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
3370
3372
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
3371
3373
|
}
|
|
@@ -3386,7 +3388,7 @@ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
|
|
|
3386
3388
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
3387
3389
|
const fieldToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
|
|
3388
3390
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LColon());
|
|
3389
|
-
|
|
3391
|
+
fields_.array.push(ff_core_Pair.Pair(ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parseType(self_)));
|
|
3390
3392
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
3391
3393
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
3392
3394
|
}
|
|
@@ -3403,7 +3405,7 @@ ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketLeft(), "(");
|
|
|
3403
3405
|
while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
3404
3406
|
const fieldToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
|
|
3405
3407
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
|
|
3406
|
-
|
|
3408
|
+
fields_.array.push(ff_core_Pair.Pair(ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Parser.Parser_parsePattern(self_)));
|
|
3407
3409
|
if((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketRight()))) {
|
|
3408
3410
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
3409
3411
|
}
|
|
@@ -3445,7 +3447,7 @@ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDotDotDot())
|
|
|
3445
3447
|
const pattern_ = ((spread_ && ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))
|
|
3446
3448
|
? ff_compiler_Syntax.PVariable(ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), ff_core_Option.None())
|
|
3447
3449
|
: ff_compiler_Parser.Parser_parsePattern(self_));
|
|
3448
|
-
|
|
3450
|
+
items_.array.push(ff_core_Pair.Pair(pattern_, spread_));
|
|
3449
3451
|
if((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))) {
|
|
3450
3452
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
3451
3453
|
}
|
|
@@ -3462,7 +3464,7 @@ const spread_ = ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(sel
|
|
|
3462
3464
|
if(spread_) {
|
|
3463
3465
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDotDotDot())
|
|
3464
3466
|
};
|
|
3465
|
-
|
|
3467
|
+
items_.array.push(ff_core_Pair.Pair(ff_compiler_Parser.Parser_parseTerm(self_), spread_));
|
|
3466
3468
|
if((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "]"))) {
|
|
3467
3469
|
ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
3468
3470
|
}
|