firefly-compiler 0.4.89 → 0.4.91

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.
@@ -1190,22 +1190,22 @@ extend self: Parser {
1190
1190
  let effect = self.freshUnificationVariable(record.at)
1191
1191
  arguments.first.indexWhere {!_.name.isEmpty()}.{
1192
1192
  | None =>
1193
+ let target = DynamicCall(EField(token.at(), False, record, "new" + arguments.first.size()), False)
1194
+ ECall(record.at, target, effect, [], arguments.first, [])
1195
+ | Some(0) =>
1193
1196
  let objectTarget = DynamicCall(EField(token.at(), False, record, "object"), False)
1194
1197
  mutable result = ECall(record.at, objectTarget, effect, [], [], [])
1195
1198
  arguments.first.each {argument =>
1196
1199
  if(argument.name.isEmpty()) {
1197
1200
  throw(CompileError(argument.at, "Expected a named argument"))
1198
1201
  }
1199
- let target = DynamicCall(EField(token.at(), False, record, "with"), False)
1202
+ let target = DynamicCall(EField(token.at(), False, result, "with"), False)
1200
1203
  result = ECall(record.at, target, effect, [], [
1201
1204
  Argument(argument.at, None, EString(argument.at, argument.name.grab()))
1202
- argument
1205
+ Argument(argument.value.at, None, argument.value)
1203
1206
  ], [])
1204
1207
  }
1205
1208
  result
1206
- | Some(0) =>
1207
- let target = DynamicCall(EField(token.at(), False, record, "new" + arguments.first.size()), False)
1208
- ECall(record.at, target, effect, [], arguments.first, [])
1209
1209
  | Some(i) =>
1210
1210
  throw(CompileError(arguments.first.grab(i).at, "Unexpected named argument"))
1211
1211
  }
@@ -1228,6 +1228,9 @@ extend self: Parser {
1228
1228
  let member = EString(token.at(), if(token.is(LString)) {token.raw()} else {"\"" + token.raw() + "\""})
1229
1229
  if(self.current().rawIs("(")) {
1230
1230
  let arguments = self.parseFunctionArguments(record.at, False)
1231
+ arguments.first.find {!_.name.isEmpty()}.each {argument =>
1232
+ throw(CompileError(argument.at, "Unexpected named argument"))
1233
+ }
1231
1234
  let effect = self.freshUnificationVariable(record.at)
1232
1235
  let target = DynamicCall(EField(token.at(), False, record, "call" + arguments.first.size()), False)
1233
1236
  ECall(record.at, target, effect, [], [
@@ -1548,21 +1548,21 @@ const _1 = ff_core_List.List_indexWhere(arguments_.first_, ((_w1) => {
1548
1548
  return (!ff_core_Option.Option_isEmpty(_w1.name_))
1549
1549
  }));
1550
1550
  if(_1.None) {
1551
+ const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("new" + ff_core_List.List_size(arguments_.first_))), false);
1552
+ return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], arguments_.first_, [])
1553
+ }
1554
+ if(_1.Some && _1.value_ === 0) {
1551
1555
  const objectTarget_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, "object"), false);
1552
1556
  let result_ = ff_compiler_Syntax.ECall(record_.at_, objectTarget_, effect_, [], [], []);
1553
1557
  ff_core_List.List_each(arguments_.first_, ((argument_) => {
1554
1558
  if(ff_core_Option.Option_isEmpty(argument_.name_)) {
1555
1559
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(argument_.at_, "Expected a named argument"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1556
1560
  };
1557
- const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, "with"), false);
1558
- result_ = ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(argument_.at_, ff_core_Option.None(), ff_compiler_Syntax.EString(argument_.at_, ff_core_Option.Option_grab(argument_.name_))), argument_], [])
1561
+ const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, result_, "with"), false);
1562
+ result_ = ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(argument_.at_, ff_core_Option.None(), ff_compiler_Syntax.EString(argument_.at_, ff_core_Option.Option_grab(argument_.name_))), ff_compiler_Syntax.Argument(argument_.value_.at_, ff_core_Option.None(), argument_.value_)], [])
1559
1563
  }));
1560
1564
  return result_
1561
1565
  }
1562
- if(_1.Some && _1.value_ === 0) {
1563
- const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("new" + ff_core_List.List_size(arguments_.first_))), false);
1564
- return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], arguments_.first_, [])
1565
- }
1566
1566
  if(_1.Some) {
1567
1567
  const i_ = _1.value_;
1568
1568
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_List.List_grab(arguments_.first_, i_).at_, "Unexpected named argument"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
@@ -1585,6 +1585,11 @@ const member_ = ff_compiler_Syntax.EString(ff_compiler_Token.Token_at(token_), (
1585
1585
  : (("\"" + ff_compiler_Token.Token_raw(token_)) + "\"")));
1586
1586
  if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")) {
1587
1587
  const arguments_ = ff_compiler_Parser.Parser_parseFunctionArguments(self_, record_.at_, false);
1588
+ ff_core_Option.Option_each(ff_core_List.List_find(arguments_.first_, ((_w1) => {
1589
+ return (!ff_core_Option.Option_isEmpty(_w1.name_))
1590
+ })), ((argument_) => {
1591
+ 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)})
1592
+ }));
1588
1593
  const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, record_.at_);
1589
1594
  const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("call" + ff_core_List.List_size(arguments_.first_))), false);
1590
1595
  return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(member_.at_, ff_core_Option.None(), member_), ...arguments_.first_], [])
@@ -3153,21 +3158,21 @@ const _1 = ff_core_List.List_indexWhere(arguments_.first_, ((_w1) => {
3153
3158
  return (!ff_core_Option.Option_isEmpty(_w1.name_))
3154
3159
  }));
3155
3160
  if(_1.None) {
3161
+ const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("new" + ff_core_List.List_size(arguments_.first_))), false);
3162
+ return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], arguments_.first_, [])
3163
+ }
3164
+ if(_1.Some && _1.value_ === 0) {
3156
3165
  const objectTarget_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, "object"), false);
3157
3166
  let result_ = ff_compiler_Syntax.ECall(record_.at_, objectTarget_, effect_, [], [], []);
3158
3167
  ff_core_List.List_each(arguments_.first_, ((argument_) => {
3159
3168
  if(ff_core_Option.Option_isEmpty(argument_.name_)) {
3160
3169
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(argument_.at_, "Expected a named argument"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
3161
3170
  };
3162
- const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, "with"), false);
3163
- result_ = ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(argument_.at_, ff_core_Option.None(), ff_compiler_Syntax.EString(argument_.at_, ff_core_Option.Option_grab(argument_.name_))), argument_], [])
3171
+ const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, result_, "with"), false);
3172
+ result_ = ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(argument_.at_, ff_core_Option.None(), ff_compiler_Syntax.EString(argument_.at_, ff_core_Option.Option_grab(argument_.name_))), ff_compiler_Syntax.Argument(argument_.value_.at_, ff_core_Option.None(), argument_.value_)], [])
3164
3173
  }));
3165
3174
  return result_
3166
3175
  }
3167
- if(_1.Some && _1.value_ === 0) {
3168
- const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("new" + ff_core_List.List_size(arguments_.first_))), false);
3169
- return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], arguments_.first_, [])
3170
- }
3171
3176
  if(_1.Some) {
3172
3177
  const i_ = _1.value_;
3173
3178
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_List.List_grab(arguments_.first_, i_).at_, "Unexpected named argument"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
@@ -3190,6 +3195,11 @@ const member_ = ff_compiler_Syntax.EString(ff_compiler_Token.Token_at(token_), (
3190
3195
  : (("\"" + ff_compiler_Token.Token_raw(token_)) + "\"")));
3191
3196
  if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "(")) {
3192
3197
  const arguments_ = ff_compiler_Parser.Parser_parseFunctionArguments(self_, record_.at_, false);
3198
+ ff_core_Option.Option_each(ff_core_List.List_find(arguments_.first_, ((_w1) => {
3199
+ return (!ff_core_Option.Option_isEmpty(_w1.name_))
3200
+ })), ((argument_) => {
3201
+ 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)})
3202
+ }));
3193
3203
  const effect_ = ff_compiler_Parser.Parser_freshUnificationVariable(self_, record_.at_);
3194
3204
  const target_ = ff_compiler_Syntax.DynamicCall(ff_compiler_Syntax.EField(ff_compiler_Token.Token_at(token_), false, record_, ("call" + ff_core_List.List_size(arguments_.first_))), false);
3195
3205
  return ff_compiler_Syntax.ECall(record_.at_, target_, effect_, [], [ff_compiler_Syntax.Argument(member_.at_, ff_core_Option.None(), member_), ...arguments_.first_], [])
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.4.89",
7
+ "version": "0.4.91",
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.4.89",
7
+ "version": "0.4.91",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"