firefly-compiler 0.5.78 → 0.5.79

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.
Files changed (82) hide show
  1. package/compiler/Builder.ff +1 -1
  2. package/compiler/JsEmitter.ff +11 -2
  3. package/compiler/Main.ff +6 -1
  4. package/core/Core.ff +4 -4
  5. package/core/Error.ff +7 -1
  6. package/core/Js.ff +13 -2
  7. package/fireflysite/Html.ff +15 -2
  8. package/output/js/ff/compiler/Builder.mjs +2 -3
  9. package/output/js/ff/compiler/Builder.mjs.map +2 -2
  10. package/output/js/ff/compiler/Compiler.mjs +8 -8
  11. package/output/js/ff/compiler/Compiler.mjs.map +1 -1
  12. package/output/js/ff/compiler/Dependencies.mjs +10 -10
  13. package/output/js/ff/compiler/Dependencies.mjs.map +1 -1
  14. package/output/js/ff/compiler/Deriver.mjs +2 -2
  15. package/output/js/ff/compiler/Deriver.mjs.map +1 -1
  16. package/output/js/ff/compiler/Dictionaries.mjs +4 -4
  17. package/output/js/ff/compiler/Dictionaries.mjs.map +1 -1
  18. package/output/js/ff/compiler/Environment.mjs +6 -6
  19. package/output/js/ff/compiler/Environment.mjs.map +1 -1
  20. package/output/js/ff/compiler/Inference.mjs +80 -80
  21. package/output/js/ff/compiler/Inference.mjs.map +1 -1
  22. package/output/js/ff/compiler/JsEmitter.mjs +60 -14
  23. package/output/js/ff/compiler/JsEmitter.mjs.map +2 -2
  24. package/output/js/ff/compiler/JsImporter.mjs +8 -8
  25. package/output/js/ff/compiler/JsImporter.mjs.map +1 -1
  26. package/output/js/ff/compiler/LspHook.mjs +4 -4
  27. package/output/js/ff/compiler/LspHook.mjs.map +1 -1
  28. package/output/js/ff/compiler/Main.mjs +42 -32
  29. package/output/js/ff/compiler/Main.mjs.map +7 -2
  30. package/output/js/ff/compiler/Parser.mjs +50 -50
  31. package/output/js/ff/compiler/Parser.mjs.map +1 -1
  32. package/output/js/ff/compiler/Patterns.mjs +6 -6
  33. package/output/js/ff/compiler/Patterns.mjs.map +1 -1
  34. package/output/js/ff/compiler/Resolver.mjs +32 -32
  35. package/output/js/ff/compiler/Resolver.mjs.map +1 -1
  36. package/output/js/ff/compiler/Syntax.mjs +74 -74
  37. package/output/js/ff/compiler/Syntax.mjs.map +1 -1
  38. package/output/js/ff/compiler/Token.mjs +4 -4
  39. package/output/js/ff/compiler/Token.mjs.map +1 -1
  40. package/output/js/ff/compiler/Tokenizer.mjs +4 -4
  41. package/output/js/ff/compiler/Tokenizer.mjs.map +1 -1
  42. package/output/js/ff/compiler/Unification.mjs +14 -14
  43. package/output/js/ff/compiler/Unification.mjs.map +1 -1
  44. package/output/js/ff/compiler/Workspace.mjs +4 -4
  45. package/output/js/ff/compiler/Workspace.mjs.map +1 -1
  46. package/output/js/ff/core/Array.mjs +10 -10
  47. package/output/js/ff/core/Array.mjs.map +1 -1
  48. package/output/js/ff/core/Buffer.mjs +4 -4
  49. package/output/js/ff/core/Buffer.mjs.map +1 -1
  50. package/output/js/ff/core/Core.mjs +4 -8
  51. package/output/js/ff/core/Core.mjs.map +4 -6
  52. package/output/js/ff/core/Error.mjs +32 -2
  53. package/output/js/ff/core/Error.mjs.map +15 -2
  54. package/output/js/ff/core/IntMap.mjs +2 -2
  55. package/output/js/ff/core/IntMap.mjs.map +1 -1
  56. package/output/js/ff/core/Js.mjs +20 -4
  57. package/output/js/ff/core/Js.mjs.map +8 -4
  58. package/output/js/ff/core/JsValue.mjs +20 -20
  59. package/output/js/ff/core/JsValue.mjs.map +1 -1
  60. package/output/js/ff/core/Json.mjs +10 -10
  61. package/output/js/ff/core/Json.mjs.map +1 -1
  62. package/output/js/ff/core/List.mjs +4 -4
  63. package/output/js/ff/core/List.mjs.map +1 -1
  64. package/output/js/ff/core/Lock.mjs +4 -4
  65. package/output/js/ff/core/Lock.mjs.map +1 -1
  66. package/output/js/ff/core/NodeSystem.mjs +2 -2
  67. package/output/js/ff/core/NodeSystem.mjs.map +1 -1
  68. package/output/js/ff/core/Option.mjs +2 -2
  69. package/output/js/ff/core/Option.mjs.map +1 -1
  70. package/output/js/ff/core/Pair.mjs +2 -2
  71. package/output/js/ff/core/Pair.mjs.map +1 -1
  72. package/output/js/ff/core/Serializable.mjs +2 -2
  73. package/output/js/ff/core/Serializable.mjs.map +1 -1
  74. package/output/js/ff/core/String.mjs +10 -10
  75. package/output/js/ff/core/String.mjs.map +1 -1
  76. package/output/js/ff/core/StringMap.mjs +2 -2
  77. package/output/js/ff/core/StringMap.mjs.map +1 -1
  78. package/output/js/ff/core/Try.mjs +2 -2
  79. package/output/js/ff/core/Try.mjs.map +1 -1
  80. package/package.json +1 -2
  81. package/vscode/package.json +1 -1
  82. package/webserver/WebServer.ff +1 -1
@@ -149,7 +149,7 @@ return ff_core_Pair.Pair(ff_compiler_Syntax.ModuleKey_qualifiedName(m_.moduleKey
149
149
  }
150
150
 
151
151
  export function fail_(at_, message_) {
152
- throw ff_core_Js.initializeError_(new Error(), ff_compiler_Syntax.CompileError(at_, message_), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
152
+ throw ff_core_Js.initializeError_(ff_compiler_Syntax.CompileError(at_, message_), new Error(), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
153
153
  }
154
154
 
155
155
  export function rawJs_(at_, rawIdentifier_) {
@@ -406,7 +406,7 @@ return ff_core_Pair.Pair(ff_compiler_Syntax.ModuleKey_qualifiedName(m_.moduleKey
406
406
  }
407
407
 
408
408
  export async function fail_$(at_, message_, $task) {
409
- throw ff_core_Js.initializeError_(new Error(), ff_compiler_Syntax.CompileError(at_, message_), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
409
+ throw ff_core_Js.initializeError_(ff_compiler_Syntax.CompileError(at_, message_), new Error(), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
410
410
  }
411
411
 
412
412
  export async function rawJs_$(at_, rawIdentifier_, $task) {
@@ -1295,7 +1295,7 @@ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, patternAt_, "_")
1295
1295
  return
1296
1296
  }
1297
1297
  {
1298
- throw ff_core_Js.initializeError_(new Error(), ff_compiler_Syntax.CompileError(at_, "Internal compiler error"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
1298
+ throw ff_core_Js.initializeError_(ff_compiler_Syntax.CompileError(at_, "Internal compiler error"), new Error(), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
1299
1299
  }
1300
1300
  }));
1301
1301
  if(newAsync_) {
@@ -1763,7 +1763,7 @@ const instanceCall_ = _1.target_.instanceCall_;
1763
1763
  const effect_ = _1.effect_;
1764
1764
  const arguments_ = _1.arguments_;
1765
1765
  if(instanceCall_) {
1766
- throw ff_core_Js.initializeError_(new Error(), ff_compiler_Syntax.CompileError(at_, "Not yet implemented: Tail calls on trait methods."), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
1766
+ throw ff_core_Js.initializeError_(ff_compiler_Syntax.CompileError(at_, "Not yet implemented: Tail calls on trait methods."), new Error(), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
1767
1767
  };
1768
1768
  self_.tailCallUsed_ = true;
1769
1769
  ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, "{");
@@ -2522,7 +2522,7 @@ return true
2522
2522
  {
2523
2523
  const name_ = _1;
2524
2524
  if(ff_core_String.String_startsWith(name_, "ff:core/Js.async", 0)) {
2525
- throw ff_core_Js.initializeError_(new Error(), ff_compiler_Syntax.CompileError(term_.at_, "JS async functions must take a simple parameter list"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
2525
+ throw ff_core_Js.initializeError_(ff_compiler_Syntax.CompileError(term_.at_, "JS async functions must take a simple parameter list"), new Error(), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
2526
2526
  }
2527
2527
  }
2528
2528
  if(_1 === "ff:core/Js.cancelled") {
@@ -3555,9 +3555,9 @@ const _guard1 = dictionaries_;
3555
3555
  if(_guard1.length === 2) {
3556
3556
  const hasAnyTag_ = _guard1[0];
3557
3557
  const show_ = _guard1[1];
3558
- ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, "throw ff_core_Js.initializeError_(new Error(), ");
3558
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, "throw ff_core_Js.initializeError_(");
3559
3559
  ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, term_.at_, argument_, async_);
3560
- ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ", ");
3560
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ", new Error(), ");
3561
3561
  ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ff_compiler_JsEmitter.JsEmitter_makeDictionary(self_, hasAnyTag_));
3562
3562
  ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ", ");
3563
3563
  ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ff_compiler_JsEmitter.JsEmitter_makeDictionary(self_, show_));
@@ -3567,6 +3567,29 @@ return true
3567
3567
  }
3568
3568
  }
3569
3569
  }
3570
+ if(_1 === "ff:core/Core.throwWithMessage") {
3571
+ const _guard3 = term_;
3572
+ if(_guard3.ECall) {
3573
+ const c_ = _guard3;
3574
+ const _guard2 = c_.arguments_;
3575
+ if(_guard2.length === 2) {
3576
+ const argument_ = _guard2[0];
3577
+ const message_ = _guard2[1];
3578
+ const _guard1 = dictionaries_;
3579
+ if(_guard1.length === 1) {
3580
+ const hasAnyTag_ = _guard1[0];
3581
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, "throw ff_core_Js.initializeErrorKeepMessage_(");
3582
+ ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, term_.at_, argument_, async_);
3583
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ", new Error(");
3584
+ ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, term_.at_, message_, async_);
3585
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, "), ");
3586
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ff_compiler_JsEmitter.JsEmitter_makeDictionary(self_, hasAnyTag_));
3587
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ")");
3588
+ return true
3589
+ }
3590
+ }
3591
+ }
3592
+ }
3570
3593
  if(_1 === "ff:core/Try.Try_catch" && ff_compiler_JsEmitter.JsEmitter_emitTryCatchFinally(self_, term_, last_, async_)) {
3571
3594
  return true
3572
3595
  }
@@ -4884,7 +4907,7 @@ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, patternAt_, "_")
4884
4907
  return
4885
4908
  }
4886
4909
  {
4887
- throw ff_core_Js.initializeError_(new Error(), ff_compiler_Syntax.CompileError(at_, "Internal compiler error"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
4910
+ throw ff_core_Js.initializeError_(ff_compiler_Syntax.CompileError(at_, "Internal compiler error"), new Error(), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
4888
4911
  }
4889
4912
  }));
4890
4913
  if(newAsync_) {
@@ -5352,7 +5375,7 @@ const instanceCall_ = _1.target_.instanceCall_;
5352
5375
  const effect_ = _1.effect_;
5353
5376
  const arguments_ = _1.arguments_;
5354
5377
  if(instanceCall_) {
5355
- throw ff_core_Js.initializeError_(new Error(), ff_compiler_Syntax.CompileError(at_, "Not yet implemented: Tail calls on trait methods."), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
5378
+ throw ff_core_Js.initializeError_(ff_compiler_Syntax.CompileError(at_, "Not yet implemented: Tail calls on trait methods."), new Error(), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
5356
5379
  };
5357
5380
  self_.tailCallUsed_ = true;
5358
5381
  ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, "{");
@@ -6111,7 +6134,7 @@ return true
6111
6134
  {
6112
6135
  const name_ = _1;
6113
6136
  if(ff_core_String.String_startsWith(name_, "ff:core/Js.async", 0)) {
6114
- throw ff_core_Js.initializeError_(new Error(), ff_compiler_Syntax.CompileError(term_.at_, "JS async functions must take a simple parameter list"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
6137
+ throw ff_core_Js.initializeError_(ff_compiler_Syntax.CompileError(term_.at_, "JS async functions must take a simple parameter list"), new Error(), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError, ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_CompileError)
6115
6138
  }
6116
6139
  }
6117
6140
  if(_1 === "ff:core/Js.cancelled") {
@@ -7144,9 +7167,9 @@ const _guard1 = dictionaries_;
7144
7167
  if(_guard1.length === 2) {
7145
7168
  const hasAnyTag_ = _guard1[0];
7146
7169
  const show_ = _guard1[1];
7147
- ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, "throw ff_core_Js.initializeError_(new Error(), ");
7170
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, "throw ff_core_Js.initializeError_(");
7148
7171
  ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, term_.at_, argument_, async_);
7149
- ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ", ");
7172
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ", new Error(), ");
7150
7173
  ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ff_compiler_JsEmitter.JsEmitter_makeDictionary(self_, hasAnyTag_));
7151
7174
  ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ", ");
7152
7175
  ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ff_compiler_JsEmitter.JsEmitter_makeDictionary(self_, show_));
@@ -7156,6 +7179,29 @@ return true
7156
7179
  }
7157
7180
  }
7158
7181
  }
7182
+ if(_1 === "ff:core/Core.throwWithMessage") {
7183
+ const _guard3 = term_;
7184
+ if(_guard3.ECall) {
7185
+ const c_ = _guard3;
7186
+ const _guard2 = c_.arguments_;
7187
+ if(_guard2.length === 2) {
7188
+ const argument_ = _guard2[0];
7189
+ const message_ = _guard2[1];
7190
+ const _guard1 = dictionaries_;
7191
+ if(_guard1.length === 1) {
7192
+ const hasAnyTag_ = _guard1[0];
7193
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, "throw ff_core_Js.initializeErrorKeepMessage_(");
7194
+ ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, term_.at_, argument_, async_);
7195
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ", new Error(");
7196
+ ff_compiler_JsEmitter.JsEmitter_emitArgument(self_, term_.at_, message_, async_);
7197
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, "), ");
7198
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ff_compiler_JsEmitter.JsEmitter_makeDictionary(self_, hasAnyTag_));
7199
+ ff_compiler_JsEmitter.JsEmitter_writeMapped(self_, term_.at_, ")");
7200
+ return true
7201
+ }
7202
+ }
7203
+ }
7204
+ }
7159
7205
  if(_1 === "ff:core/Try.Try_catch" && ff_compiler_JsEmitter.JsEmitter_emitTryCatchFinally(self_, term_, last_, async_)) {
7160
7206
  return true
7161
7207
  }
@@ -8057,7 +8103,7 @@ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_
8057
8103
  return ff_compiler_JsEmitter.EmitExecutable()
8058
8104
  }
8059
8105
  {
8060
- throw ff_core_Js.initializeError_(new Error(), ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException, ff_core_Serializable.ff_core_Show_Show$ff_core_Serializable_DeserializationChecksumException)
8106
+ throw ff_core_Js.initializeError_(ff_core_Serializable.DeserializationChecksumException(), new Error(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException, ff_core_Serializable.ff_core_Show_Show$ff_core_Serializable_DeserializationChecksumException)
8061
8107
  }
8062
8108
  }
8063
8109
  },
@@ -8119,7 +8165,7 @@ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_
8119
8165
  return ff_compiler_JsEmitter.EmitExecutable()
8120
8166
  }
8121
8167
  {
8122
- throw ff_core_Js.initializeError_(new Error(), ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException, ff_core_Serializable.ff_core_Show_Show$ff_core_Serializable_DeserializationChecksumException)
8168
+ throw ff_core_Js.initializeError_(ff_core_Serializable.DeserializationChecksumException(), new Error(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException, ff_core_Serializable.ff_core_Show_Show$ff_core_Serializable_DeserializationChecksumException)
8123
8169
  }
8124
8170
  }
8125
8171
  },