firefly-compiler 0.4.21 → 0.4.22
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/Dictionaries.ff +10 -10
- package/compiler/Inference.ff +167 -148
- package/compiler/JsEmitter.ff +2 -2
- package/compiler/LspHook.ff +2 -1
- package/compiler/Main.ff +12 -4
- package/compiler/Patterns.ff +1 -1
- package/compiler/Resolver.ff +154 -146
- package/compiler/Substitution.ff +2 -2
- package/compiler/Unification.ff +1 -1
- package/core/Map.ff +8 -0
- package/core/Set.ff +7 -0
- package/lsp/Handler.ff +11 -3
- package/output/js/ff/compiler/Dictionaries.mjs +18 -18
- package/output/js/ff/compiler/Inference.mjs +96 -72
- package/output/js/ff/compiler/JsEmitter.mjs +8 -6
- package/output/js/ff/compiler/Main.mjs +16 -5
- package/output/js/ff/compiler/Patterns.mjs +4 -4
- package/output/js/ff/compiler/Resolver.mjs +412 -224
- package/output/js/ff/compiler/Substitution.mjs +4 -4
- package/output/js/ff/compiler/Unification.mjs +4 -4
- package/output/js/ff/core/Map.mjs +26 -0
- package/output/js/ff/core/Set.mjs +16 -0
- package/package.json +1 -1
- package/vscode/package.json +1 -1
- package/bin/firefly.mjs +0 -2
- package/guide/Main.ff +0 -22
|
@@ -994,7 +994,11 @@ return term_
|
|
|
994
994
|
const call_ = (((_1) => {
|
|
995
995
|
if(_1.DynamicCall) {
|
|
996
996
|
const call_ = _1;
|
|
997
|
-
return
|
|
997
|
+
return {
|
|
998
|
+
function_: call_.function_,
|
|
999
|
+
tailCall_: call_.tailCall_
|
|
1000
|
+
}
|
|
1001
|
+
return
|
|
998
1002
|
}
|
|
999
1003
|
if(_1.StaticCall) {
|
|
1000
1004
|
return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in the Inference phase")
|
|
@@ -1230,19 +1234,14 @@ return newValue_
|
|
|
1230
1234
|
}
|
|
1231
1235
|
|
|
1232
1236
|
export function Inference_inferMethodCall(self_, environment_, expected_, signature_, instantiation_, term_, record_, recordType_, name_) {
|
|
1233
|
-
|
|
1237
|
+
{
|
|
1238
|
+
const _1 = term_;
|
|
1234
1239
|
if(_1.ECall) {
|
|
1235
1240
|
const e_ = _1;
|
|
1236
|
-
|
|
1237
|
-
}
|
|
1238
|
-
{
|
|
1239
|
-
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
1240
|
-
}
|
|
1241
|
-
}))(term_);
|
|
1242
|
-
const call_ = (((_1) => {
|
|
1241
|
+
const tailCall_ = (((_1) => {
|
|
1243
1242
|
if(_1.DynamicCall) {
|
|
1244
1243
|
const call_ = _1;
|
|
1245
|
-
return call_
|
|
1244
|
+
return call_.tailCall_
|
|
1246
1245
|
}
|
|
1247
1246
|
if(_1.StaticCall) {
|
|
1248
1247
|
return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferMethodCall")
|
|
@@ -1258,28 +1257,29 @@ ff_compiler_Unification.Unification_affect(self_.unification_, term_.at_, signat
|
|
|
1258
1257
|
const _1 = e_;
|
|
1259
1258
|
{
|
|
1260
1259
|
const _c = _1;
|
|
1261
|
-
return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_,
|
|
1260
|
+
return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, tailCall_, false), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
|
|
1262
1261
|
return _w1.second_
|
|
1263
1262
|
})), [selfArgument_, ...arguments_], _c.dictionaries_)
|
|
1264
1263
|
return
|
|
1265
1264
|
}
|
|
1266
1265
|
}
|
|
1266
|
+
return
|
|
1267
|
+
}
|
|
1268
|
+
{
|
|
1269
|
+
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1267
1272
|
}
|
|
1268
1273
|
|
|
1269
1274
|
export function Inference_inferFunctionCall(self_, environment_, expected_, signature_, instanceCall_, instantiation_, term_, name_) {
|
|
1270
|
-
|
|
1275
|
+
{
|
|
1276
|
+
const _1 = term_;
|
|
1271
1277
|
if(_1.ECall) {
|
|
1272
1278
|
const e_ = _1;
|
|
1273
|
-
|
|
1274
|
-
}
|
|
1275
|
-
{
|
|
1276
|
-
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
1277
|
-
}
|
|
1278
|
-
}))(term_);
|
|
1279
|
-
const call_ = (((_1) => {
|
|
1279
|
+
const tailCall_ = (((_1) => {
|
|
1280
1280
|
if(_1.DynamicCall) {
|
|
1281
1281
|
const call_ = _1;
|
|
1282
|
-
return call_
|
|
1282
|
+
return call_.tailCall_
|
|
1283
1283
|
}
|
|
1284
1284
|
if(_1.StaticCall) {
|
|
1285
1285
|
return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferFunctionCall")
|
|
@@ -1292,29 +1292,34 @@ ff_compiler_Unification.Unification_affect(self_.unification_, term_.at_, signat
|
|
|
1292
1292
|
const _1 = e_;
|
|
1293
1293
|
{
|
|
1294
1294
|
const _c = _1;
|
|
1295
|
-
return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_,
|
|
1295
|
+
return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, tailCall_, instanceCall_), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
|
|
1296
1296
|
return _w1.second_
|
|
1297
1297
|
})), arguments_, _c.dictionaries_)
|
|
1298
1298
|
return
|
|
1299
1299
|
}
|
|
1300
1300
|
}
|
|
1301
|
+
return
|
|
1302
|
+
}
|
|
1303
|
+
{
|
|
1304
|
+
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1301
1307
|
}
|
|
1302
1308
|
|
|
1303
1309
|
export function Inference_inferLambdaCall(self_, environment_, expected_, term_) {
|
|
1304
|
-
|
|
1310
|
+
{
|
|
1311
|
+
const _1 = term_;
|
|
1305
1312
|
if(_1.ECall) {
|
|
1306
1313
|
const e_ = _1;
|
|
1307
|
-
return e_
|
|
1308
|
-
}
|
|
1309
|
-
{
|
|
1310
|
-
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
1311
|
-
}
|
|
1312
|
-
}))(term_);
|
|
1313
1314
|
const call_ = (((_1) => {
|
|
1314
1315
|
if(_1.DynamicCall) {
|
|
1315
1316
|
const call_ = _1;
|
|
1316
1317
|
if((!call_.tailCall_)) {
|
|
1317
|
-
return
|
|
1318
|
+
return {
|
|
1319
|
+
function_: call_.function_,
|
|
1320
|
+
tailCall_: call_.tailCall_
|
|
1321
|
+
}
|
|
1322
|
+
return
|
|
1318
1323
|
}
|
|
1319
1324
|
}
|
|
1320
1325
|
if(_1.DynamicCall) {
|
|
@@ -1361,18 +1366,19 @@ return ff_compiler_Syntax.DynamicCall(function_, _c.tailCall_)
|
|
|
1361
1366
|
return
|
|
1362
1367
|
}
|
|
1363
1368
|
}
|
|
1369
|
+
return
|
|
1370
|
+
}
|
|
1371
|
+
{
|
|
1372
|
+
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1364
1375
|
}
|
|
1365
1376
|
|
|
1366
1377
|
export function Inference_inferOperator(self_, environment_, expected_, operator_, term_) {
|
|
1367
|
-
|
|
1378
|
+
{
|
|
1379
|
+
const _1 = term_;
|
|
1368
1380
|
if(_1.ECall) {
|
|
1369
1381
|
const e_ = _1;
|
|
1370
|
-
return e_
|
|
1371
|
-
}
|
|
1372
|
-
{
|
|
1373
|
-
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
1374
|
-
}
|
|
1375
|
-
}))(term_);
|
|
1376
1382
|
const target_ = ff_compiler_Syntax.StaticCall(operator_, false, false);
|
|
1377
1383
|
{
|
|
1378
1384
|
const _1 = e_.arguments_;
|
|
@@ -1586,6 +1592,12 @@ return term_
|
|
|
1586
1592
|
return ff_compiler_Inference.fail_(e_.at_, ("Unknown operator: " + operator_))
|
|
1587
1593
|
}
|
|
1588
1594
|
}
|
|
1595
|
+
return
|
|
1596
|
+
}
|
|
1597
|
+
{
|
|
1598
|
+
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1589
1601
|
}
|
|
1590
1602
|
|
|
1591
1603
|
export function Inference_inferEtaExpansion(self_, environment_, expected_, at_, signature_, term_) {
|
|
@@ -2622,7 +2634,11 @@ return term_
|
|
|
2622
2634
|
const call_ = (((_1) => {
|
|
2623
2635
|
if(_1.DynamicCall) {
|
|
2624
2636
|
const call_ = _1;
|
|
2625
|
-
return
|
|
2637
|
+
return {
|
|
2638
|
+
function_: call_.function_,
|
|
2639
|
+
tailCall_: call_.tailCall_
|
|
2640
|
+
}
|
|
2641
|
+
return
|
|
2626
2642
|
}
|
|
2627
2643
|
if(_1.StaticCall) {
|
|
2628
2644
|
return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in the Inference phase")
|
|
@@ -2858,19 +2874,14 @@ return newValue_
|
|
|
2858
2874
|
}
|
|
2859
2875
|
|
|
2860
2876
|
export async function Inference_inferMethodCall$(self_, environment_, expected_, signature_, instantiation_, term_, record_, recordType_, name_, $task) {
|
|
2861
|
-
|
|
2877
|
+
{
|
|
2878
|
+
const _1 = term_;
|
|
2862
2879
|
if(_1.ECall) {
|
|
2863
2880
|
const e_ = _1;
|
|
2864
|
-
|
|
2865
|
-
}
|
|
2866
|
-
{
|
|
2867
|
-
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
2868
|
-
}
|
|
2869
|
-
}))(term_);
|
|
2870
|
-
const call_ = (((_1) => {
|
|
2881
|
+
const tailCall_ = (((_1) => {
|
|
2871
2882
|
if(_1.DynamicCall) {
|
|
2872
2883
|
const call_ = _1;
|
|
2873
|
-
return call_
|
|
2884
|
+
return call_.tailCall_
|
|
2874
2885
|
}
|
|
2875
2886
|
if(_1.StaticCall) {
|
|
2876
2887
|
return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferMethodCall")
|
|
@@ -2886,28 +2897,29 @@ ff_compiler_Unification.Unification_affect(self_.unification_, term_.at_, signat
|
|
|
2886
2897
|
const _1 = e_;
|
|
2887
2898
|
{
|
|
2888
2899
|
const _c = _1;
|
|
2889
|
-
return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_,
|
|
2900
|
+
return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, tailCall_, false), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
|
|
2890
2901
|
return _w1.second_
|
|
2891
2902
|
})), [selfArgument_, ...arguments_], _c.dictionaries_)
|
|
2892
2903
|
return
|
|
2893
2904
|
}
|
|
2894
2905
|
}
|
|
2906
|
+
return
|
|
2907
|
+
}
|
|
2908
|
+
{
|
|
2909
|
+
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2895
2912
|
}
|
|
2896
2913
|
|
|
2897
2914
|
export async function Inference_inferFunctionCall$(self_, environment_, expected_, signature_, instanceCall_, instantiation_, term_, name_, $task) {
|
|
2898
|
-
|
|
2915
|
+
{
|
|
2916
|
+
const _1 = term_;
|
|
2899
2917
|
if(_1.ECall) {
|
|
2900
2918
|
const e_ = _1;
|
|
2901
|
-
|
|
2902
|
-
}
|
|
2903
|
-
{
|
|
2904
|
-
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
2905
|
-
}
|
|
2906
|
-
}))(term_);
|
|
2907
|
-
const call_ = (((_1) => {
|
|
2919
|
+
const tailCall_ = (((_1) => {
|
|
2908
2920
|
if(_1.DynamicCall) {
|
|
2909
2921
|
const call_ = _1;
|
|
2910
|
-
return call_
|
|
2922
|
+
return call_.tailCall_
|
|
2911
2923
|
}
|
|
2912
2924
|
if(_1.StaticCall) {
|
|
2913
2925
|
return ff_compiler_Inference.fail_(e_.at_, "Internal error: Static calls not expected in inferFunctionCall")
|
|
@@ -2920,29 +2932,34 @@ ff_compiler_Unification.Unification_affect(self_.unification_, term_.at_, signat
|
|
|
2920
2932
|
const _1 = e_;
|
|
2921
2933
|
{
|
|
2922
2934
|
const _c = _1;
|
|
2923
|
-
return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_,
|
|
2935
|
+
return ff_compiler_Syntax.ECall(_c.at_, ff_compiler_Syntax.StaticCall(name_, tailCall_, instanceCall_), signature_.effect_, ff_core_List.List_map(instantiation_, ((_w1) => {
|
|
2924
2936
|
return _w1.second_
|
|
2925
2937
|
})), arguments_, _c.dictionaries_)
|
|
2926
2938
|
return
|
|
2927
2939
|
}
|
|
2928
2940
|
}
|
|
2941
|
+
return
|
|
2942
|
+
}
|
|
2943
|
+
{
|
|
2944
|
+
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2929
2947
|
}
|
|
2930
2948
|
|
|
2931
2949
|
export async function Inference_inferLambdaCall$(self_, environment_, expected_, term_, $task) {
|
|
2932
|
-
|
|
2950
|
+
{
|
|
2951
|
+
const _1 = term_;
|
|
2933
2952
|
if(_1.ECall) {
|
|
2934
2953
|
const e_ = _1;
|
|
2935
|
-
return e_
|
|
2936
|
-
}
|
|
2937
|
-
{
|
|
2938
|
-
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
2939
|
-
}
|
|
2940
|
-
}))(term_);
|
|
2941
2954
|
const call_ = (((_1) => {
|
|
2942
2955
|
if(_1.DynamicCall) {
|
|
2943
2956
|
const call_ = _1;
|
|
2944
2957
|
if((!call_.tailCall_)) {
|
|
2945
|
-
return
|
|
2958
|
+
return {
|
|
2959
|
+
function_: call_.function_,
|
|
2960
|
+
tailCall_: call_.tailCall_
|
|
2961
|
+
}
|
|
2962
|
+
return
|
|
2946
2963
|
}
|
|
2947
2964
|
}
|
|
2948
2965
|
if(_1.DynamicCall) {
|
|
@@ -2989,18 +3006,19 @@ return ff_compiler_Syntax.DynamicCall(function_, _c.tailCall_)
|
|
|
2989
3006
|
return
|
|
2990
3007
|
}
|
|
2991
3008
|
}
|
|
3009
|
+
return
|
|
3010
|
+
}
|
|
3011
|
+
{
|
|
3012
|
+
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
2992
3015
|
}
|
|
2993
3016
|
|
|
2994
3017
|
export async function Inference_inferOperator$(self_, environment_, expected_, operator_, term_, $task) {
|
|
2995
|
-
|
|
3018
|
+
{
|
|
3019
|
+
const _1 = term_;
|
|
2996
3020
|
if(_1.ECall) {
|
|
2997
3021
|
const e_ = _1;
|
|
2998
|
-
return e_
|
|
2999
|
-
}
|
|
3000
|
-
{
|
|
3001
|
-
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
3002
|
-
}
|
|
3003
|
-
}))(term_);
|
|
3004
3022
|
const target_ = ff_compiler_Syntax.StaticCall(operator_, false, false);
|
|
3005
3023
|
{
|
|
3006
3024
|
const _1 = e_.arguments_;
|
|
@@ -3214,6 +3232,12 @@ return term_
|
|
|
3214
3232
|
return ff_compiler_Inference.fail_(e_.at_, ("Unknown operator: " + operator_))
|
|
3215
3233
|
}
|
|
3216
3234
|
}
|
|
3235
|
+
return
|
|
3236
|
+
}
|
|
3237
|
+
{
|
|
3238
|
+
return ff_compiler_Inference.fail_(term_.at_, "Call expected")
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3217
3241
|
}
|
|
3218
3242
|
|
|
3219
3243
|
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
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
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
|
-
}
|
|
361
|
+
}
|
|
360
362
|
}
|
|
361
363
|
|
|
362
364
|
export async function makeDictionaryName_$(traitName_, typeName_, $task) {
|
|
@@ -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
|
-
|
|
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
|
|
219
|
-
return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_),
|
|
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
|
|
389
|
-
return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_),
|
|
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()
|