firefly-compiler 0.5.13 → 0.5.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/JsEmitter.ff +27 -6
- package/fireflysite/Test.ff +8 -2
- package/fireflysite/assets/markdown/reference/FunctionsAndMethods.md +33 -13
- package/output/js/ff/compiler/Builder.mjs +8 -4
- package/output/js/ff/compiler/Compiler.mjs +8 -4
- package/output/js/ff/compiler/Deriver.mjs +2 -2
- package/output/js/ff/compiler/Inference.mjs +68 -48
- package/output/js/ff/compiler/JsEmitter.mjs +102 -34
- package/output/js/ff/compiler/Parser.mjs +70 -62
- package/output/js/ff/compiler/Patterns.mjs +4 -4
- package/output/js/ff/compiler/Resolver.mjs +10 -6
- package/output/js/ff/compiler/Tokenizer.mjs +2 -2
- package/output/js/ff/compiler/Unification.mjs +18 -10
- package/output/js/ff/compiler/Workspace.mjs +20 -18
- package/output/js/ff/core/Array.mjs +8 -8
- package/output/js/ff/core/List.mjs +46 -42
- package/output/js/ff/core/Ordering.mjs +4 -4
- package/output/js/ff/core/Random.mjs +8 -8
- package/output/js/ff/core/Serializable.mjs +8 -8
- package/output/js/ff/core/Task.mjs +2 -2
- package/package.json +1 -1
- package/vscode/package.json +1 -1
|
@@ -239,7 +239,7 @@ export function Parser_behind(self_) {
|
|
|
239
239
|
if((self_.offset_ === 0)) {
|
|
240
240
|
return ff_compiler_Parser.Parser_current(self_)
|
|
241
241
|
} else {
|
|
242
|
-
if(((self_.offset_ - 1) <
|
|
242
|
+
if(((self_.offset_ - 1) < self_.tokens_.length)) {
|
|
243
243
|
return ff_core_List.List_grab(self_.tokens_, (self_.offset_ - 1))
|
|
244
244
|
} else {
|
|
245
245
|
return self_.end_
|
|
@@ -248,15 +248,15 @@ return self_.end_
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
export function Parser_current(self_) {
|
|
251
|
-
if((self_.offset_ <
|
|
252
|
-
return ff_core_List.
|
|
251
|
+
if((self_.offset_ < self_.tokens_.length)) {
|
|
252
|
+
return (self_.tokens_[self_.offset_] ?? ff_core_List.internalGrab_(self_.tokens_, self_.offset_))
|
|
253
253
|
} else {
|
|
254
254
|
return self_.end_
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
export function Parser_ahead(self_) {
|
|
259
|
-
if(((self_.offset_ + 1) <
|
|
259
|
+
if(((self_.offset_ + 1) < self_.tokens_.length)) {
|
|
260
260
|
return ff_core_List.List_grab(self_.tokens_, (self_.offset_ + 1))
|
|
261
261
|
} else {
|
|
262
262
|
return self_.end_
|
|
@@ -264,7 +264,7 @@ return self_.end_
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
export function Parser_aheadAhead(self_) {
|
|
267
|
-
if(((self_.offset_ + 2) <
|
|
267
|
+
if(((self_.offset_ + 2) < self_.tokens_.length)) {
|
|
268
268
|
return ff_core_List.List_grab(self_.tokens_, (self_.offset_ + 2))
|
|
269
269
|
} else {
|
|
270
270
|
return self_.end_
|
|
@@ -324,9 +324,11 @@ return ff_compiler_Parser.Parser_skip(self_, kind_)
|
|
|
324
324
|
|
|
325
325
|
export function Parser_parseModuleWithoutPackageInfo(self_) {
|
|
326
326
|
const moduleWithPackageInfo_ = ff_compiler_Parser.Parser_parseModuleWithPackageInfo(self_);
|
|
327
|
-
|
|
327
|
+
for(let for_o = moduleWithPackageInfo_.packageInfo_; for_o.Some;) {
|
|
328
|
+
const info_ = for_o.value_;
|
|
328
329
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(info_.package_.at_, "Package and dependencies already declared in package.ff"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
329
|
-
|
|
330
|
+
break
|
|
331
|
+
};
|
|
330
332
|
return moduleWithPackageInfo_.module_
|
|
331
333
|
}
|
|
332
334
|
|
|
@@ -431,9 +433,9 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbol
|
|
|
431
433
|
};
|
|
432
434
|
const signature_ = ff_compiler_Parser.Parser_parseSignature(self_, member_);
|
|
433
435
|
const body_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")
|
|
434
|
-
? ff_core_Option.Some(ff_compiler_Parser.Parser_parseLambda(self_,
|
|
436
|
+
? ff_core_Option.Some(ff_compiler_Parser.Parser_parseLambda(self_, signature_.parameters_.length, false, false))
|
|
435
437
|
: ff_core_Option.None());
|
|
436
|
-
const targets_ = ff_compiler_Parser.Parser_parseTargets(self_,
|
|
438
|
+
const targets_ = ff_compiler_Parser.Parser_parseTargets(self_, signature_.parameters_.length);
|
|
437
439
|
const bestTarget_ = ff_compiler_Parser.findBestTarget_(self_.targetIsNode_, body_, targets_);
|
|
438
440
|
const result_ = ff_compiler_Syntax.DFunction(signature_.at_, signature_, bestTarget_);
|
|
439
441
|
if(self_.lspHook_.trackSymbols_) {
|
|
@@ -656,7 +658,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbol
|
|
|
656
658
|
signatures_.array.push(signature_);
|
|
657
659
|
if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
|
|
658
660
|
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"));
|
|
659
|
-
const body_ = ff_compiler_Parser.Parser_parseLambda(self_,
|
|
661
|
+
const body_ = ff_compiler_Parser.Parser_parseLambda(self_, signature_.parameters_.length, true, false);
|
|
660
662
|
if(generator_) {
|
|
661
663
|
methodGenerators_.array.push(ff_core_Pair.Pair(signature_.name_, body_))
|
|
662
664
|
} else {
|
|
@@ -780,7 +782,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbol
|
|
|
780
782
|
ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "}");
|
|
781
783
|
return ff_core_Array.Array_toList(variantsBuilder_, 0, 9007199254740991)
|
|
782
784
|
})());
|
|
783
|
-
if((newtype_ && (
|
|
785
|
+
if((newtype_ && (commonFields_.length !== 1))) {
|
|
784
786
|
ff_core_Log.show_(commonFields_, ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Parameter));
|
|
785
787
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(nameToken_), "Newtypes must have exactly one field"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
786
788
|
};
|
|
@@ -901,7 +903,7 @@ const parts_ = ff_core_String.String_split(ff_compiler_Token.Token_raw(majorMino
|
|
|
901
903
|
const patch_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDot())
|
|
902
904
|
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot()), ff_core_String.String_grabInt(ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt()))))
|
|
903
905
|
: 0);
|
|
904
|
-
return ff_compiler_Syntax.Version(ff_compiler_Token.Token_at(majorMinor_), ff_core_String.String_grabInt(ff_core_List.
|
|
906
|
+
return ff_compiler_Syntax.Version(ff_compiler_Token.Token_at(majorMinor_), ff_core_String.String_grabInt((parts_[0] ?? ff_core_List.internalGrab_(parts_, 0))), ff_core_String.String_grabInt((parts_[1] ?? ff_core_List.internalGrab_(parts_, 1))), patch_)
|
|
905
907
|
} else {
|
|
906
908
|
const major_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt());
|
|
907
909
|
return ff_compiler_Syntax.Version(ff_compiler_Token.Token_at(major_), ff_core_String.String_grabInt(ff_compiler_Token.Token_raw(major_)), 0, 0)
|
|
@@ -1040,7 +1042,7 @@ return ff_core_Option.Some(token_)
|
|
|
1040
1042
|
const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
|
|
1041
1043
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
1042
1044
|
if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
1043
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_,
|
|
1045
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, arguments_.array.length, ff_core_Option.Option_map(nameToken_, ((_w1) => {
|
|
1044
1046
|
return ff_compiler_Token.Token_raw(_w1)
|
|
1045
1047
|
}))));
|
|
1046
1048
|
self_.lspEmittedArgumentHook_ = true
|
|
@@ -1055,7 +1057,7 @@ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
|
1055
1057
|
};
|
|
1056
1058
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
1057
1059
|
if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
1058
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_,
|
|
1060
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, arguments_.array.length, ff_core_Option.None()));
|
|
1059
1061
|
self_.lspEmittedArgumentHook_ = true
|
|
1060
1062
|
}
|
|
1061
1063
|
};
|
|
@@ -1070,7 +1072,7 @@ const temporaryEffect_ = ff_compiler_Syntax.TConstructor(term_.at_, "TemporaryEf
|
|
|
1070
1072
|
const cases_ = [ff_compiler_Syntax.MatchCase(term_.at_, [], [], term_)];
|
|
1071
1073
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
1072
1074
|
if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
1073
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_,
|
|
1075
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, arguments_.array.length, ff_core_Option.None()));
|
|
1074
1076
|
self_.lspEmittedArgumentHook_ = true
|
|
1075
1077
|
}
|
|
1076
1078
|
};
|
|
@@ -1081,7 +1083,7 @@ lastWasCurly_ = ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(
|
|
|
1081
1083
|
const lambda_ = ff_compiler_Parser.Parser_parseLambda(self_, 0, false, true);
|
|
1082
1084
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
1083
1085
|
if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
1084
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_,
|
|
1086
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, arguments_.array.length, ff_core_Option.None()));
|
|
1085
1087
|
self_.lspEmittedArgumentHook_ = true
|
|
1086
1088
|
}
|
|
1087
1089
|
};
|
|
@@ -1220,7 +1222,7 @@ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_
|
|
|
1220
1222
|
const pattern_ = ff_compiler_Parser.Parser_parsePattern(self_);
|
|
1221
1223
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
1222
1224
|
if(ff_compiler_LspHook.strictlyBetween_(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
1223
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(ff_compiler_Token.Token_at(token_),
|
|
1225
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(ff_compiler_Token.Token_at(token_), patterns_.array.length, ff_core_Option.None()));
|
|
1224
1226
|
self_.lspEmittedArgumentHook_ = true
|
|
1225
1227
|
}
|
|
1226
1228
|
};
|
|
@@ -1231,7 +1233,7 @@ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
|
|
|
1231
1233
|
};
|
|
1232
1234
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
1233
1235
|
if(ff_compiler_LspHook.strictlyBetween_(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
1234
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(ff_compiler_Token.Token_at(token_),
|
|
1236
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(ff_compiler_Token.Token_at(token_), patterns_.array.length, ff_core_Option.None()));
|
|
1235
1237
|
self_.lspEmittedArgumentHook_ = true
|
|
1236
1238
|
}
|
|
1237
1239
|
};
|
|
@@ -1277,12 +1279,12 @@ const arguments_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_cu
|
|
|
1277
1279
|
: ff_compiler_Parser.Parser_parseTypeArguments(self_, false));
|
|
1278
1280
|
return [ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), (namespace_ + ff_compiler_Token.Token_raw(token_)), arguments_)]
|
|
1279
1281
|
})());
|
|
1280
|
-
if(((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick())) && (
|
|
1282
|
+
if(((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick())) && (leftTypes_.length === 1))) {
|
|
1281
1283
|
return ff_core_List.List_grabFirst(leftTypes_)
|
|
1282
1284
|
} else {
|
|
1283
1285
|
const arrowToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThick());
|
|
1284
1286
|
const rightType_ = ff_compiler_Parser.Parser_parseType(self_);
|
|
1285
|
-
return ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(arrowToken_), ("Function$" +
|
|
1287
|
+
return ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(arrowToken_), ("Function$" + leftTypes_.length), [...leftTypes_, rightType_])
|
|
1286
1288
|
}
|
|
1287
1289
|
}
|
|
1288
1290
|
|
|
@@ -1397,7 +1399,7 @@ const body_ = ((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_co
|
|
|
1397
1399
|
const temporaryEffect_ = ff_compiler_Syntax.TConstructor(functionAt_, "TemporaryEffect$", []);
|
|
1398
1400
|
return ff_compiler_Syntax.Lambda(functionAt_, temporaryEffect_, [])
|
|
1399
1401
|
})()
|
|
1400
|
-
: ff_compiler_Parser.Parser_parseLambda(self_,
|
|
1402
|
+
: ff_compiler_Parser.Parser_parseLambda(self_, signature_.parameters_.length, false, false));
|
|
1401
1403
|
functions_.array.push(ff_compiler_Syntax.DFunction(signature_.at_, signature_, ff_compiler_Syntax.FireflyTarget(body_)));
|
|
1402
1404
|
if(self_.lspHook_.trackSymbols_) {
|
|
1403
1405
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(signature_.name_, ff_compiler_LspHook.SFunction(false), signature_.at_, (((_c) => {
|
|
@@ -1419,7 +1421,7 @@ return ff_compiler_Parser.Parser_parseBinary(self_, 0)
|
|
|
1419
1421
|
}
|
|
1420
1422
|
|
|
1421
1423
|
export function Parser_parseBinary(self_, level_) {
|
|
1422
|
-
if((level_ >=
|
|
1424
|
+
if((level_ >= ff_compiler_Parser.binaryOperators_.length)) {
|
|
1423
1425
|
return ff_compiler_Parser.Parser_parseUnary(self_)
|
|
1424
1426
|
} else {
|
|
1425
1427
|
const operators_ = (ff_compiler_Parser.binaryOperators_[level_] ?? ff_core_List.internalGrab_(ff_compiler_Parser.binaryOperators_, level_));
|
|
@@ -1533,7 +1535,7 @@ const _1 = ff_core_List.List_indexWhere(arguments_.first_, ((_w1) => {
|
|
|
1533
1535
|
return (!ff_core_Option.Option_isEmpty(_w1.name_))
|
|
1534
1536
|
}));
|
|
1535
1537
|
if(_1.None) {
|
|
1536
|
-
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("new" +
|
|
1538
|
+
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("new" + arguments_.first_.length)), false);
|
|
1537
1539
|
return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], arguments_.first_, [])
|
|
1538
1540
|
}
|
|
1539
1541
|
if(_1.Some && _1.value_ === 0) {
|
|
@@ -1551,13 +1553,13 @@ return result_
|
|
|
1551
1553
|
}
|
|
1552
1554
|
if(_1.Some) {
|
|
1553
1555
|
const i_ = _1.value_;
|
|
1554
|
-
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_List.
|
|
1556
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError((arguments_.first_[i_] ?? ff_core_List.internalGrab_(arguments_.first_, i_)).at_, "Unexpected named argument"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
1555
1557
|
}
|
|
1556
1558
|
}
|
|
1557
1559
|
} else if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
|
|
1558
1560
|
const lambda_ = ff_compiler_Parser.Parser_parseLambda(self_, 0, false, false);
|
|
1559
1561
|
const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, record_.at_);
|
|
1560
|
-
const arguments_ = ff_core_List.
|
|
1562
|
+
const arguments_ = ff_core_List.List_grabFirst(lambda_.cases_).patterns_.length;
|
|
1561
1563
|
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("function" + arguments_)), false);
|
|
1562
1564
|
return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(lambda_.at_, ff_core_Option.None(), ff_compiler_Syntax.ELambda(lambda_.at_, lambda_))], [])
|
|
1563
1565
|
} else {
|
|
@@ -1571,13 +1573,15 @@ const member_ = ff_compiler_Syntax.EString(ff_compiler_Token.Token_at(token_), (
|
|
|
1571
1573
|
: (("\"" + ff_compiler_Token.Token_raw(token_)) + "\"")));
|
|
1572
1574
|
if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")) {
|
|
1573
1575
|
const arguments_ = ff_compiler_Parser.Parser_parseFunctionArguments(self_, record_.at_, false);
|
|
1574
|
-
|
|
1576
|
+
for(let for_o = ff_core_List.List_find(arguments_.first_, ((_w1) => {
|
|
1575
1577
|
return (!ff_core_Option.Option_isEmpty(_w1.name_))
|
|
1576
|
-
}))
|
|
1578
|
+
})); for_o.Some;) {
|
|
1579
|
+
const argument_ = for_o.value_;
|
|
1577
1580
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(argument_.at_, "Unexpected named argument"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
1578
|
-
|
|
1581
|
+
break
|
|
1582
|
+
};
|
|
1579
1583
|
const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, record_.at_);
|
|
1580
|
-
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("call" +
|
|
1584
|
+
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("call" + arguments_.first_.length)), false);
|
|
1581
1585
|
return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(member_.at_, ff_core_Option.None(), member_), ...arguments_.first_], [])
|
|
1582
1586
|
} else if(ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign(), ff_compiler_Token.LAssignPlus(), ff_compiler_Token.LAssignMinus())) {
|
|
1583
1587
|
const method_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign())
|
|
@@ -1701,7 +1705,7 @@ const field_ = (((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || ff_
|
|
|
1701
1705
|
: ff_compiler_Syntax.Field(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_))));
|
|
1702
1706
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
1703
1707
|
if(ff_compiler_LspHook.strictlyBetween_(startAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
1704
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(startAt_,
|
|
1708
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(startAt_, fields_.array.length, ff_core_Option.Option_filter(ff_core_Option.Some(field_.name_), ((_w1) => {
|
|
1705
1709
|
return (_w1 !== "")
|
|
1706
1710
|
}))));
|
|
1707
1711
|
self_.lspEmittedArgumentHook_ = true
|
|
@@ -1714,7 +1718,7 @@ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
|
1714
1718
|
};
|
|
1715
1719
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
1716
1720
|
if(ff_compiler_LspHook.strictlyBetween_(startAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
1717
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(startAt_,
|
|
1721
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(startAt_, fields_.array.length, ff_core_Option.None()));
|
|
1718
1722
|
self_.lspEmittedArgumentHook_ = true
|
|
1719
1723
|
}
|
|
1720
1724
|
};
|
|
@@ -1821,7 +1825,7 @@ export async function Parser_behind$(self_, $task) {
|
|
|
1821
1825
|
if((self_.offset_ === 0)) {
|
|
1822
1826
|
return ff_compiler_Parser.Parser_current(self_)
|
|
1823
1827
|
} else {
|
|
1824
|
-
if(((self_.offset_ - 1) <
|
|
1828
|
+
if(((self_.offset_ - 1) < self_.tokens_.length)) {
|
|
1825
1829
|
return ff_core_List.List_grab(self_.tokens_, (self_.offset_ - 1))
|
|
1826
1830
|
} else {
|
|
1827
1831
|
return self_.end_
|
|
@@ -1830,15 +1834,15 @@ return self_.end_
|
|
|
1830
1834
|
}
|
|
1831
1835
|
|
|
1832
1836
|
export async function Parser_current$(self_, $task) {
|
|
1833
|
-
if((self_.offset_ <
|
|
1834
|
-
return ff_core_List.
|
|
1837
|
+
if((self_.offset_ < self_.tokens_.length)) {
|
|
1838
|
+
return (self_.tokens_[self_.offset_] ?? ff_core_List.internalGrab_(self_.tokens_, self_.offset_))
|
|
1835
1839
|
} else {
|
|
1836
1840
|
return self_.end_
|
|
1837
1841
|
}
|
|
1838
1842
|
}
|
|
1839
1843
|
|
|
1840
1844
|
export async function Parser_ahead$(self_, $task) {
|
|
1841
|
-
if(((self_.offset_ + 1) <
|
|
1845
|
+
if(((self_.offset_ + 1) < self_.tokens_.length)) {
|
|
1842
1846
|
return ff_core_List.List_grab(self_.tokens_, (self_.offset_ + 1))
|
|
1843
1847
|
} else {
|
|
1844
1848
|
return self_.end_
|
|
@@ -1846,7 +1850,7 @@ return self_.end_
|
|
|
1846
1850
|
}
|
|
1847
1851
|
|
|
1848
1852
|
export async function Parser_aheadAhead$(self_, $task) {
|
|
1849
|
-
if(((self_.offset_ + 2) <
|
|
1853
|
+
if(((self_.offset_ + 2) < self_.tokens_.length)) {
|
|
1850
1854
|
return ff_core_List.List_grab(self_.tokens_, (self_.offset_ + 2))
|
|
1851
1855
|
} else {
|
|
1852
1856
|
return self_.end_
|
|
@@ -1906,9 +1910,11 @@ return ff_compiler_Parser.Parser_skip(self_, kind_)
|
|
|
1906
1910
|
|
|
1907
1911
|
export async function Parser_parseModuleWithoutPackageInfo$(self_, $task) {
|
|
1908
1912
|
const moduleWithPackageInfo_ = ff_compiler_Parser.Parser_parseModuleWithPackageInfo(self_);
|
|
1909
|
-
|
|
1913
|
+
for(let for_o = moduleWithPackageInfo_.packageInfo_; for_o.Some;) {
|
|
1914
|
+
const info_ = for_o.value_;
|
|
1910
1915
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(info_.package_.at_, "Package and dependencies already declared in package.ff"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
1911
|
-
|
|
1916
|
+
break
|
|
1917
|
+
};
|
|
1912
1918
|
return moduleWithPackageInfo_.module_
|
|
1913
1919
|
}
|
|
1914
1920
|
|
|
@@ -2013,9 +2019,9 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbol
|
|
|
2013
2019
|
};
|
|
2014
2020
|
const signature_ = ff_compiler_Parser.Parser_parseSignature(self_, member_);
|
|
2015
2021
|
const body_ = (ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")
|
|
2016
|
-
? ff_core_Option.Some(ff_compiler_Parser.Parser_parseLambda(self_,
|
|
2022
|
+
? ff_core_Option.Some(ff_compiler_Parser.Parser_parseLambda(self_, signature_.parameters_.length, false, false))
|
|
2017
2023
|
: ff_core_Option.None());
|
|
2018
|
-
const targets_ = ff_compiler_Parser.Parser_parseTargets(self_,
|
|
2024
|
+
const targets_ = ff_compiler_Parser.Parser_parseTargets(self_, signature_.parameters_.length);
|
|
2019
2025
|
const bestTarget_ = ff_compiler_Parser.findBestTarget_(self_.targetIsNode_, body_, targets_);
|
|
2020
2026
|
const result_ = ff_compiler_Syntax.DFunction(signature_.at_, signature_, bestTarget_);
|
|
2021
2027
|
if(self_.lspHook_.trackSymbols_) {
|
|
@@ -2238,7 +2244,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbol
|
|
|
2238
2244
|
signatures_.array.push(signature_);
|
|
2239
2245
|
if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
|
|
2240
2246
|
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"));
|
|
2241
|
-
const body_ = ff_compiler_Parser.Parser_parseLambda(self_,
|
|
2247
|
+
const body_ = ff_compiler_Parser.Parser_parseLambda(self_, signature_.parameters_.length, true, false);
|
|
2242
2248
|
if(generator_) {
|
|
2243
2249
|
methodGenerators_.array.push(ff_core_Pair.Pair(signature_.name_, body_))
|
|
2244
2250
|
} else {
|
|
@@ -2362,7 +2368,7 @@ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbol
|
|
|
2362
2368
|
ff_compiler_Parser.Parser_rawSkip(self_, ff_compiler_Token.LBracketRight(), "}");
|
|
2363
2369
|
return ff_core_Array.Array_toList(variantsBuilder_, 0, 9007199254740991)
|
|
2364
2370
|
})()));
|
|
2365
|
-
if((newtype_ && (
|
|
2371
|
+
if((newtype_ && (commonFields_.length !== 1))) {
|
|
2366
2372
|
ff_core_Log.show_(commonFields_, ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Parameter));
|
|
2367
2373
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Token.Token_at(nameToken_), "Newtypes must have exactly one field"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
2368
2374
|
};
|
|
@@ -2483,7 +2489,7 @@ const parts_ = ff_core_String.String_split(ff_compiler_Token.Token_raw(majorMino
|
|
|
2483
2489
|
const patch_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDot())
|
|
2484
2490
|
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot()), ff_core_String.String_grabInt(ff_compiler_Token.Token_raw(ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt()))))
|
|
2485
2491
|
: 0);
|
|
2486
|
-
return ff_compiler_Syntax.Version(ff_compiler_Token.Token_at(majorMinor_), ff_core_String.String_grabInt(ff_core_List.
|
|
2492
|
+
return ff_compiler_Syntax.Version(ff_compiler_Token.Token_at(majorMinor_), ff_core_String.String_grabInt((parts_[0] ?? ff_core_List.internalGrab_(parts_, 0))), ff_core_String.String_grabInt((parts_[1] ?? ff_core_List.internalGrab_(parts_, 1))), patch_)
|
|
2487
2493
|
} else {
|
|
2488
2494
|
const major_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LInt());
|
|
2489
2495
|
return ff_compiler_Syntax.Version(ff_compiler_Token.Token_at(major_), ff_core_String.String_grabInt(ff_compiler_Token.Token_raw(major_)), 0, 0)
|
|
@@ -2622,7 +2628,7 @@ return ff_core_Option.Some(token_)
|
|
|
2622
2628
|
const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
|
|
2623
2629
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
2624
2630
|
if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
2625
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_,
|
|
2631
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, arguments_.array.length, ff_core_Option.Option_map(nameToken_, ((_w1) => {
|
|
2626
2632
|
return ff_compiler_Token.Token_raw(_w1)
|
|
2627
2633
|
}))));
|
|
2628
2634
|
self_.lspEmittedArgumentHook_ = true
|
|
@@ -2637,7 +2643,7 @@ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
|
2637
2643
|
};
|
|
2638
2644
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
2639
2645
|
if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
2640
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_,
|
|
2646
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, arguments_.array.length, ff_core_Option.None()));
|
|
2641
2647
|
self_.lspEmittedArgumentHook_ = true
|
|
2642
2648
|
}
|
|
2643
2649
|
};
|
|
@@ -2652,7 +2658,7 @@ const temporaryEffect_ = ff_compiler_Syntax.TConstructor(term_.at_, "TemporaryEf
|
|
|
2652
2658
|
const cases_ = [ff_compiler_Syntax.MatchCase(term_.at_, [], [], term_)];
|
|
2653
2659
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
2654
2660
|
if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
2655
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_,
|
|
2661
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, arguments_.array.length, ff_core_Option.None()));
|
|
2656
2662
|
self_.lspEmittedArgumentHook_ = true
|
|
2657
2663
|
}
|
|
2658
2664
|
};
|
|
@@ -2663,7 +2669,7 @@ lastWasCurly_ = ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(
|
|
|
2663
2669
|
const lambda_ = ff_compiler_Parser.Parser_parseLambda(self_, 0, false, true);
|
|
2664
2670
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
2665
2671
|
if(ff_compiler_LspHook.strictlyBetween_(callAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
2666
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_,
|
|
2672
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(callAt_, arguments_.array.length, ff_core_Option.None()));
|
|
2667
2673
|
self_.lspEmittedArgumentHook_ = true
|
|
2668
2674
|
}
|
|
2669
2675
|
};
|
|
@@ -2802,7 +2808,7 @@ while((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_
|
|
|
2802
2808
|
const pattern_ = ff_compiler_Parser.Parser_parsePattern(self_);
|
|
2803
2809
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
2804
2810
|
if(ff_compiler_LspHook.strictlyBetween_(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
2805
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(ff_compiler_Token.Token_at(token_),
|
|
2811
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(ff_compiler_Token.Token_at(token_), patterns_.array.length, ff_core_Option.None()));
|
|
2806
2812
|
self_.lspEmittedArgumentHook_ = true
|
|
2807
2813
|
}
|
|
2808
2814
|
};
|
|
@@ -2813,7 +2819,7 @@ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LComma())
|
|
|
2813
2819
|
};
|
|
2814
2820
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
2815
2821
|
if(ff_compiler_LspHook.strictlyBetween_(ff_compiler_Token.Token_at(token_), ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
2816
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(ff_compiler_Token.Token_at(token_),
|
|
2822
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(ff_compiler_Token.Token_at(token_), patterns_.array.length, ff_core_Option.None()));
|
|
2817
2823
|
self_.lspEmittedArgumentHook_ = true
|
|
2818
2824
|
}
|
|
2819
2825
|
};
|
|
@@ -2859,12 +2865,12 @@ const arguments_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_cu
|
|
|
2859
2865
|
: ff_compiler_Parser.Parser_parseTypeArguments(self_, false));
|
|
2860
2866
|
return [ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(token_), (namespace_ + ff_compiler_Token.Token_raw(token_)), arguments_)]
|
|
2861
2867
|
})()));
|
|
2862
|
-
if(((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick())) && (
|
|
2868
|
+
if(((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LArrowThick())) && (leftTypes_.length === 1))) {
|
|
2863
2869
|
return ff_core_List.List_grabFirst(leftTypes_)
|
|
2864
2870
|
} else {
|
|
2865
2871
|
const arrowToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThick());
|
|
2866
2872
|
const rightType_ = ff_compiler_Parser.Parser_parseType(self_);
|
|
2867
|
-
return ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(arrowToken_), ("Function$" +
|
|
2873
|
+
return ff_compiler_Syntax.TConstructor(ff_compiler_Token.Token_at(arrowToken_), ("Function$" + leftTypes_.length), [...leftTypes_, rightType_])
|
|
2868
2874
|
}
|
|
2869
2875
|
}
|
|
2870
2876
|
|
|
@@ -2979,7 +2985,7 @@ const body_ = ((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_co
|
|
|
2979
2985
|
const temporaryEffect_ = ff_compiler_Syntax.TConstructor(functionAt_, "TemporaryEffect$", []);
|
|
2980
2986
|
return ff_compiler_Syntax.Lambda(functionAt_, temporaryEffect_, [])
|
|
2981
2987
|
})())
|
|
2982
|
-
: ff_compiler_Parser.Parser_parseLambda(self_,
|
|
2988
|
+
: ff_compiler_Parser.Parser_parseLambda(self_, signature_.parameters_.length, false, false));
|
|
2983
2989
|
functions_.array.push(ff_compiler_Syntax.DFunction(signature_.at_, signature_, ff_compiler_Syntax.FireflyTarget(body_)));
|
|
2984
2990
|
if(self_.lspHook_.trackSymbols_) {
|
|
2985
2991
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(signature_.name_, ff_compiler_LspHook.SFunction(false), signature_.at_, (((_c) => {
|
|
@@ -3001,7 +3007,7 @@ return ff_compiler_Parser.Parser_parseBinary(self_, 0)
|
|
|
3001
3007
|
}
|
|
3002
3008
|
|
|
3003
3009
|
export async function Parser_parseBinary$(self_, level_, $task) {
|
|
3004
|
-
if((level_ >=
|
|
3010
|
+
if((level_ >= ff_compiler_Parser.binaryOperators_.length)) {
|
|
3005
3011
|
return ff_compiler_Parser.Parser_parseUnary(self_)
|
|
3006
3012
|
} else {
|
|
3007
3013
|
const operators_ = (ff_compiler_Parser.binaryOperators_[level_] ?? ff_core_List.internalGrab_(ff_compiler_Parser.binaryOperators_, level_));
|
|
@@ -3115,7 +3121,7 @@ const _1 = ff_core_List.List_indexWhere(arguments_.first_, ((_w1) => {
|
|
|
3115
3121
|
return (!ff_core_Option.Option_isEmpty(_w1.name_))
|
|
3116
3122
|
}));
|
|
3117
3123
|
if(_1.None) {
|
|
3118
|
-
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("new" +
|
|
3124
|
+
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("new" + arguments_.first_.length)), false);
|
|
3119
3125
|
return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], arguments_.first_, [])
|
|
3120
3126
|
}
|
|
3121
3127
|
if(_1.Some && _1.value_ === 0) {
|
|
@@ -3133,13 +3139,13 @@ return result_
|
|
|
3133
3139
|
}
|
|
3134
3140
|
if(_1.Some) {
|
|
3135
3141
|
const i_ = _1.value_;
|
|
3136
|
-
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_List.
|
|
3142
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError((arguments_.first_[i_] ?? ff_core_List.internalGrab_(arguments_.first_, i_)).at_, "Unexpected named argument"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
3137
3143
|
}
|
|
3138
3144
|
}
|
|
3139
3145
|
} else if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
|
|
3140
3146
|
const lambda_ = ff_compiler_Parser.Parser_parseLambda(self_, 0, false, false);
|
|
3141
3147
|
const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, record_.at_);
|
|
3142
|
-
const arguments_ = ff_core_List.
|
|
3148
|
+
const arguments_ = ff_core_List.List_grabFirst(lambda_.cases_).patterns_.length;
|
|
3143
3149
|
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("function" + arguments_)), false);
|
|
3144
3150
|
return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(lambda_.at_, ff_core_Option.None(), ff_compiler_Syntax.ELambda(lambda_.at_, lambda_))], [])
|
|
3145
3151
|
} else {
|
|
@@ -3153,13 +3159,15 @@ const member_ = ff_compiler_Syntax.EString(ff_compiler_Token.Token_at(token_), (
|
|
|
3153
3159
|
: (("\"" + ff_compiler_Token.Token_raw(token_)) + "\"")));
|
|
3154
3160
|
if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")) {
|
|
3155
3161
|
const arguments_ = ff_compiler_Parser.Parser_parseFunctionArguments(self_, record_.at_, false);
|
|
3156
|
-
|
|
3162
|
+
for(let for_o = ff_core_List.List_find(arguments_.first_, ((_w1) => {
|
|
3157
3163
|
return (!ff_core_Option.Option_isEmpty(_w1.name_))
|
|
3158
|
-
}))
|
|
3164
|
+
})); for_o.Some;) {
|
|
3165
|
+
const argument_ = for_o.value_;
|
|
3159
3166
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(argument_.at_, "Unexpected named argument"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
3160
|
-
|
|
3167
|
+
break
|
|
3168
|
+
};
|
|
3161
3169
|
const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, record_.at_);
|
|
3162
|
-
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("call" +
|
|
3170
|
+
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("call" + arguments_.first_.length)), false);
|
|
3163
3171
|
return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(member_.at_, ff_core_Option.None(), member_), ...arguments_.first_], [])
|
|
3164
3172
|
} else if(ff_compiler_Token.Token_is3(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign(), ff_compiler_Token.LAssignPlus(), ff_compiler_Token.LAssignMinus())) {
|
|
3165
3173
|
const method_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign())
|
|
@@ -3283,7 +3291,7 @@ const field_ = (((!ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) || ff_
|
|
|
3283
3291
|
: ff_compiler_Syntax.Field(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_), ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(fieldToken_), ff_compiler_Token.Token_raw(fieldToken_))));
|
|
3284
3292
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
3285
3293
|
if(ff_compiler_LspHook.strictlyBetween_(startAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
3286
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(startAt_,
|
|
3294
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(startAt_, fields_.array.length, ff_core_Option.Option_filter(ff_core_Option.Some(field_.name_), ((_w1) => {
|
|
3287
3295
|
return (_w1 !== "")
|
|
3288
3296
|
}))));
|
|
3289
3297
|
self_.lspEmittedArgumentHook_ = true
|
|
@@ -3296,7 +3304,7 @@ ff_compiler_Parser.Parser_skipSeparator(self_, ff_compiler_Token.LComma())
|
|
|
3296
3304
|
};
|
|
3297
3305
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!self_.lspEmittedArgumentHook_))) {
|
|
3298
3306
|
if(ff_compiler_LspHook.strictlyBetween_(startAt_, ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_)), self_.lspHook_.at_, 1)) {
|
|
3299
|
-
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(startAt_,
|
|
3307
|
+
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseArgumentHook(startAt_, fields_.array.length, ff_core_Option.None()));
|
|
3300
3308
|
self_.lspEmittedArgumentHook_ = true
|
|
3301
3309
|
}
|
|
3302
3310
|
};
|
|
@@ -157,7 +157,7 @@ const vs_ = _1.second_;
|
|
|
157
157
|
return ((f_ + " could be ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(ff_core_Set.Set_toList(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)))
|
|
158
158
|
}
|
|
159
159
|
}));
|
|
160
|
-
if((
|
|
160
|
+
if((remaining_.length !== 0)) {
|
|
161
161
|
ff_core_Core.panic_(("Unexhaustive match:\n" + ff_core_List.List_join(remaining_, "\n")))
|
|
162
162
|
}
|
|
163
163
|
return
|
|
@@ -270,7 +270,7 @@ const converted_ = ff_compiler_Patterns.convert_(modules_, cases_);
|
|
|
270
270
|
ff_core_Try.Try_else(ff_core_Core.try_((() => {
|
|
271
271
|
ff_compiler_Patterns.check_(ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), [], converted_, false, false)
|
|
272
272
|
})), (() => {
|
|
273
|
-
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_List.
|
|
273
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError((cases_[0] ?? ff_core_List.internalGrab_(cases_, 0)).at_, "Unexhaustive match"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
274
274
|
}))
|
|
275
275
|
}
|
|
276
276
|
|
|
@@ -327,7 +327,7 @@ const vs_ = _1.second_;
|
|
|
327
327
|
return ((f_ + " could be ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(ff_core_Set.Set_toList(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)))
|
|
328
328
|
}
|
|
329
329
|
}));
|
|
330
|
-
if((
|
|
330
|
+
if((remaining_.length !== 0)) {
|
|
331
331
|
ff_core_Core.panic_(("Unexhaustive match:\n" + ff_core_List.List_join(remaining_, "\n")))
|
|
332
332
|
}
|
|
333
333
|
return
|
|
@@ -440,7 +440,7 @@ const converted_ = ff_compiler_Patterns.convert_(modules_, cases_);
|
|
|
440
440
|
ff_core_Try.Try_else(ff_core_Core.try_((() => {
|
|
441
441
|
ff_compiler_Patterns.check_(ff_core_List.List_toMap([], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), [], converted_, false, false)
|
|
442
442
|
})), (() => {
|
|
443
|
-
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_List.
|
|
443
|
+
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError((cases_[0] ?? ff_core_List.internalGrab_(cases_, 0)).at_, "Unexhaustive match"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
444
444
|
}))
|
|
445
445
|
}
|
|
446
446
|
|
|
@@ -867,11 +867,13 @@ return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, ["Q$", ...sign
|
|
|
867
867
|
: (((_c) => {
|
|
868
868
|
return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, _c.generics_, _c.constraints_, _c.parameters_, _c.returnType_, ff_compiler_Resolver.Resolver_freshUnificationVariable(self_, signature_.at_))
|
|
869
869
|
}))(signature_));
|
|
870
|
-
|
|
870
|
+
for(let for_o = ff_core_List.List_find(newSignature_.generics_, ((name_) => {
|
|
871
871
|
return ff_core_Set.Set_contains(self_.typeParameters_, name_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
|
|
872
|
-
}))
|
|
872
|
+
})); for_o.Some;) {
|
|
873
|
+
const name_ = for_o.value_;
|
|
873
874
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(signature_.at_, (("Type parameter " + name_) + " is already in scope")), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
874
|
-
|
|
875
|
+
break
|
|
876
|
+
};
|
|
875
877
|
const self2_ = ff_compiler_Resolver.Resolver_withSignature(self_, newSignature_);
|
|
876
878
|
{
|
|
877
879
|
const _1 = newSignature_;
|
|
@@ -1810,11 +1812,13 @@ return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, ["Q$", ...sign
|
|
|
1810
1812
|
: (((_c) => {
|
|
1811
1813
|
return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, _c.generics_, _c.constraints_, _c.parameters_, _c.returnType_, ff_compiler_Resolver.Resolver_freshUnificationVariable(self_, signature_.at_))
|
|
1812
1814
|
}))(signature_));
|
|
1813
|
-
|
|
1815
|
+
for(let for_o = ff_core_List.List_find(newSignature_.generics_, ((name_) => {
|
|
1814
1816
|
return ff_core_Set.Set_contains(self_.typeParameters_, name_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
|
|
1815
|
-
}))
|
|
1817
|
+
})); for_o.Some;) {
|
|
1818
|
+
const name_ = for_o.value_;
|
|
1816
1819
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(signature_.at_, (("Type parameter " + name_) + " is already in scope")), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
1817
|
-
|
|
1820
|
+
break
|
|
1821
|
+
};
|
|
1818
1822
|
const self2_ = ff_compiler_Resolver.Resolver_withSignature(self_, newSignature_);
|
|
1819
1823
|
{
|
|
1820
1824
|
const _1 = newSignature_;
|
|
@@ -136,7 +136,7 @@ if((((last_.stopLine_ === startLine_) && ff_compiler_Token.ff_core_Equal_Equal$f
|
|
|
136
136
|
if((((completionLine_ === last_.startLine_) && (completionColumn_ >= ((1 + last_.startOffset_) - last_.startLineOffset_))) && (completionColumn_ <= ((1 + last_.stopOffset_) - last_.stopLineOffset_)))) {
|
|
137
137
|
tokens_.array.push(ff_compiler_Token.Token(file_, code_, ff_compiler_Token.LSeparator(), startLine_, startLineOffset_, startLineOffset_, startLine_, startLineOffset_, startLineOffset_))
|
|
138
138
|
} else {
|
|
139
|
-
ff_core_Array.Array_modify(tokens_, (
|
|
139
|
+
ff_core_Array.Array_modify(tokens_, (tokens_.array.length - 1), ((_w1) => {
|
|
140
140
|
{
|
|
141
141
|
const _1 = _w1;
|
|
142
142
|
{
|
|
@@ -383,7 +383,7 @@ if((((last_.stopLine_ === startLine_) && ff_compiler_Token.ff_core_Equal_Equal$f
|
|
|
383
383
|
if((((completionLine_ === last_.startLine_) && (completionColumn_ >= ((1 + last_.startOffset_) - last_.startLineOffset_))) && (completionColumn_ <= ((1 + last_.stopOffset_) - last_.stopLineOffset_)))) {
|
|
384
384
|
tokens_.array.push(ff_compiler_Token.Token(file_, code_, ff_compiler_Token.LSeparator(), startLine_, startLineOffset_, startLineOffset_, startLine_, startLineOffset_, startLineOffset_))
|
|
385
385
|
} else {
|
|
386
|
-
ff_core_Array.Array_modify(tokens_, (
|
|
386
|
+
ff_core_Array.Array_modify(tokens_, (tokens_.array.length - 1), ((_w1) => {
|
|
387
387
|
{
|
|
388
388
|
const _1 = _w1;
|
|
389
389
|
{
|