firefly-compiler 0.4.19 → 0.4.21

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 (68) hide show
  1. package/compiler/Builder.ff +23 -13
  2. package/compiler/JsEmitter.ff +120 -76
  3. package/compiler/LspHook.ff +17 -3
  4. package/compiler/Main.ff +13 -7
  5. package/compiler/Parser.ff +11 -13
  6. package/compiler/Resolver.ff +15 -15
  7. package/compiler/Syntax.ff +1 -0
  8. package/core/Array.ff +6 -4
  9. package/core/Int.ff +12 -12
  10. package/core/Json.ff +2 -2
  11. package/core/List.ff +6 -4
  12. package/experimental/benchmarks/ListGrab.ff +23 -0
  13. package/experimental/benchmarks/ListGrab.java +55 -0
  14. package/experimental/benchmarks/Pyrotek45.ff +30 -0
  15. package/experimental/benchmarks/Pyrotek45.java +64 -0
  16. package/experimental/tests/TestJson.ff +26 -0
  17. package/lsp/CompletionHandler.ff +14 -14
  18. package/lsp/Handler.ff +56 -60
  19. package/lsp/SignatureHelpHandler.ff +5 -4
  20. package/lsp/SymbolHandler.ff +18 -4
  21. package/lsp/TestReferences.ff +15 -0
  22. package/lsp/TestReferencesCase.ff +8 -0
  23. package/output/js/ff/compiler/Builder.mjs +50 -44
  24. package/output/js/ff/compiler/Dependencies.mjs +0 -2
  25. package/output/js/ff/compiler/Deriver.mjs +16 -140
  26. package/output/js/ff/compiler/Dictionaries.mjs +8 -222
  27. package/output/js/ff/compiler/Environment.mjs +12 -154
  28. package/output/js/ff/compiler/Inference.mjs +127 -1013
  29. package/output/js/ff/compiler/JsEmitter.mjs +434 -2344
  30. package/output/js/ff/compiler/JsImporter.mjs +0 -12
  31. package/output/js/ff/compiler/LspHook.mjs +548 -151
  32. package/output/js/ff/compiler/Main.mjs +96 -550
  33. package/output/js/ff/compiler/Parser.mjs +58 -390
  34. package/output/js/ff/compiler/Patterns.mjs +20 -200
  35. package/output/js/ff/compiler/Resolver.mjs +26 -340
  36. package/output/js/ff/compiler/Substitution.mjs +2 -160
  37. package/output/js/ff/compiler/Syntax.mjs +449 -3293
  38. package/output/js/ff/compiler/Token.mjs +9 -1095
  39. package/output/js/ff/compiler/Tokenizer.mjs +4 -2
  40. package/output/js/ff/compiler/Unification.mjs +26 -360
  41. package/output/js/ff/compiler/Wildcards.mjs +0 -86
  42. package/output/js/ff/compiler/Workspace.mjs +8 -96
  43. package/output/js/ff/core/Array.mjs +15 -8
  44. package/output/js/ff/core/AssetSystem.mjs +4 -14
  45. package/output/js/ff/core/Bool.mjs +0 -12
  46. package/output/js/ff/core/Core.mjs +0 -30
  47. package/output/js/ff/core/Int.mjs +24 -24
  48. package/output/js/ff/core/IntMap.mjs +0 -8
  49. package/output/js/ff/core/Json.mjs +2 -42
  50. package/output/js/ff/core/List.mjs +23 -32
  51. package/output/js/ff/core/Lock.mjs +0 -10
  52. package/output/js/ff/core/Map.mjs +0 -24
  53. package/output/js/ff/core/Option.mjs +10 -286
  54. package/output/js/ff/core/Ordering.mjs +16 -158
  55. package/output/js/ff/core/Pair.mjs +2 -34
  56. package/output/js/ff/core/Path.mjs +2 -28
  57. package/output/js/ff/core/Random.mjs +4 -4
  58. package/output/js/ff/core/RbMap.mjs +56 -644
  59. package/output/js/ff/core/Show.mjs +0 -16
  60. package/output/js/ff/core/Stream.mjs +14 -144
  61. package/output/js/ff/core/StringMap.mjs +0 -8
  62. package/output/js/ff/core/Try.mjs +4 -108
  63. package/output/js/ff/core/Unit.mjs +2 -16
  64. package/package.json +1 -1
  65. package/postgresql/Pg.ff +23 -23
  66. package/vscode/client/src/extension.ts +30 -2
  67. package/vscode/package.json +17 -1
  68. package/core/Stack.ff +0 -250
@@ -118,10 +118,8 @@ return ff_core_Core.panic_(((message_ + " ") + ff_compiler_Syntax.Location_show(
118
118
  }
119
119
 
120
120
  export function Wildcards_fixWildcards(self_, term_) {
121
- {
122
121
  const self_a = self_;
123
122
  const term_a = term_;
124
- {
125
123
  if(term_a.ELet) {
126
124
  const e_ = term_a;
127
125
  {
@@ -129,13 +127,10 @@ const _1 = e_;
129
127
  {
130
128
  const _c = _1;
131
129
  return ff_compiler_Syntax.ELet(_c.at_, _c.mutable_, _c.name_, _c.valueType_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.value_), ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.body_))
132
- return
133
130
  }
134
131
  }
135
132
  return
136
133
  }
137
- }
138
- {
139
134
  if(term_a.ESequential) {
140
135
  const e_ = term_a;
141
136
  {
@@ -143,13 +138,10 @@ const _1 = e_;
143
138
  {
144
139
  const _c = _1;
145
140
  return ff_compiler_Syntax.ESequential(_c.at_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.before_), ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.after_))
146
- return
147
141
  }
148
142
  }
149
143
  return
150
144
  }
151
- }
152
- {
153
145
  if(term_a.EAssign) {
154
146
  const e_ = term_a;
155
147
  {
@@ -157,13 +149,10 @@ const _1 = e_;
157
149
  {
158
150
  const _c = _1;
159
151
  return ff_compiler_Syntax.EAssign(_c.at_, _c.operator_, _c.variable_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.value_))
160
- return
161
152
  }
162
153
  }
163
154
  return
164
155
  }
165
- }
166
- {
167
156
  if(term_a.EAssignField) {
168
157
  const e_ = term_a;
169
158
  {
@@ -171,13 +160,10 @@ const _1 = e_;
171
160
  {
172
161
  const _c = _1;
173
162
  return ff_compiler_Syntax.EAssignField(_c.at_, _c.operator_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.record_), _c.field_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.value_))
174
- return
175
163
  }
176
164
  }
177
165
  return
178
166
  }
179
- }
180
- {
181
167
  if(term_a.EPipe) {
182
168
  const e_ = term_a;
183
169
  {
@@ -185,13 +171,10 @@ const _1 = e_;
185
171
  {
186
172
  const _c = _1;
187
173
  return ff_compiler_Syntax.EPipe(_c.at_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.value_), _c.effect_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.function_))
188
- return
189
174
  }
190
175
  }
191
176
  return
192
177
  }
193
- }
194
- {
195
178
  if(term_a.ECall) {
196
179
  const e_ = term_a;
197
180
  {
@@ -199,7 +182,6 @@ const _1 = e_;
199
182
  {
200
183
  const _c = _1;
201
184
  return ff_compiler_Syntax.ECall(_c.at_, (((_1) => {
202
- {
203
185
  if(_1.DynamicCall) {
204
186
  const call_ = _1;
205
187
  {
@@ -207,15 +189,12 @@ const _1 = call_;
207
189
  {
208
190
  const _c = _1;
209
191
  return ff_compiler_Syntax.DynamicCall(ff_compiler_Wildcards.Wildcards_fixWildcards(self_, call_.function_), _c.tailCall_)
210
- return
211
192
  }
212
193
  }
213
194
  return
214
195
  }
215
- }
216
196
  {
217
197
  return ff_compiler_Wildcards.fail_(e_.at_, "Internal error: Static calls not expected in the Wildcards phase")
218
- return
219
198
  }
220
199
  }))(e_.target_), _c.effect_, _c.typeArguments_, ff_core_List.List_map(e_.arguments_, ((a_) => {
221
200
  {
@@ -223,7 +202,6 @@ const _1 = a_;
223
202
  {
224
203
  const _c = _1;
225
204
  return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, a_.value_))
226
- return
227
205
  }
228
206
  }
229
207
  })), _c.dictionaries_)
@@ -232,8 +210,6 @@ return
232
210
  }
233
211
  return
234
212
  }
235
- }
236
- {
237
213
  if(term_a.EList) {
238
214
  const e_ = term_a;
239
215
  {
@@ -245,7 +221,6 @@ return ff_compiler_Syntax.EList(_c.at_, _c.elementType_, ff_core_List.List_map(e
245
221
  const item_ = _1.first_;
246
222
  const spread_ = _1.second_;
247
223
  return ff_core_Pair.Pair(ff_compiler_Wildcards.Wildcards_fixWildcards(self_, item_), spread_)
248
- return
249
224
  }
250
225
  })))
251
226
  return
@@ -253,8 +228,6 @@ return
253
228
  }
254
229
  return
255
230
  }
256
- }
257
- {
258
231
  if(term_a.ECopy) {
259
232
  const e_ = term_a;
260
233
  {
@@ -267,7 +240,6 @@ const _1 = a_;
267
240
  {
268
241
  const _c = _1;
269
242
  return ff_compiler_Syntax.Field(_c.at_, _c.name_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, a_.value_))
270
- return
271
243
  }
272
244
  }
273
245
  })))
@@ -276,8 +248,6 @@ return
276
248
  }
277
249
  return
278
250
  }
279
- }
280
- {
281
251
  if(term_a.EVariant) {
282
252
  const e_ = term_a;
283
253
  {
@@ -291,7 +261,6 @@ const _1 = a_;
291
261
  {
292
262
  const _c = _1;
293
263
  return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, a_.value_))
294
- return
295
264
  }
296
265
  }
297
266
  }))
@@ -301,8 +270,6 @@ return
301
270
  }
302
271
  return
303
272
  }
304
- }
305
- {
306
273
  if(term_a.ERecord) {
307
274
  const e_ = term_a;
308
275
  {
@@ -315,7 +282,6 @@ const _1 = a_;
315
282
  {
316
283
  const _c = _1;
317
284
  return ff_compiler_Syntax.Field(_c.at_, _c.name_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, a_.value_))
318
- return
319
285
  }
320
286
  }
321
287
  })))
@@ -324,8 +290,6 @@ return
324
290
  }
325
291
  return
326
292
  }
327
- }
328
- {
329
293
  if(term_a.EField) {
330
294
  const e_ = term_a;
331
295
  {
@@ -333,13 +297,10 @@ const _1 = e_;
333
297
  {
334
298
  const _c = _1;
335
299
  return ff_compiler_Syntax.EField(_c.at_, _c.newtype_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.record_), _c.field_)
336
- return
337
300
  }
338
301
  }
339
302
  return
340
303
  }
341
- }
342
- {
343
304
  if(term_a.EWildcard) {
344
305
  const e_ = term_a;
345
306
  self_.seenWildcards_ += 1;
@@ -348,24 +309,18 @@ const _1 = e_;
348
309
  {
349
310
  const _c = _1;
350
311
  return ff_compiler_Syntax.EWildcard(_c.at_, self_.seenWildcards_)
351
- return
352
312
  }
353
313
  }
354
314
  return
355
315
  }
356
- }
357
316
  {
358
317
  return term_
359
- return
360
- }
361
318
  }
362
319
  }
363
320
 
364
321
  export async function Wildcards_fixWildcards$(self_, term_, $task) {
365
- {
366
322
  const self_a = self_;
367
323
  const term_a = term_;
368
- {
369
324
  if(term_a.ELet) {
370
325
  const e_ = term_a;
371
326
  {
@@ -373,13 +328,10 @@ const _1 = e_;
373
328
  {
374
329
  const _c = _1;
375
330
  return ff_compiler_Syntax.ELet(_c.at_, _c.mutable_, _c.name_, _c.valueType_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.value_), ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.body_))
376
- return
377
331
  }
378
332
  }
379
333
  return
380
334
  }
381
- }
382
- {
383
335
  if(term_a.ESequential) {
384
336
  const e_ = term_a;
385
337
  {
@@ -387,13 +339,10 @@ const _1 = e_;
387
339
  {
388
340
  const _c = _1;
389
341
  return ff_compiler_Syntax.ESequential(_c.at_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.before_), ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.after_))
390
- return
391
342
  }
392
343
  }
393
344
  return
394
345
  }
395
- }
396
- {
397
346
  if(term_a.EAssign) {
398
347
  const e_ = term_a;
399
348
  {
@@ -401,13 +350,10 @@ const _1 = e_;
401
350
  {
402
351
  const _c = _1;
403
352
  return ff_compiler_Syntax.EAssign(_c.at_, _c.operator_, _c.variable_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.value_))
404
- return
405
353
  }
406
354
  }
407
355
  return
408
356
  }
409
- }
410
- {
411
357
  if(term_a.EAssignField) {
412
358
  const e_ = term_a;
413
359
  {
@@ -415,13 +361,10 @@ const _1 = e_;
415
361
  {
416
362
  const _c = _1;
417
363
  return ff_compiler_Syntax.EAssignField(_c.at_, _c.operator_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.record_), _c.field_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.value_))
418
- return
419
364
  }
420
365
  }
421
366
  return
422
367
  }
423
- }
424
- {
425
368
  if(term_a.EPipe) {
426
369
  const e_ = term_a;
427
370
  {
@@ -429,13 +372,10 @@ const _1 = e_;
429
372
  {
430
373
  const _c = _1;
431
374
  return ff_compiler_Syntax.EPipe(_c.at_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.value_), _c.effect_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.function_))
432
- return
433
375
  }
434
376
  }
435
377
  return
436
378
  }
437
- }
438
- {
439
379
  if(term_a.ECall) {
440
380
  const e_ = term_a;
441
381
  {
@@ -443,7 +383,6 @@ const _1 = e_;
443
383
  {
444
384
  const _c = _1;
445
385
  return ff_compiler_Syntax.ECall(_c.at_, (((_1) => {
446
- {
447
386
  if(_1.DynamicCall) {
448
387
  const call_ = _1;
449
388
  {
@@ -451,15 +390,12 @@ const _1 = call_;
451
390
  {
452
391
  const _c = _1;
453
392
  return ff_compiler_Syntax.DynamicCall(ff_compiler_Wildcards.Wildcards_fixWildcards(self_, call_.function_), _c.tailCall_)
454
- return
455
393
  }
456
394
  }
457
395
  return
458
396
  }
459
- }
460
397
  {
461
398
  return ff_compiler_Wildcards.fail_(e_.at_, "Internal error: Static calls not expected in the Wildcards phase")
462
- return
463
399
  }
464
400
  }))(e_.target_), _c.effect_, _c.typeArguments_, ff_core_List.List_map(e_.arguments_, ((a_) => {
465
401
  {
@@ -467,7 +403,6 @@ const _1 = a_;
467
403
  {
468
404
  const _c = _1;
469
405
  return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, a_.value_))
470
- return
471
406
  }
472
407
  }
473
408
  })), _c.dictionaries_)
@@ -476,8 +411,6 @@ return
476
411
  }
477
412
  return
478
413
  }
479
- }
480
- {
481
414
  if(term_a.EList) {
482
415
  const e_ = term_a;
483
416
  {
@@ -489,7 +422,6 @@ return ff_compiler_Syntax.EList(_c.at_, _c.elementType_, ff_core_List.List_map(e
489
422
  const item_ = _1.first_;
490
423
  const spread_ = _1.second_;
491
424
  return ff_core_Pair.Pair(ff_compiler_Wildcards.Wildcards_fixWildcards(self_, item_), spread_)
492
- return
493
425
  }
494
426
  })))
495
427
  return
@@ -497,8 +429,6 @@ return
497
429
  }
498
430
  return
499
431
  }
500
- }
501
- {
502
432
  if(term_a.ECopy) {
503
433
  const e_ = term_a;
504
434
  {
@@ -511,7 +441,6 @@ const _1 = a_;
511
441
  {
512
442
  const _c = _1;
513
443
  return ff_compiler_Syntax.Field(_c.at_, _c.name_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, a_.value_))
514
- return
515
444
  }
516
445
  }
517
446
  })))
@@ -520,8 +449,6 @@ return
520
449
  }
521
450
  return
522
451
  }
523
- }
524
- {
525
452
  if(term_a.EVariant) {
526
453
  const e_ = term_a;
527
454
  {
@@ -535,7 +462,6 @@ const _1 = a_;
535
462
  {
536
463
  const _c = _1;
537
464
  return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, a_.value_))
538
- return
539
465
  }
540
466
  }
541
467
  }))
@@ -545,8 +471,6 @@ return
545
471
  }
546
472
  return
547
473
  }
548
- }
549
- {
550
474
  if(term_a.ERecord) {
551
475
  const e_ = term_a;
552
476
  {
@@ -559,7 +483,6 @@ const _1 = a_;
559
483
  {
560
484
  const _c = _1;
561
485
  return ff_compiler_Syntax.Field(_c.at_, _c.name_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, a_.value_))
562
- return
563
486
  }
564
487
  }
565
488
  })))
@@ -568,8 +491,6 @@ return
568
491
  }
569
492
  return
570
493
  }
571
- }
572
- {
573
494
  if(term_a.EField) {
574
495
  const e_ = term_a;
575
496
  {
@@ -577,13 +498,10 @@ const _1 = e_;
577
498
  {
578
499
  const _c = _1;
579
500
  return ff_compiler_Syntax.EField(_c.at_, _c.newtype_, ff_compiler_Wildcards.Wildcards_fixWildcards(self_, e_.record_), _c.field_)
580
- return
581
501
  }
582
502
  }
583
503
  return
584
504
  }
585
- }
586
- {
587
505
  if(term_a.EWildcard) {
588
506
  const e_ = term_a;
589
507
  self_.seenWildcards_ += 1;
@@ -592,16 +510,12 @@ const _1 = e_;
592
510
  {
593
511
  const _c = _1;
594
512
  return ff_compiler_Syntax.EWildcard(_c.at_, self_.seenWildcards_)
595
- return
596
513
  }
597
514
  }
598
515
  return
599
516
  }
600
- }
601
517
  {
602
518
  return term_
603
- return
604
- }
605
519
  }
606
520
  }
607
521