firefly-compiler 0.5.5 → 0.5.6

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.
@@ -1172,9 +1172,9 @@ extend self: Parser {
1172
1172
  let method = if(token.rawIs("!")) {"ff:core/UnsafeJs.value"} else {"ff:core/UnsafeJs.fromValue"}
1173
1173
  let target = DynamicCall(EVariable(token.at(), method), False)
1174
1174
  let effect = self.freshUnificationVariable(token.at())
1175
- result = self.parseDynamicMember(ECall(token.at(), target, effect, [], [
1175
+ result = ECall(token.at(), target, effect, [], [
1176
1176
  Argument(result.at, None, result)
1177
- ], []))
1177
+ ], [])
1178
1178
  } else {
1179
1179
  let at = self.current().at()
1180
1180
  let typeArguments = if(!self.current().rawIs("[")) {[]} else {self.parseTypeArguments()}
package/core/List.ff CHANGED
@@ -308,6 +308,19 @@ extend self[T]: List[T] {
308
308
  return result;
309
309
  """
310
310
 
311
+ map2[S](body: T => S): List[S] {
312
+ if(!UnsafeJs.inAsync()) {
313
+ self!->map(body!)?
314
+ } else {
315
+ let result = Array.new()
316
+ 0.until(self.size()).each {i =>
317
+ result.push(body(self.grab(i)))
318
+ }
319
+ result.drain()
320
+ }
321
+ }
322
+
323
+
311
324
  flatMap[S](body: T => List[S]): List[S] {
312
325
  let results = Array.new()
313
326
  self.each {x =>
@@ -1529,7 +1529,7 @@ const method_ = (ff_compiler_Token.Token_rawIs(token_, "!")
1529
1529
  : "ff:core/UnsafeJs.fromValue");
1530
1530
  const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), method_), false);
1531
1531
  const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(token_));
1532
- result_ = ff_compiler_Parser.Parser_parseDynamicMember(self_, ff_compiler_Syntax.ECall(ff_compiler_Token.Token_at(token_), target_, effect_, [], [ff_compiler_Syntax.Argument(result_.at_, ff_core_Option.None(), result_)], []))
1532
+ result_ = ff_compiler_Syntax.ECall(ff_compiler_Token.Token_at(token_), target_, effect_, [], [ff_compiler_Syntax.Argument(result_.at_, ff_core_Option.None(), result_)], [])
1533
1533
  } else {
1534
1534
  const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
1535
1535
  const typeArguments_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
@@ -3147,7 +3147,7 @@ const method_ = (ff_compiler_Token.Token_rawIs(token_, "!")
3147
3147
  : "ff:core/UnsafeJs.fromValue");
3148
3148
  const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EVariable(ff_compiler_Token.Token_at(token_), method_), false);
3149
3149
  const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, ff_compiler_Token.Token_at(token_));
3150
- result_ = ff_compiler_Parser.Parser_parseDynamicMember(self_, ff_compiler_Syntax.ECall(ff_compiler_Token.Token_at(token_), target_, effect_, [], [ff_compiler_Syntax.Argument(result_.at_, ff_core_Option.None(), result_)], []))
3150
+ result_ = ff_compiler_Syntax.ECall(ff_compiler_Token.Token_at(token_), target_, effect_, [], [ff_compiler_Syntax.Argument(result_.at_, ff_core_Option.None(), result_)], [])
3151
3151
  } else {
3152
3152
  const at_ = ff_compiler_Token.Token_at(ff_compiler_Parser.Parser_current(self_));
3153
3153
  const typeArguments_ = ((!ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "["))
@@ -453,6 +453,18 @@ export function List_map(self_, body_) {
453
453
 
454
454
  }
455
455
 
456
+ export function List_map2(self_, body_) {
457
+ if((!false)) {
458
+ return ff_core_JsValue.JsValue_call1(self_, "map", body_, ff_core_JsValue.ff_core_JsValue_IsJsValue$ff_core_JsValue_JsValue)
459
+ } else {
460
+ const result_ = ff_core_Array.new_();
461
+ ff_core_List.List_each(ff_core_Int.Int_until(0, ff_core_List.List_size(self_)), ((i_) => {
462
+ ff_core_Array.Array_push(result_, body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_))))
463
+ }));
464
+ return ff_core_Array.Array_drain(result_)
465
+ }
466
+ }
467
+
456
468
  export function List_flatMap(self_, body_) {
457
469
  const results_ = ff_core_Array.new_();
458
470
  ff_core_List.List_each(self_, ((x_) => {
@@ -815,6 +827,18 @@ export async function List_map$(self_, body_, $task) {
815
827
 
816
828
  }
817
829
 
830
+ export async function List_map2$(self_, body_, $task) {
831
+ if((!true)) {
832
+ return ff_core_JsValue.JsValue_call1(self_, "map", body_, ff_core_JsValue.ff_core_JsValue_IsJsValue$ff_core_JsValue_JsValue)
833
+ } else {
834
+ const result_ = ff_core_Array.new_();
835
+ (await ff_core_List.List_each$(ff_core_Int.Int_until(0, ff_core_List.List_size(self_)), (async (i_, $task) => {
836
+ ff_core_Array.Array_push(result_, (await body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), $task)))
837
+ }), $task));
838
+ return ff_core_Array.Array_drain(result_)
839
+ }
840
+ }
841
+
818
842
  export async function List_flatMap$(self_, body_, $task) {
819
843
  const results_ = ff_core_Array.new_();
820
844
  (await ff_core_List.List_each$(self_, (async (x_, $task) => {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly compiler",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.5.5",
7
+ "version": "0.5.6",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly language support",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.5.5",
7
+ "version": "0.5.6",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"