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.
- package/compiler/Builder.ff +23 -13
- package/compiler/JsEmitter.ff +120 -76
- package/compiler/LspHook.ff +17 -3
- package/compiler/Main.ff +13 -7
- package/compiler/Parser.ff +11 -13
- package/compiler/Resolver.ff +15 -15
- package/compiler/Syntax.ff +1 -0
- package/core/Array.ff +6 -4
- package/core/Int.ff +12 -12
- package/core/Json.ff +2 -2
- package/core/List.ff +6 -4
- package/experimental/benchmarks/ListGrab.ff +23 -0
- package/experimental/benchmarks/ListGrab.java +55 -0
- package/experimental/benchmarks/Pyrotek45.ff +30 -0
- package/experimental/benchmarks/Pyrotek45.java +64 -0
- package/experimental/tests/TestJson.ff +26 -0
- package/lsp/CompletionHandler.ff +14 -14
- package/lsp/Handler.ff +56 -60
- package/lsp/SignatureHelpHandler.ff +5 -4
- package/lsp/SymbolHandler.ff +18 -4
- package/lsp/TestReferences.ff +15 -0
- package/lsp/TestReferencesCase.ff +8 -0
- package/output/js/ff/compiler/Builder.mjs +50 -44
- package/output/js/ff/compiler/Dependencies.mjs +0 -2
- package/output/js/ff/compiler/Deriver.mjs +16 -140
- package/output/js/ff/compiler/Dictionaries.mjs +8 -222
- package/output/js/ff/compiler/Environment.mjs +12 -154
- package/output/js/ff/compiler/Inference.mjs +127 -1013
- package/output/js/ff/compiler/JsEmitter.mjs +434 -2344
- package/output/js/ff/compiler/JsImporter.mjs +0 -12
- package/output/js/ff/compiler/LspHook.mjs +548 -151
- package/output/js/ff/compiler/Main.mjs +96 -550
- package/output/js/ff/compiler/Parser.mjs +58 -390
- package/output/js/ff/compiler/Patterns.mjs +20 -200
- package/output/js/ff/compiler/Resolver.mjs +26 -340
- package/output/js/ff/compiler/Substitution.mjs +2 -160
- package/output/js/ff/compiler/Syntax.mjs +449 -3293
- package/output/js/ff/compiler/Token.mjs +9 -1095
- package/output/js/ff/compiler/Tokenizer.mjs +4 -2
- package/output/js/ff/compiler/Unification.mjs +26 -360
- package/output/js/ff/compiler/Wildcards.mjs +0 -86
- package/output/js/ff/compiler/Workspace.mjs +8 -96
- package/output/js/ff/core/Array.mjs +15 -8
- package/output/js/ff/core/AssetSystem.mjs +4 -14
- package/output/js/ff/core/Bool.mjs +0 -12
- package/output/js/ff/core/Core.mjs +0 -30
- package/output/js/ff/core/Int.mjs +24 -24
- package/output/js/ff/core/IntMap.mjs +0 -8
- package/output/js/ff/core/Json.mjs +2 -42
- package/output/js/ff/core/List.mjs +23 -32
- package/output/js/ff/core/Lock.mjs +0 -10
- package/output/js/ff/core/Map.mjs +0 -24
- package/output/js/ff/core/Option.mjs +10 -286
- package/output/js/ff/core/Ordering.mjs +16 -158
- package/output/js/ff/core/Pair.mjs +2 -34
- package/output/js/ff/core/Path.mjs +2 -28
- package/output/js/ff/core/Random.mjs +4 -4
- package/output/js/ff/core/RbMap.mjs +56 -644
- package/output/js/ff/core/Show.mjs +0 -16
- package/output/js/ff/core/Stream.mjs +14 -144
- package/output/js/ff/core/StringMap.mjs +0 -8
- package/output/js/ff/core/Try.mjs +4 -108
- package/output/js/ff/core/Unit.mjs +2 -16
- package/package.json +1 -1
- package/postgresql/Pg.ff +23 -23
- package/vscode/client/src/extension.ts +30 -2
- package/vscode/package.json +17 -1
- package/core/Stack.ff +0 -250
|
@@ -111,7 +111,6 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.G
|
|
|
111
111
|
export function Try_map(self_, body_) {
|
|
112
112
|
{
|
|
113
113
|
const _1 = self_;
|
|
114
|
-
{
|
|
115
114
|
if(_1.Success) {
|
|
116
115
|
const value_ = _1.value_;
|
|
117
116
|
return ff_core_Core.try_((() => {
|
|
@@ -119,13 +118,9 @@ return body_(value_)
|
|
|
119
118
|
}))
|
|
120
119
|
return
|
|
121
120
|
}
|
|
122
|
-
}
|
|
123
|
-
{
|
|
124
121
|
if(_1.Failure) {
|
|
125
122
|
const error_ = _1.error_;
|
|
126
123
|
return ff_core_Try.Failure(error_)
|
|
127
|
-
return
|
|
128
|
-
}
|
|
129
124
|
}
|
|
130
125
|
}
|
|
131
126
|
}
|
|
@@ -137,7 +132,6 @@ return ff_core_Try.Try_flatten(ff_core_Try.Try_map(self_, body_))
|
|
|
137
132
|
export function Try_catch(self_, body_, ff_core_Any_HasAnyTag$E) {
|
|
138
133
|
{
|
|
139
134
|
const _1 = self_;
|
|
140
|
-
{
|
|
141
135
|
if(_1.Failure) {
|
|
142
136
|
const error_ = _1.error_;
|
|
143
137
|
const _guard1 = ff_core_Option.Option_flatMap(ff_core_Error.Error_exception(error_), ((any_) => {
|
|
@@ -151,10 +145,8 @@ return body_(e_, error_)
|
|
|
151
145
|
return
|
|
152
146
|
}
|
|
153
147
|
}
|
|
154
|
-
}
|
|
155
148
|
{
|
|
156
149
|
return self_
|
|
157
|
-
return
|
|
158
150
|
}
|
|
159
151
|
}
|
|
160
152
|
}
|
|
@@ -162,7 +154,6 @@ return
|
|
|
162
154
|
export function Try_catchAny(self_, body_) {
|
|
163
155
|
{
|
|
164
156
|
const _1 = self_;
|
|
165
|
-
{
|
|
166
157
|
if(_1.Failure) {
|
|
167
158
|
const error_ = _1.error_;
|
|
168
159
|
return ff_core_Core.try_((() => {
|
|
@@ -170,10 +161,8 @@ return body_(error_)
|
|
|
170
161
|
}))
|
|
171
162
|
return
|
|
172
163
|
}
|
|
173
|
-
}
|
|
174
164
|
{
|
|
175
165
|
return self_
|
|
176
|
-
return
|
|
177
166
|
}
|
|
178
167
|
}
|
|
179
168
|
}
|
|
@@ -181,7 +170,6 @@ return
|
|
|
181
170
|
export function Try_finally(self_, body_) {
|
|
182
171
|
{
|
|
183
172
|
const _1 = self_;
|
|
184
|
-
{
|
|
185
173
|
if(_1.Success) {
|
|
186
174
|
const value_ = _1.value_;
|
|
187
175
|
return ff_core_Core.try_((() => {
|
|
@@ -190,48 +178,33 @@ return value_
|
|
|
190
178
|
}))
|
|
191
179
|
return
|
|
192
180
|
}
|
|
193
|
-
}
|
|
194
|
-
{
|
|
195
181
|
if(_1.Failure) {
|
|
196
182
|
{
|
|
197
183
|
const _1 = ff_core_Core.try_((() => {
|
|
198
184
|
return body_()
|
|
199
185
|
}));
|
|
200
|
-
{
|
|
201
186
|
if(_1.Success) {
|
|
202
187
|
return self_
|
|
203
|
-
return
|
|
204
|
-
}
|
|
205
188
|
}
|
|
206
|
-
{
|
|
207
189
|
if(_1.Failure) {
|
|
208
190
|
const error_ = _1.error_;
|
|
209
191
|
return ff_core_Try.Failure(error_)
|
|
210
|
-
return
|
|
211
|
-
}
|
|
212
192
|
}
|
|
213
193
|
}
|
|
214
194
|
return
|
|
215
195
|
}
|
|
216
196
|
}
|
|
217
197
|
}
|
|
218
|
-
}
|
|
219
198
|
|
|
220
199
|
export function Try_else(self_, body_) {
|
|
221
200
|
{
|
|
222
201
|
const _1 = self_;
|
|
223
|
-
{
|
|
224
202
|
if(_1.Success) {
|
|
225
203
|
const value_ = _1.value_;
|
|
226
204
|
return value_
|
|
227
|
-
return
|
|
228
205
|
}
|
|
229
|
-
}
|
|
230
|
-
{
|
|
231
206
|
if(_1.Failure) {
|
|
232
207
|
return body_()
|
|
233
|
-
return
|
|
234
|
-
}
|
|
235
208
|
}
|
|
236
209
|
}
|
|
237
210
|
}
|
|
@@ -239,19 +212,13 @@ return
|
|
|
239
212
|
export function Try_grab(self_) {
|
|
240
213
|
{
|
|
241
214
|
const _1 = self_;
|
|
242
|
-
{
|
|
243
215
|
if(_1.Success) {
|
|
244
216
|
const value_ = _1.value_;
|
|
245
217
|
return value_
|
|
246
|
-
return
|
|
247
|
-
}
|
|
248
218
|
}
|
|
249
|
-
{
|
|
250
219
|
if(_1.Failure) {
|
|
251
220
|
const error_ = _1.error_;
|
|
252
221
|
return ff_core_Error.Error_rethrow(error_)
|
|
253
|
-
return
|
|
254
|
-
}
|
|
255
222
|
}
|
|
256
223
|
}
|
|
257
224
|
}
|
|
@@ -259,18 +226,12 @@ return
|
|
|
259
226
|
export function Try_toOption(self_) {
|
|
260
227
|
{
|
|
261
228
|
const _1 = self_;
|
|
262
|
-
{
|
|
263
229
|
if(_1.Success) {
|
|
264
230
|
const value_ = _1.value_;
|
|
265
231
|
return ff_core_Option.Some(value_)
|
|
266
|
-
return
|
|
267
|
-
}
|
|
268
232
|
}
|
|
269
|
-
{
|
|
270
233
|
if(_1.Failure) {
|
|
271
234
|
return ff_core_Option.None()
|
|
272
|
-
return
|
|
273
|
-
}
|
|
274
235
|
}
|
|
275
236
|
}
|
|
276
237
|
}
|
|
@@ -278,7 +239,6 @@ return
|
|
|
278
239
|
export async function Try_map$(self_, body_, $task) {
|
|
279
240
|
{
|
|
280
241
|
const _1 = self_;
|
|
281
|
-
{
|
|
282
242
|
if(_1.Success) {
|
|
283
243
|
const value_ = _1.value_;
|
|
284
244
|
return (await ff_core_Core.try_$((async ($task) => {
|
|
@@ -286,13 +246,9 @@ return (await body_(value_, $task))
|
|
|
286
246
|
}), $task))
|
|
287
247
|
return
|
|
288
248
|
}
|
|
289
|
-
}
|
|
290
|
-
{
|
|
291
249
|
if(_1.Failure) {
|
|
292
250
|
const error_ = _1.error_;
|
|
293
251
|
return ff_core_Try.Failure(error_)
|
|
294
|
-
return
|
|
295
|
-
}
|
|
296
252
|
}
|
|
297
253
|
}
|
|
298
254
|
}
|
|
@@ -304,7 +260,6 @@ return ff_core_Try.Try_flatten((await ff_core_Try.Try_map$(self_, body_, $task))
|
|
|
304
260
|
export async function Try_catch$(self_, body_, ff_core_Any_HasAnyTag$E, $task) {
|
|
305
261
|
{
|
|
306
262
|
const _1 = self_;
|
|
307
|
-
{
|
|
308
263
|
if(_1.Failure) {
|
|
309
264
|
const error_ = _1.error_;
|
|
310
265
|
const _guard1 = ff_core_Option.Option_flatMap(ff_core_Error.Error_exception(error_), ((any_) => {
|
|
@@ -318,10 +273,8 @@ return (await body_(e_, error_, $task))
|
|
|
318
273
|
return
|
|
319
274
|
}
|
|
320
275
|
}
|
|
321
|
-
}
|
|
322
276
|
{
|
|
323
277
|
return self_
|
|
324
|
-
return
|
|
325
278
|
}
|
|
326
279
|
}
|
|
327
280
|
}
|
|
@@ -329,7 +282,6 @@ return
|
|
|
329
282
|
export async function Try_catchAny$(self_, body_, $task) {
|
|
330
283
|
{
|
|
331
284
|
const _1 = self_;
|
|
332
|
-
{
|
|
333
285
|
if(_1.Failure) {
|
|
334
286
|
const error_ = _1.error_;
|
|
335
287
|
return (await ff_core_Core.try_$((async ($task) => {
|
|
@@ -337,10 +289,8 @@ return (await body_(error_, $task))
|
|
|
337
289
|
}), $task))
|
|
338
290
|
return
|
|
339
291
|
}
|
|
340
|
-
}
|
|
341
292
|
{
|
|
342
293
|
return self_
|
|
343
|
-
return
|
|
344
294
|
}
|
|
345
295
|
}
|
|
346
296
|
}
|
|
@@ -348,7 +298,6 @@ return
|
|
|
348
298
|
export async function Try_finally$(self_, body_, $task) {
|
|
349
299
|
{
|
|
350
300
|
const _1 = self_;
|
|
351
|
-
{
|
|
352
301
|
if(_1.Success) {
|
|
353
302
|
const value_ = _1.value_;
|
|
354
303
|
return (await ff_core_Core.try_$((async ($task) => {
|
|
@@ -357,48 +306,33 @@ return value_
|
|
|
357
306
|
}), $task))
|
|
358
307
|
return
|
|
359
308
|
}
|
|
360
|
-
}
|
|
361
|
-
{
|
|
362
309
|
if(_1.Failure) {
|
|
363
310
|
{
|
|
364
311
|
const _1 = (await ff_core_Core.try_$((async ($task) => {
|
|
365
312
|
return (await body_($task))
|
|
366
313
|
}), $task));
|
|
367
|
-
{
|
|
368
314
|
if(_1.Success) {
|
|
369
315
|
return self_
|
|
370
|
-
return
|
|
371
|
-
}
|
|
372
316
|
}
|
|
373
|
-
{
|
|
374
317
|
if(_1.Failure) {
|
|
375
318
|
const error_ = _1.error_;
|
|
376
319
|
return ff_core_Try.Failure(error_)
|
|
377
|
-
return
|
|
378
|
-
}
|
|
379
320
|
}
|
|
380
321
|
}
|
|
381
322
|
return
|
|
382
323
|
}
|
|
383
324
|
}
|
|
384
325
|
}
|
|
385
|
-
}
|
|
386
326
|
|
|
387
327
|
export async function Try_else$(self_, body_, $task) {
|
|
388
328
|
{
|
|
389
329
|
const _1 = self_;
|
|
390
|
-
{
|
|
391
330
|
if(_1.Success) {
|
|
392
331
|
const value_ = _1.value_;
|
|
393
332
|
return value_
|
|
394
|
-
return
|
|
395
333
|
}
|
|
396
|
-
}
|
|
397
|
-
{
|
|
398
334
|
if(_1.Failure) {
|
|
399
335
|
return (await body_($task))
|
|
400
|
-
return
|
|
401
|
-
}
|
|
402
336
|
}
|
|
403
337
|
}
|
|
404
338
|
}
|
|
@@ -406,19 +340,13 @@ return
|
|
|
406
340
|
export async function Try_grab$(self_, $task) {
|
|
407
341
|
{
|
|
408
342
|
const _1 = self_;
|
|
409
|
-
{
|
|
410
343
|
if(_1.Success) {
|
|
411
344
|
const value_ = _1.value_;
|
|
412
345
|
return value_
|
|
413
|
-
return
|
|
414
|
-
}
|
|
415
346
|
}
|
|
416
|
-
{
|
|
417
347
|
if(_1.Failure) {
|
|
418
348
|
const error_ = _1.error_;
|
|
419
349
|
return ff_core_Error.Error_rethrow(error_)
|
|
420
|
-
return
|
|
421
|
-
}
|
|
422
350
|
}
|
|
423
351
|
}
|
|
424
352
|
}
|
|
@@ -426,18 +354,12 @@ return
|
|
|
426
354
|
export async function Try_toOption$(self_, $task) {
|
|
427
355
|
{
|
|
428
356
|
const _1 = self_;
|
|
429
|
-
{
|
|
430
357
|
if(_1.Success) {
|
|
431
358
|
const value_ = _1.value_;
|
|
432
359
|
return ff_core_Option.Some(value_)
|
|
433
|
-
return
|
|
434
|
-
}
|
|
435
360
|
}
|
|
436
|
-
{
|
|
437
361
|
if(_1.Failure) {
|
|
438
362
|
return ff_core_Option.None()
|
|
439
|
-
return
|
|
440
|
-
}
|
|
441
363
|
}
|
|
442
364
|
}
|
|
443
365
|
}
|
|
@@ -445,30 +367,17 @@ return
|
|
|
445
367
|
export function Try_flatten(self_) {
|
|
446
368
|
{
|
|
447
369
|
const _1 = self_;
|
|
448
|
-
{
|
|
449
|
-
if(_1.Success) {
|
|
370
|
+
if(_1.Success && _1.value_.Success) {
|
|
450
371
|
const t_ = _1.value_;
|
|
451
|
-
if(_1.value_.Success) {
|
|
452
372
|
return t_
|
|
453
|
-
return
|
|
454
|
-
}
|
|
455
373
|
}
|
|
456
|
-
|
|
457
|
-
{
|
|
458
|
-
if(_1.Success) {
|
|
374
|
+
if(_1.Success && _1.value_.Failure) {
|
|
459
375
|
const t_ = _1.value_;
|
|
460
|
-
if(_1.value_.Failure) {
|
|
461
376
|
return t_
|
|
462
|
-
return
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
377
|
}
|
|
466
|
-
{
|
|
467
378
|
if(_1.Failure) {
|
|
468
379
|
const error_ = _1.error_;
|
|
469
380
|
return ff_core_Try.Failure(error_)
|
|
470
|
-
return
|
|
471
|
-
}
|
|
472
381
|
}
|
|
473
382
|
}
|
|
474
383
|
}
|
|
@@ -476,30 +385,17 @@ return
|
|
|
476
385
|
export async function Try_flatten$(self_, $task) {
|
|
477
386
|
{
|
|
478
387
|
const _1 = self_;
|
|
479
|
-
{
|
|
480
|
-
if(_1.Success) {
|
|
388
|
+
if(_1.Success && _1.value_.Success) {
|
|
481
389
|
const t_ = _1.value_;
|
|
482
|
-
if(_1.value_.Success) {
|
|
483
390
|
return t_
|
|
484
|
-
return
|
|
485
|
-
}
|
|
486
391
|
}
|
|
487
|
-
|
|
488
|
-
{
|
|
489
|
-
if(_1.Success) {
|
|
392
|
+
if(_1.Success && _1.value_.Failure) {
|
|
490
393
|
const t_ = _1.value_;
|
|
491
|
-
if(_1.value_.Failure) {
|
|
492
394
|
return t_
|
|
493
|
-
return
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
395
|
}
|
|
497
|
-
{
|
|
498
396
|
if(_1.Failure) {
|
|
499
397
|
const error_ = _1.error_;
|
|
500
398
|
return ff_core_Try.Failure(error_)
|
|
501
|
-
return
|
|
502
|
-
}
|
|
503
399
|
}
|
|
504
400
|
}
|
|
505
401
|
}
|
|
@@ -115,37 +115,23 @@ return ff_core_Any.internalAnyTag_((("ff:core/Unit.Unit" + "[") + "]"))
|
|
|
115
115
|
|
|
116
116
|
export const ff_core_Equal_Equal$ff_core_Unit_Unit = {
|
|
117
117
|
equals_(x_, y_) {
|
|
118
|
-
{
|
|
119
118
|
const x_a = x_;
|
|
120
119
|
const y_a = y_;
|
|
121
|
-
{
|
|
122
|
-
const _guard1 = (x_ === y_);
|
|
123
|
-
if(_guard1) {
|
|
120
|
+
if((x_ === y_)) {
|
|
124
121
|
return true
|
|
125
|
-
return
|
|
126
|
-
}
|
|
127
122
|
}
|
|
128
123
|
{
|
|
129
124
|
return true
|
|
130
|
-
return
|
|
131
|
-
}
|
|
132
125
|
}
|
|
133
126
|
},
|
|
134
127
|
async equals_$(x_, y_, $task) {
|
|
135
|
-
{
|
|
136
128
|
const x_a = x_;
|
|
137
129
|
const y_a = y_;
|
|
138
|
-
{
|
|
139
|
-
const _guard1 = (x_ === y_);
|
|
140
|
-
if(_guard1) {
|
|
130
|
+
if((x_ === y_)) {
|
|
141
131
|
return true
|
|
142
|
-
return
|
|
143
|
-
}
|
|
144
132
|
}
|
|
145
133
|
{
|
|
146
134
|
return true
|
|
147
|
-
return
|
|
148
|
-
}
|
|
149
135
|
}
|
|
150
136
|
}
|
|
151
137
|
};
|
package/package.json
CHANGED
package/postgresql/Pg.ff
CHANGED
|
@@ -217,47 +217,47 @@ extend self: PgStatement {
|
|
|
217
217
|
self.PgStatement(parameters = self.parameters.add(name, p))
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
withBoolArray(name: String, value:
|
|
220
|
+
withBoolArray(name: String, value: List[Bool]): PgStatement {
|
|
221
221
|
let p = UnsafeJs.jsSystem().value(value)
|
|
222
222
|
self.PgStatement(parameters = self.parameters.add(name, p))
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
withNullableBoolArray(name: String, value: Option[
|
|
225
|
+
withNullableBoolArray(name: String, value: Option[List[Bool]]): PgStatement {
|
|
226
226
|
let p = value.map(UnsafeJs.jsSystem().value).else {UnsafeJs.jsSystem().null()}
|
|
227
227
|
self.PgStatement(parameters = self.parameters.add(name, p))
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
withIntArray(name: String, value:
|
|
230
|
+
withIntArray(name: String, value: List[Int]): PgStatement {
|
|
231
231
|
let p = UnsafeJs.jsSystem().value(value)
|
|
232
232
|
self.PgStatement(parameters = self.parameters.add(name, p))
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
withNullableIntArray(name: String, value: Option[
|
|
235
|
+
withNullableIntArray(name: String, value: Option[List[Int]]): PgStatement {
|
|
236
236
|
let p = value.map(UnsafeJs.jsSystem().value).else {UnsafeJs.jsSystem().null()}
|
|
237
237
|
self.PgStatement(parameters = self.parameters.add(name, p))
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
withFloatArray(name: String, value:
|
|
240
|
+
withFloatArray(name: String, value: List[Float]): PgStatement {
|
|
241
241
|
let p = UnsafeJs.jsSystem().value(value)
|
|
242
242
|
self.PgStatement(parameters = self.parameters.add(name, p))
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
withNullableFloatArray(name: String, value: Option[
|
|
245
|
+
withNullableFloatArray(name: String, value: Option[List[Float]]): PgStatement {
|
|
246
246
|
let p = value.map(UnsafeJs.jsSystem().value).else {UnsafeJs.jsSystem().null()}
|
|
247
247
|
self.PgStatement(parameters = self.parameters.add(name, p))
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
withStringArray(name: String, value:
|
|
250
|
+
withStringArray(name: String, value: List[String]): PgStatement {
|
|
251
251
|
let p = UnsafeJs.jsSystem().value(value)
|
|
252
252
|
self.PgStatement(parameters = self.parameters.add(name, p))
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
withNullableStringArray(name: String, value: Option[
|
|
255
|
+
withNullableStringArray(name: String, value: Option[List[String]]): PgStatement {
|
|
256
256
|
let p = value.map(UnsafeJs.jsSystem().value).else {UnsafeJs.jsSystem().null()}
|
|
257
257
|
self.PgStatement(parameters = self.parameters.add(name, p))
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
withInstantArray(name: String, value:
|
|
260
|
+
withInstantArray(name: String, value: List[Instant]): PgStatement {
|
|
261
261
|
let jsDate = UnsafeJs.jsSystem().global().get("Date")
|
|
262
262
|
function toJsDate(instant: Instant): JsValue {
|
|
263
263
|
jsDate.new1(instant.since1970.seconds * 1000.0)
|
|
@@ -266,7 +266,7 @@ extend self: PgStatement {
|
|
|
266
266
|
self.PgStatement(parameters = self.parameters.add(name, p))
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
withNullableInstantArray(name: String, value: Option[
|
|
269
|
+
withNullableInstantArray(name: String, value: Option[List[Instant]]): PgStatement {
|
|
270
270
|
let jsDate = UnsafeJs.jsSystem().global().get("Date")
|
|
271
271
|
function toJsDate(instant: Instant): JsValue {
|
|
272
272
|
jsDate.new1(instant.since1970.seconds * 1000.0)
|
|
@@ -275,12 +275,12 @@ extend self: PgStatement {
|
|
|
275
275
|
self.PgStatement(parameters = self.parameters.add(name, p))
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
-
withBufferArray(name: String, value:
|
|
278
|
+
withBufferArray(name: String, value: List[Buffer]): PgStatement {
|
|
279
279
|
let p = UnsafeJs.jsSystem().value(value)
|
|
280
280
|
self.PgStatement(parameters = self.parameters.add(name, p))
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
withNullableBufferArray(name: String, value: Option[
|
|
283
|
+
withNullableBufferArray(name: String, value: Option[List[Buffer]]): PgStatement {
|
|
284
284
|
let p = value.map(UnsafeJs.jsSystem().value).else {UnsafeJs.jsSystem().null()}
|
|
285
285
|
self.PgStatement(parameters = self.parameters.add(name, p))
|
|
286
286
|
}
|
|
@@ -342,27 +342,27 @@ extend self: PgRow {
|
|
|
342
342
|
internalGet(self, name, lower) {_.grabBuffer()}
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
-
getBoolArray(name: String, lower: Bool = True): Option[
|
|
345
|
+
getBoolArray(name: String, lower: Bool = True): Option[List[Bool]] {
|
|
346
346
|
internalGet(self, name, lower) {_.grabArray().map {(_.grabBool() && True) || False}}
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
getIntArray(name: String, lower: Bool = True): Option[
|
|
349
|
+
getIntArray(name: String, lower: Bool = True): Option[List[Int]] {
|
|
350
350
|
internalGet(self, name, lower) {_.grabArray().map {_.grabInt() * 1}}
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
getFloatArray(name: String, lower: Bool = True): Option[
|
|
353
|
+
getFloatArray(name: String, lower: Bool = True): Option[List[Float]] {
|
|
354
354
|
internalGet(self, name, lower) {_.grabArray().map {_.grabFloat() * 1.0}}
|
|
355
355
|
}
|
|
356
356
|
|
|
357
|
-
getStringArray(name: String, lower: Bool = True): Option[
|
|
357
|
+
getStringArray(name: String, lower: Bool = True): Option[List[String]] {
|
|
358
358
|
internalGet(self, name, lower) {_.grabArray().map {"" + _.grabString()}}
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
getInstantArray(name: String, lower: Bool = True): Option[
|
|
361
|
+
getInstantArray(name: String, lower: Bool = True): Option[List[Instant]] {
|
|
362
362
|
internalGet(self, name, lower) {_.grabArray().map {Instant(Duration(_.call0("getTime").grabInt() * 0.001))}}
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
getBufferArray(name: String, lower: Bool = True): Option[
|
|
365
|
+
getBufferArray(name: String, lower: Bool = True): Option[List[Buffer]] {
|
|
366
366
|
internalGet(self, name, lower) {_.grabArray().map {_.grabBuffer()}}
|
|
367
367
|
}
|
|
368
368
|
|
|
@@ -384,7 +384,7 @@ internalRunStatement(statement: PgStatement, body: Option[PgRow => Bool]): Int {
|
|
|
384
384
|
| None =>
|
|
385
385
|
result.get("rowCount").grabInt()
|
|
386
386
|
| Some(f) =>
|
|
387
|
-
let all = result.get("rows").grabArray().
|
|
387
|
+
let all = result.get("rows").grabArray().all {row =>
|
|
388
388
|
f(PgRow(row))
|
|
389
389
|
}
|
|
390
390
|
if(all) {1} else {0}
|
|
@@ -426,7 +426,7 @@ internalBatchStatements(
|
|
|
426
426
|
| None =>
|
|
427
427
|
result.get("rowCount").grabInt()
|
|
428
428
|
| Some(f) =>
|
|
429
|
-
let all = result.get("rows").grabArray().
|
|
429
|
+
let all = result.get("rows").grabArray().all {row =>
|
|
430
430
|
f(PgRow(row))
|
|
431
431
|
}
|
|
432
432
|
endBody.each {_()}
|
|
@@ -436,12 +436,12 @@ internalBatchStatements(
|
|
|
436
436
|
results
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
-
internalCheckParameters(parameterNames: List[String], parameters: Map[String, JsValue]):
|
|
440
|
-
let arguments = parameterNames.map {
|
|
439
|
+
internalCheckParameters(parameterNames: List[String], parameters: Map[String, JsValue]): List[JsValue] {
|
|
440
|
+
let arguments = parameterNames.map {name =>
|
|
441
441
|
parameters.get(name).else {
|
|
442
442
|
panic("No value for parameter: " + name)
|
|
443
443
|
}
|
|
444
|
-
}
|
|
444
|
+
}
|
|
445
445
|
let unusedParameters = parameters.keys().removeAll(parameterNames.toSet())
|
|
446
446
|
if(unusedParameters.size() > 0) {
|
|
447
447
|
panic("Unused parameters: " + unusedParameters.toList().join(", "))
|
|
@@ -27,6 +27,34 @@ export function activate(context: vscode.ExtensionContext) {
|
|
|
27
27
|
return fireflyCompiler;
|
|
28
28
|
}));
|
|
29
29
|
|
|
30
|
+
let runFireflyProgramCommand = vscode.commands.registerCommand(
|
|
31
|
+
"extension.firefly-lang.runFireflyProgram",
|
|
32
|
+
async () => {
|
|
33
|
+
const editor = vscode.window.activeTextEditor;
|
|
34
|
+
if(!editor) {
|
|
35
|
+
vscode.window.showErrorMessage("No active text editor.");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const filePath = editor.document.fileName;
|
|
39
|
+
const fileDirectory = require('path').dirname(filePath);
|
|
40
|
+
const fileName = require('path').basename(filePath);
|
|
41
|
+
const terminal = vscode.window.createTerminal("firefly");
|
|
42
|
+
terminal.sendText(`cd "${fileDirectory}" # npm install -g firefly-compiler`);
|
|
43
|
+
terminal.sendText(`firefly "${fileName}"`);
|
|
44
|
+
terminal.show();
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
context.subscriptions.push(runFireflyProgramCommand);
|
|
49
|
+
|
|
50
|
+
let runFireflyProgramButton = vscode.window.createStatusBarItem(
|
|
51
|
+
vscode.StatusBarAlignment.Left
|
|
52
|
+
);
|
|
53
|
+
runFireflyProgramButton.text = "$(triangle-right) Run Firefly Program";
|
|
54
|
+
runFireflyProgramButton.command = "extension.firefly-lang.runFireflyProgram";
|
|
55
|
+
|
|
56
|
+
context.subscriptions.push(runFireflyProgramButton);
|
|
57
|
+
|
|
30
58
|
const runOrDebug = {
|
|
31
59
|
module: fireflyCompiler,
|
|
32
60
|
args: ['LanguageServer.ff'],
|
|
@@ -55,7 +83,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|
|
55
83
|
|
|
56
84
|
client.start();
|
|
57
85
|
|
|
58
|
-
vscode.window.onDidChangeActiveTextEditor(editor => {
|
|
86
|
+
context.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(editor => {
|
|
59
87
|
if(editor && editor.document.languageId === 'firefly') {
|
|
60
88
|
client.sendNotification('custom/focusDocument', {
|
|
61
89
|
"textDocument": {
|
|
@@ -64,7 +92,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|
|
64
92
|
}
|
|
65
93
|
});
|
|
66
94
|
}
|
|
67
|
-
});
|
|
95
|
+
}));
|
|
68
96
|
}
|
|
69
97
|
|
|
70
98
|
export function deactivate(): Thenable<void> | undefined {
|
package/vscode/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "Firefly language support",
|
|
5
5
|
"author": "Firefly team",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"version": "0.4.
|
|
7
|
+
"version": "0.4.21",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/Ahnfelt/firefly-boot"
|
|
@@ -82,8 +82,24 @@
|
|
|
82
82
|
{
|
|
83
83
|
"command": "extension.firefly-lang.getFireflyCompiler",
|
|
84
84
|
"title": "Get the Firefly compiler main"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"command": "extension.firefly-lang.runFireflyProgram",
|
|
88
|
+
"title": "Run Firefly Program",
|
|
89
|
+
"icon": "$(run)",
|
|
90
|
+
"when": "editorLangId == firefly"
|
|
85
91
|
}
|
|
86
92
|
],
|
|
93
|
+
"menus": {
|
|
94
|
+
"editor/title/run": [
|
|
95
|
+
{
|
|
96
|
+
"command": "extension.firefly-lang.runFireflyProgram",
|
|
97
|
+
"group": "1_run",
|
|
98
|
+
"icon": "$(run)",
|
|
99
|
+
"when": "editorLangId == firefly"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
},
|
|
87
103
|
"configuration": {
|
|
88
104
|
"type": "object",
|
|
89
105
|
"title": "Firefly language support configuration",
|