firefly-compiler 0.4.4

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 (221) hide show
  1. package/.firefly-workspace +1 -0
  2. package/.vscode/settings.json +5 -0
  3. package/LICENSE.txt +21 -0
  4. package/README.md +96 -0
  5. package/bin/firefly.mjs +2 -0
  6. package/compiler/.firefly/package.ff +1 -0
  7. package/compiler/Builder.ff +218 -0
  8. package/compiler/Compiler.ff +241 -0
  9. package/compiler/Dependencies.ff +179 -0
  10. package/compiler/Deriver.ff +647 -0
  11. package/compiler/Dictionaries.ff +205 -0
  12. package/compiler/Environment.ff +166 -0
  13. package/compiler/Inference.ff +1117 -0
  14. package/compiler/JsEmitter.ff +861 -0
  15. package/compiler/JsImporter.ff +56 -0
  16. package/compiler/LspHook.ff +188 -0
  17. package/compiler/Main.ff +237 -0
  18. package/compiler/Parser.ff +1383 -0
  19. package/compiler/Patterns.ff +111 -0
  20. package/compiler/Resolver.ff +620 -0
  21. package/compiler/Substitution.ff +178 -0
  22. package/compiler/Syntax.ff +299 -0
  23. package/compiler/Token.ff +180 -0
  24. package/compiler/Tokenizer.ff +278 -0
  25. package/compiler/Unification.ff +220 -0
  26. package/compiler/Wildcards.ff +50 -0
  27. package/compiler/Workspace.ff +88 -0
  28. package/core/.firefly/package.ff +2 -0
  29. package/core/Any.ff +30 -0
  30. package/core/Array.ff +249 -0
  31. package/core/AssetSystem.ff +61 -0
  32. package/core/Atomic.ff +64 -0
  33. package/core/Bool.ff +13 -0
  34. package/core/BrowserSystem.ff +14 -0
  35. package/core/Buffer.ff +211 -0
  36. package/core/BuildSystem.ff +144 -0
  37. package/core/Channel.ff +131 -0
  38. package/core/Char.ff +18 -0
  39. package/core/Core.ff +58 -0
  40. package/core/Duration.ff +15 -0
  41. package/core/Equal.ff +52 -0
  42. package/core/Error.ff +20 -0
  43. package/core/FileHandle.ff +41 -0
  44. package/core/Float.ff +41 -0
  45. package/core/HttpClient.ff +84 -0
  46. package/core/Instant.ff +9 -0
  47. package/core/Int.ff +61 -0
  48. package/core/IntMap.ff +85 -0
  49. package/core/JsSystem.ff +66 -0
  50. package/core/JsValue.ff +240 -0
  51. package/core/List.ff +440 -0
  52. package/core/Lock.ff +144 -0
  53. package/core/Log.ff +24 -0
  54. package/core/Map.ff +126 -0
  55. package/core/NodeSystem.ff +88 -0
  56. package/core/Nothing.ff +1 -0
  57. package/core/Option.ff +133 -0
  58. package/core/Ordering.ff +157 -0
  59. package/core/Pair.ff +55 -0
  60. package/core/Path.ff +393 -0
  61. package/core/RbMap.ff +216 -0
  62. package/core/Serializable.ff +173 -0
  63. package/core/Set.ff +38 -0
  64. package/core/Show.ff +43 -0
  65. package/core/Stack.ff +263 -0
  66. package/core/Stream.ff +406 -0
  67. package/core/String.ff +175 -0
  68. package/core/StringMap.ff +85 -0
  69. package/core/Task.ff +138 -0
  70. package/core/Try.ff +81 -0
  71. package/core/Unit.ff +3 -0
  72. package/experimental/random/AltGeneric.ff +44 -0
  73. package/experimental/random/Async.ff +68 -0
  74. package/experimental/random/Buffer2.ff +77 -0
  75. package/experimental/random/Cat.ff +12 -0
  76. package/experimental/random/Dictionary.ff +52 -0
  77. package/experimental/random/Example.ff +46 -0
  78. package/experimental/random/Generic.ff +102 -0
  79. package/experimental/random/HappyEyeballs.ff +40 -0
  80. package/experimental/random/HashMap.ff +72 -0
  81. package/experimental/random/IfElseUnit.ff +9 -0
  82. package/experimental/random/InputOutput.ff +23 -0
  83. package/experimental/random/ListVsArray.ff +45 -0
  84. package/experimental/random/Main.ff +44 -0
  85. package/experimental/random/MapTest.ff +67 -0
  86. package/experimental/random/OldTaskSystem.ff +210 -0
  87. package/experimental/random/PatternTest.ff +39 -0
  88. package/experimental/random/Patterns.ff +226 -0
  89. package/experimental/random/ReadBytesTest.ff +10 -0
  90. package/experimental/random/RunLength.ff +65 -0
  91. package/experimental/random/Scrape.ff +51 -0
  92. package/experimental/random/Serialization.ff +217 -0
  93. package/experimental/random/SerializationTest.ff +46 -0
  94. package/experimental/random/Serializer.ff +36 -0
  95. package/experimental/random/StdInOutErr.ff +4 -0
  96. package/experimental/random/Symbols.ff +74 -0
  97. package/experimental/random/Tag.ff +49 -0
  98. package/experimental/random/Tensor.ff +52 -0
  99. package/experimental/random/Try.ff +56 -0
  100. package/experimental/random/Tsv.ff +9 -0
  101. package/experimental/random/TypesAreModules.ff +87 -0
  102. package/experimental/random/blueprints/Blueprint.ff +52 -0
  103. package/experimental/random/blueprints/Main.ff +11 -0
  104. package/experimental/random/blueprints/Pretty.ff +58 -0
  105. package/experimental/random/blueprints/User.ff +64 -0
  106. package/experimental/random/blueprintsystem/BlueprintSystem.ff +48 -0
  107. package/experimental/random/blueprintsystem/Deserialize.ff +53 -0
  108. package/experimental/random/blueprintsystem/ReadJs.ff +13 -0
  109. package/experimental/random/blueprintsystem/User.ff +2 -0
  110. package/experimental/random/kahrs/Kahrs.ff +112 -0
  111. package/experimental/random/kahrs/TestKahrs.ff +22 -0
  112. package/experimental/random/kahrs/TestMap.ff +18 -0
  113. package/experimental/random/streaming/Gzip.ff +3 -0
  114. package/experimental/random/streaming/Main.ff +34 -0
  115. package/experimental/random/streaming/S3Bucket.ff +11 -0
  116. package/experimental/random/streaming/Tar.ff +5 -0
  117. package/experimental/rhymeapp/Main.ff +81 -0
  118. package/experimental/rhymeapp/index.html +14 -0
  119. package/firefly.sh +5 -0
  120. package/fireflysite/Main.ff +13 -0
  121. package/httpserver/.firefly/package.ff +1 -0
  122. package/httpserver/HttpServer.ff +184 -0
  123. package/lsp/.firefly/package.ff +1 -0
  124. package/lsp/CompletionHandler.ff +814 -0
  125. package/lsp/Handler.ff +551 -0
  126. package/lsp/HoverHandler.ff +82 -0
  127. package/lsp/LanguageServer.ff +229 -0
  128. package/lsp/SignatureHelpHandler.ff +55 -0
  129. package/lsp/SymbolHandler.ff +167 -0
  130. package/output/js/ff/compiler/Builder.mjs +483 -0
  131. package/output/js/ff/compiler/Compiler.mjs +410 -0
  132. package/output/js/ff/compiler/Dependencies.mjs +388 -0
  133. package/output/js/ff/compiler/Deriver.mjs +1166 -0
  134. package/output/js/ff/compiler/Dictionaries.mjs +1305 -0
  135. package/output/js/ff/compiler/Environment.mjs +1005 -0
  136. package/output/js/ff/compiler/Inference.mjs +4264 -0
  137. package/output/js/ff/compiler/JsEmitter.mjs +5353 -0
  138. package/output/js/ff/compiler/JsImporter.mjs +262 -0
  139. package/output/js/ff/compiler/LspHook.mjs +789 -0
  140. package/output/js/ff/compiler/Main.mjs +1695 -0
  141. package/output/js/ff/compiler/Parser.mjs +4004 -0
  142. package/output/js/ff/compiler/Patterns.mjs +923 -0
  143. package/output/js/ff/compiler/Resolver.mjs +2303 -0
  144. package/output/js/ff/compiler/Substitution.mjs +1146 -0
  145. package/output/js/ff/compiler/Syntax.mjs +12430 -0
  146. package/output/js/ff/compiler/Token.mjs +3092 -0
  147. package/output/js/ff/compiler/Tokenizer.mjs +589 -0
  148. package/output/js/ff/compiler/Unification.mjs +1748 -0
  149. package/output/js/ff/compiler/Wildcards.mjs +604 -0
  150. package/output/js/ff/compiler/Workspace.mjs +683 -0
  151. package/output/js/ff/core/Any.mjs +139 -0
  152. package/output/js/ff/core/Array.mjs +594 -0
  153. package/output/js/ff/core/AssetSystem.mjs +270 -0
  154. package/output/js/ff/core/Atomic.mjs +186 -0
  155. package/output/js/ff/core/Bool.mjs +141 -0
  156. package/output/js/ff/core/BrowserSystem.mjs +122 -0
  157. package/output/js/ff/core/Buffer.mjs +467 -0
  158. package/output/js/ff/core/BuildSystem.mjs +320 -0
  159. package/output/js/ff/core/Channel.mjs +268 -0
  160. package/output/js/ff/core/Char.mjs +145 -0
  161. package/output/js/ff/core/Core.mjs +300 -0
  162. package/output/js/ff/core/Duration.mjs +112 -0
  163. package/output/js/ff/core/Equal.mjs +175 -0
  164. package/output/js/ff/core/Error.mjs +138 -0
  165. package/output/js/ff/core/FileHandle.mjs +164 -0
  166. package/output/js/ff/core/Float.mjs +214 -0
  167. package/output/js/ff/core/HttpClient.mjs +210 -0
  168. package/output/js/ff/core/Instant.mjs +105 -0
  169. package/output/js/ff/core/Int.mjs +254 -0
  170. package/output/js/ff/core/IntMap.mjs +282 -0
  171. package/output/js/ff/core/JsSystem.mjs +234 -0
  172. package/output/js/ff/core/JsValue.mjs +678 -0
  173. package/output/js/ff/core/List.mjs +2335 -0
  174. package/output/js/ff/core/Lock.mjs +322 -0
  175. package/output/js/ff/core/Log.mjs +159 -0
  176. package/output/js/ff/core/Map.mjs +358 -0
  177. package/output/js/ff/core/NodeSystem.mjs +288 -0
  178. package/output/js/ff/core/Nothing.mjs +100 -0
  179. package/output/js/ff/core/Option.mjs +1002 -0
  180. package/output/js/ff/core/Ordering.mjs +734 -0
  181. package/output/js/ff/core/Pair.mjs +318 -0
  182. package/output/js/ff/core/Path.mjs +768 -0
  183. package/output/js/ff/core/RbMap.mjs +1936 -0
  184. package/output/js/ff/core/Serializable.mjs +434 -0
  185. package/output/js/ff/core/Set.mjs +250 -0
  186. package/output/js/ff/core/Show.mjs +201 -0
  187. package/output/js/ff/core/Stack.mjs +595 -0
  188. package/output/js/ff/core/Stream.mjs +1300 -0
  189. package/output/js/ff/core/String.mjs +433 -0
  190. package/output/js/ff/core/StringMap.mjs +282 -0
  191. package/output/js/ff/core/Task.mjs +345 -0
  192. package/output/js/ff/core/Try.mjs +503 -0
  193. package/output/js/ff/core/Unit.mjs +103 -0
  194. package/package.json +29 -0
  195. package/postgresql/.firefly/include/package-lock.json +250 -0
  196. package/postgresql/.firefly/include/package.json +5 -0
  197. package/postgresql/.firefly/include/prepare.sh +2 -0
  198. package/postgresql/.firefly/package.ff +3 -0
  199. package/postgresql/Pg.ff +530 -0
  200. package/unsafejs/.firefly/package.ff +1 -0
  201. package/unsafejs/UnsafeJs.ff +19 -0
  202. package/vscode/.vscode/launch.json +18 -0
  203. package/vscode/.vscode/tasks.json +33 -0
  204. package/vscode/LICENSE.txt +21 -0
  205. package/vscode/Prepublish.ff +15 -0
  206. package/vscode/README.md +17 -0
  207. package/vscode/client/package-lock.json +544 -0
  208. package/vscode/client/package.json +22 -0
  209. package/vscode/client/src/extension.ts +64 -0
  210. package/vscode/client/tsconfig.json +12 -0
  211. package/vscode/icons/firefly-icon.png +0 -0
  212. package/vscode/icons/firefly-icon.svg +10 -0
  213. package/vscode/icons/firefly-logo-notext.png +0 -0
  214. package/vscode/icons/firefly-logo.png +0 -0
  215. package/vscode/language-configuration.json +39 -0
  216. package/vscode/package-lock.json +3623 -0
  217. package/vscode/package.json +144 -0
  218. package/vscode/snippets-none.json +1 -0
  219. package/vscode/snippets.json +241 -0
  220. package/vscode/syntaxes/firefly.tmLanguage.json +294 -0
  221. package/vscode/tsconfig.json +20 -0
@@ -0,0 +1,1146 @@
1
+
2
+
3
+ import * as ff_compiler_Substitution from "../../ff/compiler/Substitution.mjs"
4
+
5
+ import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
6
+
7
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
8
+
9
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
10
+
11
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
12
+
13
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
14
+
15
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
16
+
17
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
18
+
19
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
20
+
21
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
22
+
23
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
24
+
25
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
26
+
27
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
28
+
29
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
30
+
31
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
32
+
33
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
34
+
35
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
36
+
37
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
38
+
39
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
40
+
41
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
42
+
43
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
44
+
45
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
46
+
47
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
48
+
49
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
50
+
51
+ import * as ff_core_List from "../../ff/core/List.mjs"
52
+
53
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
54
+
55
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
56
+
57
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
58
+
59
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
60
+
61
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
62
+
63
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
64
+
65
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
66
+
67
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
68
+
69
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
70
+
71
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
72
+
73
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
74
+
75
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
76
+
77
+ import * as ff_core_Stack from "../../ff/core/Stack.mjs"
78
+
79
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
80
+
81
+ import * as ff_core_String from "../../ff/core/String.mjs"
82
+
83
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
84
+
85
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
86
+
87
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
88
+
89
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
90
+
91
+ // type Substitution
92
+ export function Substitution(substitution_) {
93
+ return {substitution_};
94
+ }
95
+
96
+
97
+
98
+ export function core_(name_) {
99
+ return ((("ff:core/" + name_) + ".") + name_)
100
+ }
101
+
102
+ export async function core_$(name_, $task) {
103
+ return ((("ff:core/" + name_) + ".") + name_)
104
+ }
105
+
106
+ export function Substitution_substituteModule(self_, module_) {
107
+ const lets_ = ff_core_List.List_map(module_.lets_, ((_w1) => {
108
+ return ff_compiler_Substitution.Substitution_substituteLetDefinition(self_, _w1)
109
+ }));
110
+ const functions_ = ff_core_List.List_map(module_.functions_, ((_w1) => {
111
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
112
+ }));
113
+ const extends_ = ff_core_List.List_map(module_.extends_, ((_w1) => {
114
+ return ff_compiler_Substitution.Substitution_substituteExtendDefinition(self_, _w1)
115
+ }));
116
+ const instances_ = ff_core_List.List_map(module_.instances_, ((_w1) => {
117
+ return ff_compiler_Substitution.Substitution_substituteInstanceDefinition(self_, _w1)
118
+ }));
119
+ {
120
+ const _1 = module_;
121
+ {
122
+ const _c = _1;
123
+ return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, _c.imports_, _c.types_, _c.traits_, instances_, extends_, lets_, functions_)
124
+ return
125
+ }
126
+ }
127
+ }
128
+
129
+ export function Substitution_substituteLetDefinition(self_, definition_) {
130
+ {
131
+ const _1 = definition_;
132
+ {
133
+ const _c = _1;
134
+ return ff_compiler_Syntax.DLet(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, definition_.variableType_), ff_compiler_Substitution.Substitution_substituteTerm(self_, definition_.value_))
135
+ return
136
+ }
137
+ }
138
+ }
139
+
140
+ export function Substitution_substituteExtendDefinition(self_, definition_) {
141
+ {
142
+ const _1 = definition_;
143
+ {
144
+ const _c = _1;
145
+ return ff_compiler_Syntax.DExtend(_c.at_, _c.name_, _c.generics_, _c.constraints_, _c.type_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
146
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
147
+ })))
148
+ return
149
+ }
150
+ }
151
+ }
152
+
153
+ export function Substitution_substituteFunctionDefinition(self_, definition_) {
154
+ {
155
+ const _1 = definition_;
156
+ {
157
+ const _c = _1;
158
+ return ff_compiler_Syntax.DFunction(_c.at_, ff_compiler_Substitution.Substitution_substituteSignature(self_, definition_.signature_), ff_compiler_Syntax.Target_mapFirefly(definition_.body_, ((_w1) => {
159
+ return ff_compiler_Substitution.Substitution_substituteLambda(self_, _w1)
160
+ })))
161
+ return
162
+ }
163
+ }
164
+ }
165
+
166
+ export function Substitution_substituteSignature(self_, signature_) {
167
+ {
168
+ const _1 = signature_;
169
+ {
170
+ const _c = _1;
171
+ return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, _c.generics_, ff_core_List.List_map(signature_.constraints_, ((_w1) => {
172
+ return ff_compiler_Substitution.Substitution_substituteConstraint(self_, _w1)
173
+ })), ff_core_List.List_map(signature_.parameters_, ((_w1) => {
174
+ return ff_compiler_Substitution.Substitution_substituteParameter(self_, _w1)
175
+ })), ff_compiler_Substitution.Substitution_substituteType(self_, signature_.returnType_), ff_compiler_Substitution.Substitution_substituteType(self_, signature_.effect_))
176
+ return
177
+ }
178
+ }
179
+ }
180
+
181
+ export function Substitution_substituteConstraint(self_, constraint_) {
182
+ {
183
+ const _1 = constraint_;
184
+ {
185
+ const _c = _1;
186
+ return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, ff_core_List.List_map(constraint_.generics_, ((_w1) => {
187
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
188
+ })))
189
+ return
190
+ }
191
+ }
192
+ }
193
+
194
+ export function Substitution_substituteParameter(self_, parameter_) {
195
+ {
196
+ const _1 = parameter_;
197
+ {
198
+ const _c = _1;
199
+ return ff_compiler_Syntax.Parameter(_c.at_, _c.mutable_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, parameter_.valueType_), ff_core_Option.Option_map(parameter_.default_, ((_w1) => {
200
+ return ff_compiler_Substitution.Substitution_substituteTerm(self_, _w1)
201
+ })))
202
+ return
203
+ }
204
+ }
205
+ }
206
+
207
+ export function Substitution_substituteInstanceDefinition(self_, definition_) {
208
+ {
209
+ const _1 = definition_;
210
+ {
211
+ const _c = _1;
212
+ return ff_compiler_Syntax.DInstance(_c.at_, _c.generics_, _c.constraints_, _c.traitName_, _c.typeArguments_, _c.generatorArguments_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
213
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
214
+ })), _c.derived_)
215
+ return
216
+ }
217
+ }
218
+ }
219
+
220
+ export function Substitution_substituteLambda(self_, definition_) {
221
+ {
222
+ const _1 = definition_;
223
+ {
224
+ const _c = _1;
225
+ return ff_compiler_Syntax.Lambda(_c.at_, ff_compiler_Substitution.Substitution_substituteType(self_, definition_.effect_), ff_core_List.List_map(definition_.cases_, ((case_) => {
226
+ {
227
+ const _1 = case_;
228
+ {
229
+ const _c = _1;
230
+ return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_, ff_core_List.List_map(case_.guards_, ((g_) => {
231
+ {
232
+ const _1 = g_;
233
+ {
234
+ const _c = _1;
235
+ return ff_compiler_Syntax.MatchGuard(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, g_.term_), _c.pattern_)
236
+ return
237
+ }
238
+ }
239
+ })), ff_compiler_Substitution.Substitution_substituteTerm(self_, case_.body_))
240
+ return
241
+ }
242
+ }
243
+ })))
244
+ return
245
+ }
246
+ }
247
+ }
248
+
249
+ export function Substitution_substituteTerm(self_, term_) {
250
+ {
251
+ const _1 = term_;
252
+ {
253
+ if(_1.EString) {
254
+ return term_
255
+ return
256
+ }
257
+ }
258
+ {
259
+ if(_1.EChar) {
260
+ return term_
261
+ return
262
+ }
263
+ }
264
+ {
265
+ if(_1.EInt) {
266
+ return term_
267
+ return
268
+ }
269
+ }
270
+ {
271
+ if(_1.EFloat) {
272
+ return term_
273
+ return
274
+ }
275
+ }
276
+ {
277
+ if(_1.EVariable) {
278
+ return term_
279
+ return
280
+ }
281
+ }
282
+ {
283
+ if(_1.EField) {
284
+ const e_ = _1;
285
+ {
286
+ const _1 = e_;
287
+ {
288
+ const _c = _1;
289
+ return ff_compiler_Syntax.EField(_c.at_, _c.newtype_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), _c.field_)
290
+ return
291
+ }
292
+ }
293
+ return
294
+ }
295
+ }
296
+ {
297
+ if(_1.EWildcard) {
298
+ const e_ = _1;
299
+ return term_
300
+ return
301
+ }
302
+ }
303
+ {
304
+ if(_1.EList) {
305
+ const e_ = _1;
306
+ {
307
+ const _1 = e_;
308
+ {
309
+ const _c = _1;
310
+ return ff_compiler_Syntax.EList(_c.at_, ff_compiler_Substitution.Substitution_substituteType(self_, e_.elementType_), ff_core_List.List_map(e_.items_, ((_1) => {
311
+ {
312
+ const item_ = _1.first_;
313
+ const b_ = _1.second_;
314
+ return ff_core_Pair.Pair(ff_compiler_Substitution.Substitution_substituteTerm(self_, item_), b_)
315
+ return
316
+ }
317
+ })))
318
+ return
319
+ }
320
+ }
321
+ return
322
+ }
323
+ }
324
+ {
325
+ if(_1.ESequential) {
326
+ const e_ = _1;
327
+ {
328
+ const _1 = e_;
329
+ {
330
+ const _c = _1;
331
+ return ff_compiler_Syntax.ESequential(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.before_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.after_))
332
+ return
333
+ }
334
+ }
335
+ return
336
+ }
337
+ }
338
+ {
339
+ if(_1.ELet) {
340
+ const e_ = _1;
341
+ {
342
+ const _1 = e_;
343
+ {
344
+ const _c = _1;
345
+ return ff_compiler_Syntax.ELet(_c.at_, _c.mutable_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, e_.valueType_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.body_))
346
+ return
347
+ }
348
+ }
349
+ return
350
+ }
351
+ }
352
+ {
353
+ if(_1.ELambda) {
354
+ const e_ = _1;
355
+ {
356
+ const _1 = e_;
357
+ {
358
+ const _c = _1;
359
+ return ff_compiler_Syntax.ELambda(_c.at_, ff_compiler_Substitution.Substitution_substituteLambda(self_, e_.lambda_))
360
+ return
361
+ }
362
+ }
363
+ return
364
+ }
365
+ }
366
+ {
367
+ if(_1.EVariant) {
368
+ const e_ = _1;
369
+ {
370
+ const _1 = e_;
371
+ {
372
+ const _c = _1;
373
+ return ff_compiler_Syntax.EVariant(_c.at_, _c.name_, ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
374
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
375
+ })), ff_core_Option.Option_map(e_.arguments_, ((_w1) => {
376
+ return ff_core_List.List_map(_w1, ((_w1) => {
377
+ return ff_compiler_Substitution.Substitution_substituteArgument(self_, _w1)
378
+ }))
379
+ })))
380
+ return
381
+ }
382
+ }
383
+ return
384
+ }
385
+ }
386
+ {
387
+ if(_1.EVariantIs) {
388
+ const e_ = _1;
389
+ {
390
+ const _1 = e_;
391
+ {
392
+ const _c = _1;
393
+ return ff_compiler_Syntax.EVariantIs(_c.at_, _c.name_, ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
394
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
395
+ })))
396
+ return
397
+ }
398
+ }
399
+ return
400
+ }
401
+ }
402
+ {
403
+ if(_1.ECopy) {
404
+ const e_ = _1;
405
+ {
406
+ const _1 = e_;
407
+ {
408
+ const _c = _1;
409
+ return ff_compiler_Syntax.ECopy(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), ff_core_List.List_map(e_.arguments_, ((_w1) => {
410
+ return ff_compiler_Substitution.Substitution_substituteField(self_, _w1)
411
+ })))
412
+ return
413
+ }
414
+ }
415
+ return
416
+ }
417
+ }
418
+ {
419
+ if(_1.EPipe) {
420
+ const e_ = _1;
421
+ {
422
+ const _1 = e_;
423
+ {
424
+ const _c = _1;
425
+ return ff_compiler_Syntax.EPipe(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_), ff_compiler_Substitution.Substitution_substituteType(self_, e_.effect_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.function_))
426
+ return
427
+ }
428
+ }
429
+ return
430
+ }
431
+ }
432
+ {
433
+ if(_1.ECall) {
434
+ const e_ = _1;
435
+ {
436
+ const _1 = e_;
437
+ {
438
+ const _c = _1;
439
+ return ff_compiler_Syntax.ECall(_c.at_, (((_1) => {
440
+ {
441
+ if(_1.DynamicCall) {
442
+ const call_ = _1;
443
+ {
444
+ const _1 = call_;
445
+ {
446
+ const _c = _1;
447
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Substitution.Substitution_substituteTerm(self_, call_.function_), _c.tailCall_)
448
+ return
449
+ }
450
+ }
451
+ return
452
+ }
453
+ }
454
+ {
455
+ if(_1.StaticCall) {
456
+ return e_.target_
457
+ return
458
+ }
459
+ }
460
+ }))(e_.target_), ff_compiler_Substitution.Substitution_substituteType(self_, e_.effect_), ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
461
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
462
+ })), ff_core_List.List_map(e_.arguments_, ((_w1) => {
463
+ return ff_compiler_Substitution.Substitution_substituteArgument(self_, _w1)
464
+ })), _c.dictionaries_)
465
+ return
466
+ }
467
+ }
468
+ return
469
+ }
470
+ }
471
+ {
472
+ if(_1.ERecord) {
473
+ const e_ = _1;
474
+ {
475
+ const _1 = e_;
476
+ {
477
+ const _c = _1;
478
+ return ff_compiler_Syntax.ERecord(_c.at_, ff_core_List.List_map(e_.fields_, ((_w1) => {
479
+ return ff_compiler_Substitution.Substitution_substituteField(self_, _w1)
480
+ })))
481
+ return
482
+ }
483
+ }
484
+ return
485
+ }
486
+ }
487
+ {
488
+ if(_1.EFunctions) {
489
+ const e_ = _1;
490
+ {
491
+ const _1 = e_;
492
+ {
493
+ const _c = _1;
494
+ return ff_compiler_Syntax.EFunctions(_c.at_, ff_core_List.List_map(e_.functions_, ((_w1) => {
495
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
496
+ })), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.body_))
497
+ return
498
+ }
499
+ }
500
+ return
501
+ }
502
+ }
503
+ {
504
+ if(_1.EAssign) {
505
+ const e_ = _1;
506
+ {
507
+ const _1 = e_;
508
+ {
509
+ const _c = _1;
510
+ return ff_compiler_Syntax.EAssign(_c.at_, _c.operator_, _c.variable_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_))
511
+ return
512
+ }
513
+ }
514
+ return
515
+ }
516
+ }
517
+ {
518
+ if(_1.EAssignField) {
519
+ const e_ = _1;
520
+ {
521
+ const _1 = e_;
522
+ {
523
+ const _c = _1;
524
+ return ff_compiler_Syntax.EAssignField(_c.at_, _c.operator_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), _c.field_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_))
525
+ return
526
+ }
527
+ }
528
+ return
529
+ }
530
+ }
531
+ }
532
+ }
533
+
534
+ export function Substitution_substituteArgument(self_, argument_) {
535
+ {
536
+ const _1 = argument_;
537
+ {
538
+ const _c = _1;
539
+ return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, argument_.value_))
540
+ return
541
+ }
542
+ }
543
+ }
544
+
545
+ export function Substitution_substituteField(self_, field_) {
546
+ {
547
+ const _1 = field_;
548
+ {
549
+ const _c = _1;
550
+ return ff_compiler_Syntax.Field(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, field_.value_))
551
+ return
552
+ }
553
+ }
554
+ }
555
+
556
+ export function Substitution_substituteType(self_, type_) {
557
+ {
558
+ const self_a = self_;
559
+ const type_a = type_;
560
+ {
561
+ if(type_a.TVariable) {
562
+ const at_ = type_a.at_;
563
+ const i_ = type_a.index_;
564
+ if(ff_compiler_Substitution.Substitution_has(self_, i_)) {
565
+ return ff_compiler_Substitution.Substitution_substituteType(self_, ff_compiler_Substitution.Substitution_get(self_, i_))
566
+ } else {
567
+ return ff_compiler_Syntax.TConstructor(at_, ff_compiler_Substitution.core_("Nothing"), ff_core_List.Empty())
568
+ }
569
+ return
570
+ }
571
+ }
572
+ {
573
+ if(type_a.TConstructor) {
574
+ const t_ = type_a;
575
+ {
576
+ const _1 = t_;
577
+ {
578
+ const _c = _1;
579
+ return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((t_) => {
580
+ return ff_compiler_Substitution.Substitution_substituteType(self_, t_)
581
+ })))
582
+ return
583
+ }
584
+ }
585
+ return
586
+ }
587
+ }
588
+ }
589
+ }
590
+
591
+ export function Substitution_get(self_, index_) {
592
+ {
593
+ const _1 = ff_core_Map.Map_grab(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
594
+ {
595
+ if(_1.TVariable) {
596
+ const i_ = _1.index_;
597
+ const _guard1 = ff_compiler_Substitution.Substitution_has(self_, i_);
598
+ if(_guard1) {
599
+ const t_ = ff_compiler_Substitution.Substitution_get(self_, i_);
600
+ self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, t_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
601
+ return t_
602
+ return
603
+ }
604
+ }
605
+ }
606
+ {
607
+ if(_1.TVariable) {
608
+ const at_ = _1.at_;
609
+ return ff_compiler_Syntax.TConstructor(at_, ff_compiler_Substitution.core_("Nothing"), ff_core_List.Empty())
610
+ return
611
+ }
612
+ }
613
+ {
614
+ const t_ = _1;
615
+ return t_
616
+ return
617
+ }
618
+ }
619
+ }
620
+
621
+ export function Substitution_has(self_, index_) {
622
+ return ff_core_Map.Map_contains(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
623
+ }
624
+
625
+ export async function Substitution_substituteModule$(self_, module_, $task) {
626
+ const lets_ = ff_core_List.List_map(module_.lets_, ((_w1) => {
627
+ return ff_compiler_Substitution.Substitution_substituteLetDefinition(self_, _w1)
628
+ }));
629
+ const functions_ = ff_core_List.List_map(module_.functions_, ((_w1) => {
630
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
631
+ }));
632
+ const extends_ = ff_core_List.List_map(module_.extends_, ((_w1) => {
633
+ return ff_compiler_Substitution.Substitution_substituteExtendDefinition(self_, _w1)
634
+ }));
635
+ const instances_ = ff_core_List.List_map(module_.instances_, ((_w1) => {
636
+ return ff_compiler_Substitution.Substitution_substituteInstanceDefinition(self_, _w1)
637
+ }));
638
+ {
639
+ const _1 = module_;
640
+ {
641
+ const _c = _1;
642
+ return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, _c.imports_, _c.types_, _c.traits_, instances_, extends_, lets_, functions_)
643
+ return
644
+ }
645
+ }
646
+ }
647
+
648
+ export async function Substitution_substituteLetDefinition$(self_, definition_, $task) {
649
+ {
650
+ const _1 = definition_;
651
+ {
652
+ const _c = _1;
653
+ return ff_compiler_Syntax.DLet(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, definition_.variableType_), ff_compiler_Substitution.Substitution_substituteTerm(self_, definition_.value_))
654
+ return
655
+ }
656
+ }
657
+ }
658
+
659
+ export async function Substitution_substituteExtendDefinition$(self_, definition_, $task) {
660
+ {
661
+ const _1 = definition_;
662
+ {
663
+ const _c = _1;
664
+ return ff_compiler_Syntax.DExtend(_c.at_, _c.name_, _c.generics_, _c.constraints_, _c.type_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
665
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
666
+ })))
667
+ return
668
+ }
669
+ }
670
+ }
671
+
672
+ export async function Substitution_substituteFunctionDefinition$(self_, definition_, $task) {
673
+ {
674
+ const _1 = definition_;
675
+ {
676
+ const _c = _1;
677
+ return ff_compiler_Syntax.DFunction(_c.at_, ff_compiler_Substitution.Substitution_substituteSignature(self_, definition_.signature_), ff_compiler_Syntax.Target_mapFirefly(definition_.body_, ((_w1) => {
678
+ return ff_compiler_Substitution.Substitution_substituteLambda(self_, _w1)
679
+ })))
680
+ return
681
+ }
682
+ }
683
+ }
684
+
685
+ export async function Substitution_substituteSignature$(self_, signature_, $task) {
686
+ {
687
+ const _1 = signature_;
688
+ {
689
+ const _c = _1;
690
+ return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, _c.generics_, ff_core_List.List_map(signature_.constraints_, ((_w1) => {
691
+ return ff_compiler_Substitution.Substitution_substituteConstraint(self_, _w1)
692
+ })), ff_core_List.List_map(signature_.parameters_, ((_w1) => {
693
+ return ff_compiler_Substitution.Substitution_substituteParameter(self_, _w1)
694
+ })), ff_compiler_Substitution.Substitution_substituteType(self_, signature_.returnType_), ff_compiler_Substitution.Substitution_substituteType(self_, signature_.effect_))
695
+ return
696
+ }
697
+ }
698
+ }
699
+
700
+ export async function Substitution_substituteConstraint$(self_, constraint_, $task) {
701
+ {
702
+ const _1 = constraint_;
703
+ {
704
+ const _c = _1;
705
+ return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, ff_core_List.List_map(constraint_.generics_, ((_w1) => {
706
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
707
+ })))
708
+ return
709
+ }
710
+ }
711
+ }
712
+
713
+ export async function Substitution_substituteParameter$(self_, parameter_, $task) {
714
+ {
715
+ const _1 = parameter_;
716
+ {
717
+ const _c = _1;
718
+ return ff_compiler_Syntax.Parameter(_c.at_, _c.mutable_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, parameter_.valueType_), ff_core_Option.Option_map(parameter_.default_, ((_w1) => {
719
+ return ff_compiler_Substitution.Substitution_substituteTerm(self_, _w1)
720
+ })))
721
+ return
722
+ }
723
+ }
724
+ }
725
+
726
+ export async function Substitution_substituteInstanceDefinition$(self_, definition_, $task) {
727
+ {
728
+ const _1 = definition_;
729
+ {
730
+ const _c = _1;
731
+ return ff_compiler_Syntax.DInstance(_c.at_, _c.generics_, _c.constraints_, _c.traitName_, _c.typeArguments_, _c.generatorArguments_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
732
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
733
+ })), _c.derived_)
734
+ return
735
+ }
736
+ }
737
+ }
738
+
739
+ export async function Substitution_substituteLambda$(self_, definition_, $task) {
740
+ {
741
+ const _1 = definition_;
742
+ {
743
+ const _c = _1;
744
+ return ff_compiler_Syntax.Lambda(_c.at_, ff_compiler_Substitution.Substitution_substituteType(self_, definition_.effect_), ff_core_List.List_map(definition_.cases_, ((case_) => {
745
+ {
746
+ const _1 = case_;
747
+ {
748
+ const _c = _1;
749
+ return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_, ff_core_List.List_map(case_.guards_, ((g_) => {
750
+ {
751
+ const _1 = g_;
752
+ {
753
+ const _c = _1;
754
+ return ff_compiler_Syntax.MatchGuard(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, g_.term_), _c.pattern_)
755
+ return
756
+ }
757
+ }
758
+ })), ff_compiler_Substitution.Substitution_substituteTerm(self_, case_.body_))
759
+ return
760
+ }
761
+ }
762
+ })))
763
+ return
764
+ }
765
+ }
766
+ }
767
+
768
+ export async function Substitution_substituteTerm$(self_, term_, $task) {
769
+ {
770
+ const _1 = term_;
771
+ {
772
+ if(_1.EString) {
773
+ return term_
774
+ return
775
+ }
776
+ }
777
+ {
778
+ if(_1.EChar) {
779
+ return term_
780
+ return
781
+ }
782
+ }
783
+ {
784
+ if(_1.EInt) {
785
+ return term_
786
+ return
787
+ }
788
+ }
789
+ {
790
+ if(_1.EFloat) {
791
+ return term_
792
+ return
793
+ }
794
+ }
795
+ {
796
+ if(_1.EVariable) {
797
+ return term_
798
+ return
799
+ }
800
+ }
801
+ {
802
+ if(_1.EField) {
803
+ const e_ = _1;
804
+ {
805
+ const _1 = e_;
806
+ {
807
+ const _c = _1;
808
+ return ff_compiler_Syntax.EField(_c.at_, _c.newtype_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), _c.field_)
809
+ return
810
+ }
811
+ }
812
+ return
813
+ }
814
+ }
815
+ {
816
+ if(_1.EWildcard) {
817
+ const e_ = _1;
818
+ return term_
819
+ return
820
+ }
821
+ }
822
+ {
823
+ if(_1.EList) {
824
+ const e_ = _1;
825
+ {
826
+ const _1 = e_;
827
+ {
828
+ const _c = _1;
829
+ return ff_compiler_Syntax.EList(_c.at_, ff_compiler_Substitution.Substitution_substituteType(self_, e_.elementType_), ff_core_List.List_map(e_.items_, ((_1) => {
830
+ {
831
+ const item_ = _1.first_;
832
+ const b_ = _1.second_;
833
+ return ff_core_Pair.Pair(ff_compiler_Substitution.Substitution_substituteTerm(self_, item_), b_)
834
+ return
835
+ }
836
+ })))
837
+ return
838
+ }
839
+ }
840
+ return
841
+ }
842
+ }
843
+ {
844
+ if(_1.ESequential) {
845
+ const e_ = _1;
846
+ {
847
+ const _1 = e_;
848
+ {
849
+ const _c = _1;
850
+ return ff_compiler_Syntax.ESequential(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.before_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.after_))
851
+ return
852
+ }
853
+ }
854
+ return
855
+ }
856
+ }
857
+ {
858
+ if(_1.ELet) {
859
+ const e_ = _1;
860
+ {
861
+ const _1 = e_;
862
+ {
863
+ const _c = _1;
864
+ return ff_compiler_Syntax.ELet(_c.at_, _c.mutable_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, e_.valueType_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.body_))
865
+ return
866
+ }
867
+ }
868
+ return
869
+ }
870
+ }
871
+ {
872
+ if(_1.ELambda) {
873
+ const e_ = _1;
874
+ {
875
+ const _1 = e_;
876
+ {
877
+ const _c = _1;
878
+ return ff_compiler_Syntax.ELambda(_c.at_, ff_compiler_Substitution.Substitution_substituteLambda(self_, e_.lambda_))
879
+ return
880
+ }
881
+ }
882
+ return
883
+ }
884
+ }
885
+ {
886
+ if(_1.EVariant) {
887
+ const e_ = _1;
888
+ {
889
+ const _1 = e_;
890
+ {
891
+ const _c = _1;
892
+ return ff_compiler_Syntax.EVariant(_c.at_, _c.name_, ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
893
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
894
+ })), ff_core_Option.Option_map(e_.arguments_, ((_w1) => {
895
+ return ff_core_List.List_map(_w1, ((_w1) => {
896
+ return ff_compiler_Substitution.Substitution_substituteArgument(self_, _w1)
897
+ }))
898
+ })))
899
+ return
900
+ }
901
+ }
902
+ return
903
+ }
904
+ }
905
+ {
906
+ if(_1.EVariantIs) {
907
+ const e_ = _1;
908
+ {
909
+ const _1 = e_;
910
+ {
911
+ const _c = _1;
912
+ return ff_compiler_Syntax.EVariantIs(_c.at_, _c.name_, ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
913
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
914
+ })))
915
+ return
916
+ }
917
+ }
918
+ return
919
+ }
920
+ }
921
+ {
922
+ if(_1.ECopy) {
923
+ const e_ = _1;
924
+ {
925
+ const _1 = e_;
926
+ {
927
+ const _c = _1;
928
+ return ff_compiler_Syntax.ECopy(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), ff_core_List.List_map(e_.arguments_, ((_w1) => {
929
+ return ff_compiler_Substitution.Substitution_substituteField(self_, _w1)
930
+ })))
931
+ return
932
+ }
933
+ }
934
+ return
935
+ }
936
+ }
937
+ {
938
+ if(_1.EPipe) {
939
+ const e_ = _1;
940
+ {
941
+ const _1 = e_;
942
+ {
943
+ const _c = _1;
944
+ return ff_compiler_Syntax.EPipe(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_), ff_compiler_Substitution.Substitution_substituteType(self_, e_.effect_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.function_))
945
+ return
946
+ }
947
+ }
948
+ return
949
+ }
950
+ }
951
+ {
952
+ if(_1.ECall) {
953
+ const e_ = _1;
954
+ {
955
+ const _1 = e_;
956
+ {
957
+ const _c = _1;
958
+ return ff_compiler_Syntax.ECall(_c.at_, (((_1) => {
959
+ {
960
+ if(_1.DynamicCall) {
961
+ const call_ = _1;
962
+ {
963
+ const _1 = call_;
964
+ {
965
+ const _c = _1;
966
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Substitution.Substitution_substituteTerm(self_, call_.function_), _c.tailCall_)
967
+ return
968
+ }
969
+ }
970
+ return
971
+ }
972
+ }
973
+ {
974
+ if(_1.StaticCall) {
975
+ return e_.target_
976
+ return
977
+ }
978
+ }
979
+ }))(e_.target_), ff_compiler_Substitution.Substitution_substituteType(self_, e_.effect_), ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
980
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
981
+ })), ff_core_List.List_map(e_.arguments_, ((_w1) => {
982
+ return ff_compiler_Substitution.Substitution_substituteArgument(self_, _w1)
983
+ })), _c.dictionaries_)
984
+ return
985
+ }
986
+ }
987
+ return
988
+ }
989
+ }
990
+ {
991
+ if(_1.ERecord) {
992
+ const e_ = _1;
993
+ {
994
+ const _1 = e_;
995
+ {
996
+ const _c = _1;
997
+ return ff_compiler_Syntax.ERecord(_c.at_, ff_core_List.List_map(e_.fields_, ((_w1) => {
998
+ return ff_compiler_Substitution.Substitution_substituteField(self_, _w1)
999
+ })))
1000
+ return
1001
+ }
1002
+ }
1003
+ return
1004
+ }
1005
+ }
1006
+ {
1007
+ if(_1.EFunctions) {
1008
+ const e_ = _1;
1009
+ {
1010
+ const _1 = e_;
1011
+ {
1012
+ const _c = _1;
1013
+ return ff_compiler_Syntax.EFunctions(_c.at_, ff_core_List.List_map(e_.functions_, ((_w1) => {
1014
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
1015
+ })), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.body_))
1016
+ return
1017
+ }
1018
+ }
1019
+ return
1020
+ }
1021
+ }
1022
+ {
1023
+ if(_1.EAssign) {
1024
+ const e_ = _1;
1025
+ {
1026
+ const _1 = e_;
1027
+ {
1028
+ const _c = _1;
1029
+ return ff_compiler_Syntax.EAssign(_c.at_, _c.operator_, _c.variable_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_))
1030
+ return
1031
+ }
1032
+ }
1033
+ return
1034
+ }
1035
+ }
1036
+ {
1037
+ if(_1.EAssignField) {
1038
+ const e_ = _1;
1039
+ {
1040
+ const _1 = e_;
1041
+ {
1042
+ const _c = _1;
1043
+ return ff_compiler_Syntax.EAssignField(_c.at_, _c.operator_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), _c.field_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_))
1044
+ return
1045
+ }
1046
+ }
1047
+ return
1048
+ }
1049
+ }
1050
+ }
1051
+ }
1052
+
1053
+ export async function Substitution_substituteArgument$(self_, argument_, $task) {
1054
+ {
1055
+ const _1 = argument_;
1056
+ {
1057
+ const _c = _1;
1058
+ return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, argument_.value_))
1059
+ return
1060
+ }
1061
+ }
1062
+ }
1063
+
1064
+ export async function Substitution_substituteField$(self_, field_, $task) {
1065
+ {
1066
+ const _1 = field_;
1067
+ {
1068
+ const _c = _1;
1069
+ return ff_compiler_Syntax.Field(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, field_.value_))
1070
+ return
1071
+ }
1072
+ }
1073
+ }
1074
+
1075
+ export async function Substitution_substituteType$(self_, type_, $task) {
1076
+ {
1077
+ const self_a = self_;
1078
+ const type_a = type_;
1079
+ {
1080
+ if(type_a.TVariable) {
1081
+ const at_ = type_a.at_;
1082
+ const i_ = type_a.index_;
1083
+ if(ff_compiler_Substitution.Substitution_has(self_, i_)) {
1084
+ return ff_compiler_Substitution.Substitution_substituteType(self_, ff_compiler_Substitution.Substitution_get(self_, i_))
1085
+ } else {
1086
+ return ff_compiler_Syntax.TConstructor(at_, ff_compiler_Substitution.core_("Nothing"), ff_core_List.Empty())
1087
+ }
1088
+ return
1089
+ }
1090
+ }
1091
+ {
1092
+ if(type_a.TConstructor) {
1093
+ const t_ = type_a;
1094
+ {
1095
+ const _1 = t_;
1096
+ {
1097
+ const _c = _1;
1098
+ return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((t_) => {
1099
+ return ff_compiler_Substitution.Substitution_substituteType(self_, t_)
1100
+ })))
1101
+ return
1102
+ }
1103
+ }
1104
+ return
1105
+ }
1106
+ }
1107
+ }
1108
+ }
1109
+
1110
+ export async function Substitution_get$(self_, index_, $task) {
1111
+ {
1112
+ const _1 = ff_core_Map.Map_grab(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1113
+ {
1114
+ if(_1.TVariable) {
1115
+ const i_ = _1.index_;
1116
+ const _guard1 = ff_compiler_Substitution.Substitution_has(self_, i_);
1117
+ if(_guard1) {
1118
+ const t_ = ff_compiler_Substitution.Substitution_get(self_, i_);
1119
+ self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, t_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1120
+ return t_
1121
+ return
1122
+ }
1123
+ }
1124
+ }
1125
+ {
1126
+ if(_1.TVariable) {
1127
+ const at_ = _1.at_;
1128
+ return ff_compiler_Syntax.TConstructor(at_, ff_compiler_Substitution.core_("Nothing"), ff_core_List.Empty())
1129
+ return
1130
+ }
1131
+ }
1132
+ {
1133
+ const t_ = _1;
1134
+ return t_
1135
+ return
1136
+ }
1137
+ }
1138
+ }
1139
+
1140
+ export async function Substitution_has$(self_, index_, $task) {
1141
+ return ff_core_Map.Map_contains(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
1142
+ }
1143
+
1144
+
1145
+
1146
+