firefly-compiler 0.4.21 → 0.4.23

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.
@@ -541,11 +541,36 @@ ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, in
541
541
  const parameters_ = ff_core_List.List_sortBy(instantiated_.scheme_.signature_.parameters_, ((_w1) => {
542
542
  return _w1.name_
543
543
  }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
544
+ const paramtersWithFieldAt_ = ff_core_List.List_map(parameters_, ((p_) => {
545
+ {
546
+ const _1 = p_.valueType_;
547
+ if(_1.TConstructor) {
548
+ const t_ = _1;
549
+ {
550
+ const _1 = t_;
551
+ {
552
+ const _c = _1;
553
+ return ff_compiler_Syntax.TConstructor(p_.at_, _c.name_, _c.generics_)
554
+ }
555
+ }
556
+ return
557
+ }
558
+ if(_1.TVariable) {
559
+ const t_ = _1;
560
+ {
561
+ const _1 = t_;
562
+ {
563
+ const _c = _1;
564
+ return ff_compiler_Syntax.TVariable(p_.at_, _c.index_)
565
+ }
566
+ }
567
+ return
568
+ }
569
+ }
570
+ }));
544
571
  const recordType_ = ff_compiler_Syntax.TConstructor(at_, ("Record$" + ff_core_List.List_join(ff_core_List.List_map(parameters_, ((_w1) => {
545
572
  return _w1.name_
546
- })), "$")), ff_core_List.List_map(parameters_, ((_w1) => {
547
- return _w1.valueType_
548
- })));
573
+ })), "$")), paramtersWithFieldAt_);
549
574
  return ff_core_List.List_toMap(ff_core_List.List_map(ff_core_Option.Option_toList(variableOption_), ((_w1) => {
550
575
  return ff_core_Pair.Pair(_w1, ff_core_Pair.Pair(variableAt_, recordType_))
551
576
  })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
@@ -650,12 +675,22 @@ const t_ = _1;
650
675
  const name_ = _1.name_;
651
676
  const typeArguments_ = _1.generics_;
652
677
  if(ff_core_String.String_startsWith(name_, "Record$", 0)) {
653
- if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, e_.at_)) {
654
- const symbolHook_ = ff_compiler_LspHook.SymbolHook(e_.field_, e_.at_, e_.at_);
655
- const noEffect_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
656
- ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferRecordFieldHook(self_.unification_, environment_, expected_, t_, e_.field_))
657
- };
658
678
  const fieldNames_ = ff_core_List.List_dropFirst(ff_core_String.String_split(name_, 36), 1);
679
+ if(ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
680
+ ff_core_List.List_each(ff_core_List.List_zip(fieldNames_, typeArguments_), ((_1) => {
681
+ {
682
+ const fieldName_ = _1.first_;
683
+ const fieldType_ = _1.second_;
684
+ if((e_.field_ === fieldName_)) {
685
+ const definedAt_ = ff_compiler_Unification.Unification_substitute(self_.unification_, fieldType_).at_;
686
+ if((ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, e_.at_) || ff_compiler_LspHook.LspHook_isDefinedAt(self_.lspHook_, definedAt_))) {
687
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferRecordFieldHook(e_.at_, self_.unification_, environment_, expected_, t_, e_.field_))
688
+ }
689
+ }
690
+ return
691
+ }
692
+ }))
693
+ };
659
694
  return ff_core_Option.Option_else(ff_core_Option.Option_elseIf(ff_core_Option.Option_map(ff_core_Option.Option_map(ff_core_List.List_find(ff_core_List.List_pairs(fieldNames_), ((_w1) => {
660
695
  return (_w1.second_ === e_.field_)
661
696
  })), ((_w1) => {
@@ -994,7 +1029,11 @@ return term_
994
1029
  const call_ = (((_1) => {
995
1030
  if(_1.DynamicCall) {
996
1031
  const call_ = _1;
997
- return call_
1032
+ return {
1033
+ function_: call_.function_,
1034
+ tailCall_: call_.tailCall_
1035
+ }
1036
+ return
998
1037
  }
999
1038
  if(_1.StaticCall) {
1000
1039
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in the Inference phase")
@@ -1230,19 +1269,14 @@ return newValue_
1230
1269
  }
1231
1270
 
1232
1271
  export function Inference_inferMethodCall(self_, environment_, expected_, signature_, instantiation_, term_, record_, recordType_, name_) {
1233
- const e_ = (((_1) => {
1272
+ {
1273
+ const _1 = term_;
1234
1274
  if(_1.ECall) {
1235
1275
  const e_ = _1;
1236
- return e_
1237
- }
1238
- {
1239
- return ff_compiler_Inference.fail_(term_.at_, "Call expected")
1240
- }
1241
- }))(term_);
1242
- const call_ = (((_1) => {
1276
+ const tailCall_ = (((_1) => {
1243
1277
  if(_1.DynamicCall) {
1244
1278
  const call_ = _1;
1245
- return call_
1279
+ return call_.tailCall_
1246
1280
  }
1247
1281
  if(_1.StaticCall) {
1248
1282
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferMethodCall")
@@ -1258,28 +1292,29 @@ ff_compiler_Unification.Unification_affect(self_.unification_, term_.at_, signat
1258
1292
  const _1 = e_;
1259
1293
  {
1260
1294
  const _c = _1;
1261
- return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, call_.tailCall_, false), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
1295
+ return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, tailCall_, false), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
1262
1296
  return _w1.second_
1263
1297
  })), [selfArgument_, ...arguments_], _c.dictionaries_)
1264
1298
  return
1265
1299
  }
1266
1300
  }
1301
+ return
1302
+ }
1303
+ {
1304
+ return ff_compiler_Inference.fail_(term_.at_, "Call expected")
1305
+ }
1306
+ }
1267
1307
  }
1268
1308
 
1269
1309
  export function Inference_inferFunctionCall(self_, environment_, expected_, signature_, instanceCall_, instantiation_, term_, name_) {
1270
- const e_ = (((_1) => {
1310
+ {
1311
+ const _1 = term_;
1271
1312
  if(_1.ECall) {
1272
1313
  const e_ = _1;
1273
- return e_
1274
- }
1275
- {
1276
- return ff_compiler_Inference.fail_(term_.at_, "Call expected")
1277
- }
1278
- }))(term_);
1279
- const call_ = (((_1) => {
1314
+ const tailCall_ = (((_1) => {
1280
1315
  if(_1.DynamicCall) {
1281
1316
  const call_ = _1;
1282
- return call_
1317
+ return call_.tailCall_
1283
1318
  }
1284
1319
  if(_1.StaticCall) {
1285
1320
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferFunctionCall")
@@ -1292,29 +1327,34 @@ ff_compiler_Unification.Unification_affect(self_.unification_, term_.at_, signat
1292
1327
  const _1 = e_;
1293
1328
  {
1294
1329
  const _c = _1;
1295
- return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, call_.tailCall_, instanceCall_), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
1330
+ return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, tailCall_, instanceCall_), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
1296
1331
  return _w1.second_
1297
1332
  })), arguments_, _c.dictionaries_)
1298
1333
  return
1299
1334
  }
1300
1335
  }
1336
+ return
1337
+ }
1338
+ {
1339
+ return ff_compiler_Inference.fail_(term_.at_, "Call expected")
1340
+ }
1341
+ }
1301
1342
  }
1302
1343
 
1303
1344
  export function Inference_inferLambdaCall(self_, environment_, expected_, term_) {
1304
- const e_ = (((_1) => {
1345
+ {
1346
+ const _1 = term_;
1305
1347
  if(_1.ECall) {
1306
1348
  const e_ = _1;
1307
- return e_
1308
- }
1309
- {
1310
- return ff_compiler_Inference.fail_(term_.at_, "Call expected")
1311
- }
1312
- }))(term_);
1313
1349
  const call_ = (((_1) => {
1314
1350
  if(_1.DynamicCall) {
1315
1351
  const call_ = _1;
1316
1352
  if((!call_.tailCall_)) {
1317
- return call_
1353
+ return {
1354
+ function_: call_.function_,
1355
+ tailCall_: call_.tailCall_
1356
+ }
1357
+ return
1318
1358
  }
1319
1359
  }
1320
1360
  if(_1.DynamicCall) {
@@ -1361,18 +1401,19 @@ return ff_compiler_Syntax.DynamicCall(function_, _c.tailCall_)
1361
1401
  return
1362
1402
  }
1363
1403
  }
1404
+ return
1405
+ }
1406
+ {
1407
+ return ff_compiler_Inference.fail_(term_.at_, "Call expected")
1408
+ }
1409
+ }
1364
1410
  }
1365
1411
 
1366
1412
  export function Inference_inferOperator(self_, environment_, expected_, operator_, term_) {
1367
- const e_ = (((_1) => {
1413
+ {
1414
+ const _1 = term_;
1368
1415
  if(_1.ECall) {
1369
1416
  const e_ = _1;
1370
- return e_
1371
- }
1372
- {
1373
- return ff_compiler_Inference.fail_(term_.at_, "Call expected")
1374
- }
1375
- }))(term_);
1376
1417
  const target_ = ff_compiler_Syntax.StaticCall(operator_, false, false);
1377
1418
  {
1378
1419
  const _1 = e_.arguments_;
@@ -1586,6 +1627,12 @@ return term_
1586
1627
  return ff_compiler_Inference.fail_(e_.at_, ("Unknown operator: " + operator_))
1587
1628
  }
1588
1629
  }
1630
+ return
1631
+ }
1632
+ {
1633
+ return ff_compiler_Inference.fail_(term_.at_, "Call expected")
1634
+ }
1635
+ }
1589
1636
  }
1590
1637
 
1591
1638
  export function Inference_inferEtaExpansion(self_, environment_, expected_, at_, signature_, term_) {
@@ -2169,11 +2216,36 @@ ff_compiler_Unification.Unification_unify(self_.unification_, at_, expected_, in
2169
2216
  const parameters_ = ff_core_List.List_sortBy(instantiated_.scheme_.signature_.parameters_, ((_w1) => {
2170
2217
  return _w1.name_
2171
2218
  }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
2219
+ const paramtersWithFieldAt_ = ff_core_List.List_map(parameters_, ((p_) => {
2220
+ {
2221
+ const _1 = p_.valueType_;
2222
+ if(_1.TConstructor) {
2223
+ const t_ = _1;
2224
+ {
2225
+ const _1 = t_;
2226
+ {
2227
+ const _c = _1;
2228
+ return ff_compiler_Syntax.TConstructor(p_.at_, _c.name_, _c.generics_)
2229
+ }
2230
+ }
2231
+ return
2232
+ }
2233
+ if(_1.TVariable) {
2234
+ const t_ = _1;
2235
+ {
2236
+ const _1 = t_;
2237
+ {
2238
+ const _c = _1;
2239
+ return ff_compiler_Syntax.TVariable(p_.at_, _c.index_)
2240
+ }
2241
+ }
2242
+ return
2243
+ }
2244
+ }
2245
+ }));
2172
2246
  const recordType_ = ff_compiler_Syntax.TConstructor(at_, ("Record$" + ff_core_List.List_join(ff_core_List.List_map(parameters_, ((_w1) => {
2173
2247
  return _w1.name_
2174
- })), "$")), ff_core_List.List_map(parameters_, ((_w1) => {
2175
- return _w1.valueType_
2176
- })));
2248
+ })), "$")), paramtersWithFieldAt_);
2177
2249
  return ff_core_List.List_toMap(ff_core_List.List_map(ff_core_Option.Option_toList(variableOption_), ((_w1) => {
2178
2250
  return ff_core_Pair.Pair(_w1, ff_core_Pair.Pair(variableAt_, recordType_))
2179
2251
  })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
@@ -2278,12 +2350,22 @@ const t_ = _1;
2278
2350
  const name_ = _1.name_;
2279
2351
  const typeArguments_ = _1.generics_;
2280
2352
  if(ff_core_String.String_startsWith(name_, "Record$", 0)) {
2281
- if(ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, e_.at_)) {
2282
- const symbolHook_ = ff_compiler_LspHook.SymbolHook(e_.field_, e_.at_, e_.at_);
2283
- const noEffect_ = ff_compiler_Unification.Unification_freshUnificationVariable(self_.unification_, e_.at_);
2284
- ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferRecordFieldHook(self_.unification_, environment_, expected_, t_, e_.field_))
2285
- };
2286
2353
  const fieldNames_ = ff_core_List.List_dropFirst(ff_core_String.String_split(name_, 36), 1);
2354
+ if(ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_)) {
2355
+ ff_core_List.List_each(ff_core_List.List_zip(fieldNames_, typeArguments_), ((_1) => {
2356
+ {
2357
+ const fieldName_ = _1.first_;
2358
+ const fieldType_ = _1.second_;
2359
+ if((e_.field_ === fieldName_)) {
2360
+ const definedAt_ = ff_compiler_Unification.Unification_substitute(self_.unification_, fieldType_).at_;
2361
+ if((ff_compiler_LspHook.LspHook_isAt(self_.lspHook_, e_.at_) || ff_compiler_LspHook.LspHook_isDefinedAt(self_.lspHook_, definedAt_))) {
2362
+ ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.InferRecordFieldHook(e_.at_, self_.unification_, environment_, expected_, t_, e_.field_))
2363
+ }
2364
+ }
2365
+ return
2366
+ }
2367
+ }))
2368
+ };
2287
2369
  return ff_core_Option.Option_else(ff_core_Option.Option_elseIf(ff_core_Option.Option_map(ff_core_Option.Option_map(ff_core_List.List_find(ff_core_List.List_pairs(fieldNames_), ((_w1) => {
2288
2370
  return (_w1.second_ === e_.field_)
2289
2371
  })), ((_w1) => {
@@ -2622,7 +2704,11 @@ return term_
2622
2704
  const call_ = (((_1) => {
2623
2705
  if(_1.DynamicCall) {
2624
2706
  const call_ = _1;
2625
- return call_
2707
+ return {
2708
+ function_: call_.function_,
2709
+ tailCall_: call_.tailCall_
2710
+ }
2711
+ return
2626
2712
  }
2627
2713
  if(_1.StaticCall) {
2628
2714
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in the Inference phase")
@@ -2858,19 +2944,14 @@ return newValue_
2858
2944
  }
2859
2945
 
2860
2946
  export async function Inference_inferMethodCall$(self_, environment_, expected_, signature_, instantiation_, term_, record_, recordType_, name_, $task) {
2861
- const e_ = (((_1) => {
2947
+ {
2948
+ const _1 = term_;
2862
2949
  if(_1.ECall) {
2863
2950
  const e_ = _1;
2864
- return e_
2865
- }
2866
- {
2867
- return ff_compiler_Inference.fail_(term_.at_, "Call expected")
2868
- }
2869
- }))(term_);
2870
- const call_ = (((_1) => {
2951
+ const tailCall_ = (((_1) => {
2871
2952
  if(_1.DynamicCall) {
2872
2953
  const call_ = _1;
2873
- return call_
2954
+ return call_.tailCall_
2874
2955
  }
2875
2956
  if(_1.StaticCall) {
2876
2957
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferMethodCall")
@@ -2886,28 +2967,29 @@ ff_compiler_Unification.Unification_affect(self_.unification_, term_.at_, signat
2886
2967
  const _1 = e_;
2887
2968
  {
2888
2969
  const _c = _1;
2889
- return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, call_.tailCall_, false), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
2970
+ return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, tailCall_, false), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
2890
2971
  return _w1.second_
2891
2972
  })), [selfArgument_, ...arguments_], _c.dictionaries_)
2892
2973
  return
2893
2974
  }
2894
2975
  }
2976
+ return
2977
+ }
2978
+ {
2979
+ return ff_compiler_Inference.fail_(term_.at_, "Call expected")
2980
+ }
2981
+ }
2895
2982
  }
2896
2983
 
2897
2984
  export async function Inference_inferFunctionCall$(self_, environment_, expected_, signature_, instanceCall_, instantiation_, term_, name_, $task) {
2898
- const e_ = (((_1) => {
2985
+ {
2986
+ const _1 = term_;
2899
2987
  if(_1.ECall) {
2900
2988
  const e_ = _1;
2901
- return e_
2902
- }
2903
- {
2904
- return ff_compiler_Inference.fail_(term_.at_, "Call expected")
2905
- }
2906
- }))(term_);
2907
- const call_ = (((_1) => {
2989
+ const tailCall_ = (((_1) => {
2908
2990
  if(_1.DynamicCall) {
2909
2991
  const call_ = _1;
2910
- return call_
2992
+ return call_.tailCall_
2911
2993
  }
2912
2994
  if(_1.StaticCall) {
2913
2995
  return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferFunctionCall")
@@ -2920,29 +3002,34 @@ ff_compiler_Unification.Unification_affect(self_.unification_, term_.at_, signat
2920
3002
  const _1 = e_;
2921
3003
  {
2922
3004
  const _c = _1;
2923
- return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, call_.tailCall_, instanceCall_), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
3005
+ return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, tailCall_, instanceCall_), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
2924
3006
  return _w1.second_
2925
3007
  })), arguments_, _c.dictionaries_)
2926
3008
  return
2927
3009
  }
2928
3010
  }
3011
+ return
3012
+ }
3013
+ {
3014
+ return ff_compiler_Inference.fail_(term_.at_, "Call expected")
3015
+ }
3016
+ }
2929
3017
  }
2930
3018
 
2931
3019
  export async function Inference_inferLambdaCall$(self_, environment_, expected_, term_, $task) {
2932
- const e_ = (((_1) => {
3020
+ {
3021
+ const _1 = term_;
2933
3022
  if(_1.ECall) {
2934
3023
  const e_ = _1;
2935
- return e_
2936
- }
2937
- {
2938
- return ff_compiler_Inference.fail_(term_.at_, "Call expected")
2939
- }
2940
- }))(term_);
2941
3024
  const call_ = (((_1) => {
2942
3025
  if(_1.DynamicCall) {
2943
3026
  const call_ = _1;
2944
3027
  if((!call_.tailCall_)) {
2945
- return call_
3028
+ return {
3029
+ function_: call_.function_,
3030
+ tailCall_: call_.tailCall_
3031
+ }
3032
+ return
2946
3033
  }
2947
3034
  }
2948
3035
  if(_1.DynamicCall) {
@@ -2989,18 +3076,19 @@ return ff_compiler_Syntax.DynamicCall(function_, _c.tailCall_)
2989
3076
  return
2990
3077
  }
2991
3078
  }
3079
+ return
3080
+ }
3081
+ {
3082
+ return ff_compiler_Inference.fail_(term_.at_, "Call expected")
3083
+ }
3084
+ }
2992
3085
  }
2993
3086
 
2994
3087
  export async function Inference_inferOperator$(self_, environment_, expected_, operator_, term_, $task) {
2995
- const e_ = (((_1) => {
3088
+ {
3089
+ const _1 = term_;
2996
3090
  if(_1.ECall) {
2997
3091
  const e_ = _1;
2998
- return e_
2999
- }
3000
- {
3001
- return ff_compiler_Inference.fail_(term_.at_, "Call expected")
3002
- }
3003
- }))(term_);
3004
3092
  const target_ = ff_compiler_Syntax.StaticCall(operator_, false, false);
3005
3093
  {
3006
3094
  const _1 = e_.arguments_;
@@ -3214,6 +3302,12 @@ return term_
3214
3302
  return ff_compiler_Inference.fail_(e_.at_, ("Unknown operator: " + operator_))
3215
3303
  }
3216
3304
  }
3305
+ return
3306
+ }
3307
+ {
3308
+ return ff_compiler_Inference.fail_(term_.at_, "Call expected")
3309
+ }
3310
+ }
3217
3311
  }
3218
3312
 
3219
3313
  export async function Inference_inferEtaExpansion$(self_, environment_, expected_, at_, signature_, term_, $task) {
@@ -204,16 +204,17 @@ return t_.name_
204
204
  }
205
205
 
206
206
  export function firstTypeName_(types_) {
207
- return (((_1) => {
207
+ {
208
+ const _1 = ff_core_List.List_grabFirst(types_);
208
209
  if(_1.TConstructor) {
209
210
  const t_ = _1;
210
- return t_
211
+ return t_.name_
211
212
  }
212
213
  if(_1.TVariable) {
213
214
  const t_ = _1;
214
215
  return ff_compiler_JsEmitter.fail_(t_.at_, " is still a unification variable")
215
216
  }
216
- }))(ff_core_List.List_grabFirst(types_)).name_
217
+ }
217
218
  }
218
219
 
219
220
  export function makeDictionaryName_(traitName_, typeName_) {
@@ -347,16 +348,17 @@ return t_.name_
347
348
  }
348
349
 
349
350
  export async function firstTypeName_$(types_, $task) {
350
- return (((_1) => {
351
+ {
352
+ const _1 = ff_core_List.List_grabFirst(types_);
351
353
  if(_1.TConstructor) {
352
354
  const t_ = _1;
353
- return t_
355
+ return t_.name_
354
356
  }
355
357
  if(_1.TVariable) {
356
358
  const t_ = _1;
357
359
  return ff_compiler_JsEmitter.fail_(t_.at_, " is still a unification variable")
358
360
  }
359
- }))(ff_core_List.List_grabFirst(types_)).name_
361
+ }
360
362
  }
361
363
 
362
364
  export async function makeDictionaryName_$(traitName_, typeName_, $task) {
@@ -199,8 +199,8 @@ return {InferArgumentHook: true, unification_, environment_, isCopy_, callAt_, c
199
199
  export function InferLookupHook(unification_, environment_, expected_, selfVariable_, symbol_, instantiated_) {
200
200
  return {InferLookupHook: true, unification_, environment_, expected_, selfVariable_, symbol_, instantiated_};
201
201
  }
202
- export function InferRecordFieldHook(unification_, environment_, expected_, recordType_, fieldName_) {
203
- return {InferRecordFieldHook: true, unification_, environment_, expected_, recordType_, fieldName_};
202
+ export function InferRecordFieldHook(usageAt_, unification_, environment_, expected_, recordType_, fieldName_) {
203
+ return {InferRecordFieldHook: true, usageAt_, unification_, environment_, expected_, recordType_, fieldName_};
204
204
  }
205
205
 
206
206
 
@@ -271,6 +271,7 @@ const pattern_ = hook_a.pattern_;
271
271
  return "InferPatternHook(...)"
272
272
  }
273
273
  if(hook_a.InferRecordFieldHook) {
274
+ const usageAt_ = hook_a.usageAt_;
274
275
  const unification_ = hook_a.unification_;
275
276
  const environment_ = hook_a.environment_;
276
277
  const expected_ = hook_a.expected_;
@@ -406,6 +407,7 @@ const pattern_ = hook_a.pattern_;
406
407
  return "InferPatternHook(...)"
407
408
  }
408
409
  if(hook_a.InferRecordFieldHook) {
410
+ const usageAt_ = hook_a.usageAt_;
409
411
  const unification_ = hook_a.unification_;
410
412
  const environment_ = hook_a.environment_;
411
413
  const expected_ = hook_a.expected_;
@@ -184,7 +184,10 @@ const resolvedDependencies_ = ff_compiler_Dependencies.process_(ff_core_NodeSyst
184
184
  ff_compiler_Main.prepareFireflyDirectory_(ff_core_NodeSystem.NodeSystem_path(system_, "."));
185
185
  const localMainFile_ = ff_core_Path.Path_base(ff_core_NodeSystem.NodeSystem_path(system_, mainFile_));
186
186
  buildScript_(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitNode(), resolvedDependencies_);
187
- ff_compiler_Main.importAndRun_(fireflyPath_, "node", resolvedDependencies_.mainPackagePair_, localMainFile_, arguments_)
187
+ if((!ff_compiler_Main.importAndRun_(fireflyPath_, "node", resolvedDependencies_.mainPackagePair_, localMainFile_, arguments_))) {
188
+ const at_ = ff_compiler_Syntax.Location(ff_core_Path.Path_absolute(ff_core_NodeSystem.NodeSystem_path(system_, (mainFile_ + ".ff"))), 1, 1);
189
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "This module does not contain a 'nodeMain' function"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
190
+ }
188
191
  return
189
192
  }
190
193
  if(command_a.BrowserCommand) {
@@ -211,7 +214,7 @@ if(command_a.CheckCommand) {
211
214
  const filePath_ = command_a.filePath_;
212
215
  const errors_ = ff_compiler_Builder.check_(system_, fireflyPath_, ff_core_NodeSystem.NodeSystem_path(system_, filePath_), ff_core_Option.None(), ff_core_Map.empty_(), ff_compiler_LspHook.disabled_(), true);
213
216
  if((!ff_core_List.List_isEmpty(errors_))) {
214
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors(errors_), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
217
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors(ff_core_List.List_distinct(errors_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_CompileError)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
215
218
  }
216
219
  return
217
220
  }
@@ -428,7 +431,10 @@ const resolvedDependencies_ = (await ff_compiler_Dependencies.process_$((await f
428
431
  (await ff_compiler_Main.prepareFireflyDirectory_$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task)), $task));
429
432
  const localMainFile_ = (await ff_core_Path.Path_base$((await ff_core_NodeSystem.NodeSystem_path$(system_, mainFile_, $task)), $task));
430
433
  (await buildScript_$(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitNode(), resolvedDependencies_, $task));
431
- (await ff_compiler_Main.importAndRun_$(fireflyPath_, "node", resolvedDependencies_.mainPackagePair_, localMainFile_, arguments_, $task))
434
+ if((!(await ff_compiler_Main.importAndRun_$(fireflyPath_, "node", resolvedDependencies_.mainPackagePair_, localMainFile_, arguments_, $task)))) {
435
+ const at_ = ff_compiler_Syntax.Location((await ff_core_Path.Path_absolute$((await ff_core_NodeSystem.NodeSystem_path$(system_, (mainFile_ + ".ff"), $task)), $task)), 1, 1);
436
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "This module does not contain a 'nodeMain' function"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
437
+ }
432
438
  return
433
439
  }
434
440
  if(command_a.BrowserCommand) {
@@ -455,7 +461,7 @@ if(command_a.CheckCommand) {
455
461
  const filePath_ = command_a.filePath_;
456
462
  const errors_ = (await ff_compiler_Builder.check_$(system_, fireflyPath_, (await ff_core_NodeSystem.NodeSystem_path$(system_, filePath_, $task)), ff_core_Option.None(), ff_core_Map.empty_(), ff_compiler_LspHook.disabled_(), true, $task));
457
463
  if((!ff_core_List.List_isEmpty(errors_))) {
458
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors(errors_), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
464
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors(ff_core_List.List_distinct(errors_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_CompileError)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
459
465
  }
460
466
  return
461
467
  }
@@ -626,7 +632,12 @@ export async function importAndRun_$(fireflyPath_, target_, packagePair_, mainFi
626
632
  const workingDirectory = cwd.indexOf(':') == 1 ? 'file:///' + cwd : cwd;
627
633
  const packagePath = packagePair_.group_ + "/" + packagePair_.name_
628
634
  const main = await import(workingDirectory + "/.firefly/output/" + target_ + "/" + packagePath + "/" + mainFile_ + ".mjs");
629
- await main.$run$(fireflyPath_, arguments_)
635
+ if(typeof main.$run$ !== 'undefined') {
636
+ await main.$run$(fireflyPath_, arguments_);
637
+ return true;
638
+ } else {
639
+ return false;
640
+ }
630
641
 
631
642
  }
632
643
 
@@ -215,8 +215,8 @@ return convertPattern_(pattern_)
215
215
  }))), ((_1) => {
216
216
  if(_1.second_.Some) {
217
217
  const i_ = _1.first_;
218
- const p_ = _1.second_.value_;
219
- return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
218
+ const info_ = _1.second_.value_;
219
+ return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), info_))
220
220
  }
221
221
  {
222
222
  return ff_core_Option.None()
@@ -385,8 +385,8 @@ return convertPattern_(pattern_)
385
385
  }))), ((_1) => {
386
386
  if(_1.second_.Some) {
387
387
  const i_ = _1.first_;
388
- const p_ = _1.second_.value_;
389
- return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
388
+ const info_ = _1.second_.value_;
389
+ return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), info_))
390
390
  }
391
391
  {
392
392
  return ff_core_Option.None()