firefly-compiler 0.5.12 → 0.5.13
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
CHANGED
|
@@ -385,7 +385,7 @@ extend self: JsEmitter {
|
|
|
385
385
|
let call = functionCode + "(" + [...emittedArguments, ...ds, ...controller].join(", ") + ")"
|
|
386
386
|
if(await) {"(await " + call + ")"} else {call}
|
|
387
387
|
| [Pair(EVariant(_, "ff:core/Bool.True", _, _), elseBody), ...list] =>
|
|
388
|
-
"(" + list.foldLeft(self.
|
|
388
|
+
"(" + list.foldLeft(self.emitComma(elseBody, async)) {| otherwise, Pair(condition, body) =>
|
|
389
389
|
self.emitComma(condition, async) +
|
|
390
390
|
"\n? " + self.emitComma(body, async) + "\n: " + otherwise
|
|
391
391
|
} + ")"
|
|
@@ -202,10 +202,7 @@ const packageDirectory_ = ((ff_core_Path.Path_extension(path_) === ".ff")
|
|
|
202
202
|
const sharedPackageFile_ = ff_core_Path.Path_slash(ff_core_Path.Path_slash(packageDirectory_, ".firefly"), "package.ff");
|
|
203
203
|
const packageFile_ = (ff_core_Path.Path_exists(sharedPackageFile_, false, false, false)
|
|
204
204
|
? sharedPackageFile_
|
|
205
|
-
: (
|
|
206
|
-
self_.singleFilePackages_ = ff_core_Set.Set_add(self_.singleFilePackages_, packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
|
|
207
|
-
return path_
|
|
208
|
-
})());
|
|
205
|
+
: (self_.singleFilePackages_ = ff_core_Set.Set_add(self_.singleFilePackages_, packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), path_));
|
|
209
206
|
const code_ = ff_core_Path.Path_readText(packageFile_);
|
|
210
207
|
return ff_compiler_Dependencies.Dependencies_parsePackageFile(self_, packagePair_, ff_core_Path.Path_relativeTo(packageFile_, path_), code_)
|
|
211
208
|
}
|
|
@@ -307,10 +304,7 @@ const packageDirectory_ = (((await ff_core_Path.Path_extension$(path_, $task)) =
|
|
|
307
304
|
const sharedPackageFile_ = (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(packageDirectory_, ".firefly", $task)), "package.ff", $task));
|
|
308
305
|
const packageFile_ = ((await ff_core_Path.Path_exists$(sharedPackageFile_, false, false, false, $task))
|
|
309
306
|
? sharedPackageFile_
|
|
310
|
-
: (
|
|
311
|
-
self_.singleFilePackages_ = ff_core_Set.Set_add(self_.singleFilePackages_, packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
|
|
312
|
-
return path_
|
|
313
|
-
})()));
|
|
307
|
+
: (self_.singleFilePackages_ = ff_core_Set.Set_add(self_.singleFilePackages_, packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), path_));
|
|
314
308
|
const code_ = (await ff_core_Path.Path_readText$(packageFile_, $task));
|
|
315
309
|
return (await ff_compiler_Dependencies.Dependencies_parsePackageFile$(self_, packagePair_, (await ff_core_Path.Path_relativeTo$(packageFile_, path_, $task)), code_, $task))
|
|
316
310
|
}
|
|
@@ -1213,7 +1213,7 @@ return
|
|
|
1213
1213
|
if(_1.length >= 1 && _1[0].first_.EVariant && _1[0].first_.name_ === "ff:core/Bool.True") {
|
|
1214
1214
|
const elseBody_ = _1[0].second_;
|
|
1215
1215
|
const list_ = _1.slice(1);
|
|
1216
|
-
return (("(" + ff_core_List.List_foldLeft(list_, ff_compiler_JsEmitter.
|
|
1216
|
+
return (("(" + ff_core_List.List_foldLeft(list_, ff_compiler_JsEmitter.JsEmitter_emitComma(self_, elseBody_, async_), ((_1, _2) => {
|
|
1217
1217
|
{
|
|
1218
1218
|
const otherwise_ = _1;
|
|
1219
1219
|
const condition_ = _2.first_;
|
|
@@ -3166,7 +3166,7 @@ return
|
|
|
3166
3166
|
if(_1.length >= 1 && _1[0].first_.EVariant && _1[0].first_.name_ === "ff:core/Bool.True") {
|
|
3167
3167
|
const elseBody_ = _1[0].second_;
|
|
3168
3168
|
const list_ = _1.slice(1);
|
|
3169
|
-
return (("(" + (await ff_core_List.List_foldLeft$(list_, (await ff_compiler_JsEmitter.
|
|
3169
|
+
return (("(" + (await ff_core_List.List_foldLeft$(list_, (await ff_compiler_JsEmitter.JsEmitter_emitComma$(self_, elseBody_, async_, $task)), (async (_1, _2, $task) => {
|
|
3170
3170
|
{
|
|
3171
3171
|
const otherwise_ = _1;
|
|
3172
3172
|
const condition_ = _2.first_;
|
|
@@ -1010,10 +1010,7 @@ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
|
1010
1010
|
const parameterType_ = ff_compiler_Parser.Parser_parseType(self_);
|
|
1011
1011
|
const default_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign()))
|
|
1012
1012
|
? ff_core_Option.None()
|
|
1013
|
-
: (
|
|
1014
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
|
|
1015
|
-
return ff_core_Option.Some(ff_compiler_Parser.Parser_parseTerm(self_))
|
|
1016
|
-
})());
|
|
1013
|
+
: (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign()), ff_core_Option.Some(ff_compiler_Parser.Parser_parseTerm(self_))));
|
|
1017
1014
|
parameters_.array.push(ff_compiler_Syntax.Parameter(ff_compiler_Token.Token_at(parameterNameToken_), mutable_, ff_compiler_Token.Token_raw(parameterNameToken_), parameterType_, default_));
|
|
1018
1015
|
if(lspTrackSymbols_) {
|
|
1019
1016
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(parameterNameToken_), ff_compiler_LspHook.SParameter(), ff_compiler_Token.Token_at(parameterNameToken_), ff_compiler_Token.Token_end(parameterNameToken_), ff_compiler_Token.Token_at(lspFirst_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
|
|
@@ -1175,10 +1172,7 @@ const guardToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LBra
|
|
|
1175
1172
|
const term_ = ff_compiler_Parser.Parser_parseStatements(self_);
|
|
1176
1173
|
const p_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe()))
|
|
1177
1174
|
? ff_compiler_Syntax.PVariant(ff_compiler_Token.Token_at(guardToken_), "True", [])
|
|
1178
|
-
: (
|
|
1179
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LPipe());
|
|
1180
|
-
return ff_compiler_Parser.Parser_parsePattern(self_)
|
|
1181
|
-
})());
|
|
1175
|
+
: (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LPipe()), ff_compiler_Parser.Parser_parsePattern(self_)));
|
|
1182
1176
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LBracketRight());
|
|
1183
1177
|
return ff_compiler_Syntax.MatchGuard(ff_compiler_Token.Token_at(guardToken_), term_, p_)
|
|
1184
1178
|
}
|
|
@@ -1372,10 +1366,7 @@ const keywordToken_ = (mutable_
|
|
|
1372
1366
|
const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
|
|
1373
1367
|
const valueType_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon()))
|
|
1374
1368
|
? ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(nameToken_))
|
|
1375
|
-
: (
|
|
1376
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
1377
|
-
return ff_compiler_Parser.Parser_parseType(self_)
|
|
1378
|
-
})());
|
|
1369
|
+
: (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon()), ff_compiler_Parser.Parser_parseType(self_)));
|
|
1379
1370
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign())))) {
|
|
1380
1371
|
const unit_ = ff_compiler_Syntax.EVariant(ff_compiler_Token.Token_at(keywordToken_), "Unit", [], ff_core_Option.None());
|
|
1381
1372
|
return ff_compiler_Syntax.ELet(ff_compiler_Token.Token_at(nameToken_), mutable_, ff_compiler_Token.Token_raw(nameToken_), valueType_, unit_, unit_)
|
|
@@ -1593,10 +1584,7 @@ const method_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(se
|
|
|
1593
1584
|
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign()), "set")
|
|
1594
1585
|
: ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssignPlus())
|
|
1595
1586
|
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignPlus()), "increment")
|
|
1596
|
-
: (
|
|
1597
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignMinus());
|
|
1598
|
-
return "decrement"
|
|
1599
|
-
})());
|
|
1587
|
+
: (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignMinus()), "decrement"));
|
|
1600
1588
|
const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
|
|
1601
1589
|
const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, record_.at_);
|
|
1602
1590
|
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, "set"), false);
|
|
@@ -2604,10 +2592,7 @@ ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
|
2604
2592
|
const parameterType_ = ff_compiler_Parser.Parser_parseType(self_);
|
|
2605
2593
|
const default_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign()))
|
|
2606
2594
|
? ff_core_Option.None()
|
|
2607
|
-
: (
|
|
2608
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign());
|
|
2609
|
-
return ff_core_Option.Some(ff_compiler_Parser.Parser_parseTerm(self_))
|
|
2610
|
-
})()));
|
|
2595
|
+
: (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign()), ff_core_Option.Some(ff_compiler_Parser.Parser_parseTerm(self_))));
|
|
2611
2596
|
parameters_.array.push(ff_compiler_Syntax.Parameter(ff_compiler_Token.Token_at(parameterNameToken_), mutable_, ff_compiler_Token.Token_raw(parameterNameToken_), parameterType_, default_));
|
|
2612
2597
|
if(lspTrackSymbols_) {
|
|
2613
2598
|
ff_compiler_LspHook.LspHook_emit(self_.lspHook_, ff_compiler_LspHook.ParseSymbolEnd(ff_compiler_Token.Token_raw(parameterNameToken_), ff_compiler_LspHook.SParameter(), ff_compiler_Token.Token_at(parameterNameToken_), ff_compiler_Token.Token_end(parameterNameToken_), ff_compiler_Token.Token_at(lspFirst_), ff_compiler_Token.Token_end(ff_compiler_Parser.Parser_behind(self_))))
|
|
@@ -2769,10 +2754,7 @@ const guardToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LBra
|
|
|
2769
2754
|
const term_ = ff_compiler_Parser.Parser_parseStatements(self_);
|
|
2770
2755
|
const p_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LPipe()))
|
|
2771
2756
|
? ff_compiler_Syntax.PVariant(ff_compiler_Token.Token_at(guardToken_), "True", [])
|
|
2772
|
-
: (
|
|
2773
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LPipe());
|
|
2774
|
-
return ff_compiler_Parser.Parser_parsePattern(self_)
|
|
2775
|
-
})()));
|
|
2757
|
+
: (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LPipe()), ff_compiler_Parser.Parser_parsePattern(self_)));
|
|
2776
2758
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LBracketRight());
|
|
2777
2759
|
return ff_compiler_Syntax.MatchGuard(ff_compiler_Token.Token_at(guardToken_), term_, p_)
|
|
2778
2760
|
}
|
|
@@ -2966,10 +2948,7 @@ const keywordToken_ = (mutable_
|
|
|
2966
2948
|
const nameToken_ = ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower());
|
|
2967
2949
|
const valueType_ = ((!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LColon()))
|
|
2968
2950
|
? ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(nameToken_))
|
|
2969
|
-
: (
|
|
2970
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon());
|
|
2971
|
-
return ff_compiler_Parser.Parser_parseType(self_)
|
|
2972
|
-
})()));
|
|
2951
|
+
: (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LColon()), ff_compiler_Parser.Parser_parseType(self_)));
|
|
2973
2952
|
if((ff_compiler_LspHook.LspHook_isEnabled(self_.lspHook_) && (!ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssign())))) {
|
|
2974
2953
|
const unit_ = ff_compiler_Syntax.EVariant(ff_compiler_Token.Token_at(keywordToken_), "Unit", [], ff_core_Option.None());
|
|
2975
2954
|
return ff_compiler_Syntax.ELet(ff_compiler_Token.Token_at(nameToken_), mutable_, ff_compiler_Token.Token_raw(nameToken_), valueType_, unit_, unit_)
|
|
@@ -3187,10 +3166,7 @@ const method_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(se
|
|
|
3187
3166
|
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssign()), "set")
|
|
3188
3167
|
: ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LAssignPlus())
|
|
3189
3168
|
? (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignPlus()), "increment")
|
|
3190
|
-
: (
|
|
3191
|
-
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignMinus());
|
|
3192
|
-
return "decrement"
|
|
3193
|
-
})()));
|
|
3169
|
+
: (ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LAssignMinus()), "decrement"));
|
|
3194
3170
|
const value_ = ff_compiler_Parser.Parser_parseTerm(self_);
|
|
3195
3171
|
const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, record_.at_);
|
|
3196
3172
|
const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, "set"), false);
|
|
@@ -414,10 +414,7 @@ for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++)
|
|
|
414
414
|
const x_ = for_a[for_i];
|
|
415
415
|
if(!(body_(x_)
|
|
416
416
|
? (result_ = ff_core_Option.Some(i_), false)
|
|
417
|
-
: (
|
|
418
|
-
i_ += 1;
|
|
419
|
-
return true
|
|
420
|
-
})())) break
|
|
417
|
+
: (i_ += 1, true))) break
|
|
421
418
|
};
|
|
422
419
|
return result_
|
|
423
420
|
}
|
|
@@ -777,10 +774,7 @@ for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++)
|
|
|
777
774
|
const x_ = for_a[for_i];
|
|
778
775
|
if(!((await body_(x_, $task))
|
|
779
776
|
? (result_ = ff_core_Option.Some(i_), false)
|
|
780
|
-
: (
|
|
781
|
-
i_ += 1;
|
|
782
|
-
return true
|
|
783
|
-
})()))) break
|
|
777
|
+
: (i_ += 1, true))) break
|
|
784
778
|
};
|
|
785
779
|
return result_
|
|
786
780
|
}
|
package/package.json
CHANGED