firefly-compiler 0.4.36 → 0.4.46
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/.hintrc +4 -4
- package/.vscode/settings.json +4 -4
- package/bin/Release.ff +99 -49
- package/bin/firefly.mjs +1 -1
- package/compiler/Builder.ff +257 -257
- package/compiler/Compiler.ff +227 -227
- package/compiler/Dependencies.ff +186 -186
- package/compiler/DependencyLock.ff +17 -17
- package/compiler/JsEmitter.ff +946 -946
- package/compiler/LspHook.ff +202 -202
- package/compiler/ModuleCache.ff +178 -178
- package/compiler/Workspace.ff +88 -88
- package/core/.firefly/include/package-lock.json +394 -394
- package/core/.firefly/include/package.json +5 -5
- package/core/.firefly/include/prepare.sh +1 -1
- package/core/.firefly/package.ff +2 -2
- package/core/Array.ff +265 -265
- package/core/Atomic.ff +64 -64
- package/core/Box.ff +7 -7
- package/core/BrowserSystem.ff +40 -37
- package/core/Buffer.ff +3 -3
- package/core/BuildSystem.ff +148 -145
- package/core/Crypto.ff +96 -95
- package/core/Equal.ff +36 -36
- package/core/HttpClient.ff +87 -87
- package/core/Instant.ff +17 -0
- package/core/JsSystem.ff +69 -69
- package/core/Json.ff +434 -434
- package/core/List.ff +415 -415
- package/core/Lock.ff +144 -144
- package/core/NodeSystem.ff +189 -189
- package/core/Ordering.ff +161 -161
- package/core/Path.ff +401 -401
- package/core/Random.ff +134 -134
- package/core/RbMap.ff +216 -216
- package/core/Show.ff +43 -43
- package/core/SourceLocation.ff +68 -68
- package/core/Stream.ff +1 -1
- package/core/Task.ff +141 -141
- package/experimental/benchmarks/ListGrab.ff +23 -23
- package/experimental/benchmarks/ListGrab.java +55 -55
- package/experimental/benchmarks/Pyrotek45.ff +30 -30
- package/experimental/benchmarks/Pyrotek45.java +64 -64
- package/experimental/bidirectional/Bidi.ff +88 -88
- package/experimental/random/Index.ff +53 -53
- package/experimental/random/Process.ff +120 -120
- package/experimental/random/RunLength.ff +3 -3
- package/experimental/random/Scrape.ff +51 -51
- package/experimental/random/Symbols.ff +73 -73
- package/experimental/random/Tensor.ff +52 -52
- package/experimental/random/Units.ff +36 -36
- package/experimental/s3/S3TestAuthorizationHeader.ff +38 -38
- package/experimental/s3/S3TestPut.ff +15 -15
- package/experimental/tests/TestJson.ff +26 -26
- package/firefly.sh +0 -0
- package/fireflysite/Main.ff +13 -13
- package/lsp/.firefly/package.ff +1 -1
- package/lsp/CompletionHandler.ff +811 -811
- package/lsp/Handler.ff +714 -714
- package/lsp/HoverHandler.ff +79 -79
- package/lsp/LanguageServer.ff +272 -272
- package/lsp/SignatureHelpHandler.ff +55 -55
- package/lsp/SymbolHandler.ff +181 -181
- package/lsp/TestReferences.ff +16 -16
- package/lsp/TestReferencesCase.ff +7 -7
- package/lsp/stderr.txt +1 -1
- package/lsp/stdout.txt +34 -34
- package/lux/.firefly/package.ff +1 -1
- package/lux/Css.ff +648 -648
- package/lux/CssTest.ff +48 -48
- package/lux/Lux.ff +487 -487
- package/lux/LuxEvent.ff +116 -116
- package/lux/Main.ff +128 -128
- package/lux/Main2.ff +144 -144
- package/output/js/ff/compiler/Builder.mjs +43 -43
- package/output/js/ff/compiler/Dependencies.mjs +3 -3
- package/output/js/ff/core/Array.mjs +59 -59
- package/output/js/ff/core/Atomic.mjs +36 -36
- package/output/js/ff/core/BrowserSystem.mjs +19 -11
- package/output/js/ff/core/Buffer.mjs +7 -7
- package/output/js/ff/core/BuildSystem.mjs +38 -30
- package/output/js/ff/core/Crypto.mjs +67 -68
- package/output/js/ff/core/HttpClient.mjs +24 -24
- package/output/js/ff/core/Instant.mjs +38 -0
- package/output/js/ff/core/Json.mjs +147 -147
- package/output/js/ff/core/List.mjs +50 -50
- package/output/js/ff/core/Lock.mjs +97 -97
- package/output/js/ff/core/NodeSystem.mjs +77 -77
- package/output/js/ff/core/Ordering.mjs +8 -8
- package/output/js/ff/core/Path.mjs +231 -231
- package/output/js/ff/core/Random.mjs +56 -56
- package/output/js/ff/core/Stream.mjs +2 -2
- package/output/js/ff/core/Task.mjs +31 -31
- package/package.json +29 -29
- package/rpc/.firefly/package.ff +1 -1
- package/rpc/Rpc.ff +69 -69
- package/s3/.firefly/package.ff +1 -0
- package/{experimental/s3 → s3}/S3.ff +92 -92
- package/unsafejs/UnsafeJs.ff +19 -19
- package/vscode/LICENSE.txt +21 -21
- package/vscode/Prepublish.ff +15 -15
- package/vscode/README.md +16 -16
- package/vscode/client/package.json +22 -22
- package/vscode/client/src/extension.ts +104 -104
- package/vscode/icons/firefly-icon.svg +10 -10
- package/vscode/language-configuration.json +61 -61
- package/vscode/package-lock.json +3623 -3623
- package/vscode/package.json +160 -160
- package/vscode/snippets.json +241 -241
- package/webserver/.firefly/include/package-lock.json +16 -16
- package/webserver/.firefly/include/package.json +5 -5
- package/webserver/.firefly/package.ff +2 -2
- package/webserver/WebServer.ff +685 -685
- package/websocket/.firefly/package.ff +1 -1
- package/websocket/WebSocket.ff +131 -131
- package/crypto/SubtleCrypto.ff +0 -149
|
@@ -96,71 +96,71 @@ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
export function read_(json_) {
|
|
99
|
-
|
|
100
|
-
try {
|
|
101
|
-
return ff_core_Option.Some(JSON.parse(json_));
|
|
102
|
-
} catch(e) {
|
|
103
|
-
return ff_core_Option.None();
|
|
104
|
-
}
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
return ff_core_Option.Some(JSON.parse(json_));
|
|
102
|
+
} catch(e) {
|
|
103
|
+
return ff_core_Option.None();
|
|
104
|
+
}
|
|
105
105
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
export function string_(json_) {
|
|
109
|
-
|
|
110
|
-
return json_;
|
|
109
|
+
|
|
110
|
+
return json_;
|
|
111
111
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
export function int_(json_) {
|
|
115
|
-
|
|
116
|
-
return json_;
|
|
115
|
+
|
|
116
|
+
return json_;
|
|
117
117
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
export function float_(json_) {
|
|
121
|
-
|
|
122
|
-
return json_;
|
|
121
|
+
|
|
122
|
+
return json_;
|
|
123
123
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
export function bool_(json_) {
|
|
127
|
-
|
|
128
|
-
return json_;
|
|
127
|
+
|
|
128
|
+
return json_;
|
|
129
129
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
export function null_() {
|
|
133
|
-
|
|
134
|
-
return null;
|
|
133
|
+
|
|
134
|
+
return null;
|
|
135
135
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
export function array_(json_) {
|
|
139
|
-
|
|
140
|
-
return json_;
|
|
139
|
+
|
|
140
|
+
return json_;
|
|
141
141
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
export function object_() {
|
|
145
|
-
|
|
146
|
-
return {};
|
|
145
|
+
|
|
146
|
+
return {};
|
|
147
147
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
export function fields_(body_) {
|
|
151
|
-
|
|
152
|
-
const result = {};
|
|
153
|
-
body_((k, v) => {result[k] = v});
|
|
154
|
-
return result;
|
|
151
|
+
|
|
152
|
+
const result = {};
|
|
153
|
+
body_((k, v) => {result[k] = v});
|
|
154
|
+
return result;
|
|
155
155
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
export function internalWith_(self_, field_, value_) {
|
|
159
|
-
|
|
160
|
-
if(typeof self_ !== 'object' || self_ === null || Array.isArray(self_)) {
|
|
161
|
-
throw new Error('Not an object: ' + JSON.stringify(self_));
|
|
162
|
-
}
|
|
163
|
-
return {...self_, [field_]: value_};
|
|
159
|
+
|
|
160
|
+
if(typeof self_ !== 'object' || self_ === null || Array.isArray(self_)) {
|
|
161
|
+
throw new Error('Not an object: ' + JSON.stringify(self_));
|
|
162
|
+
}
|
|
163
|
+
return {...self_, [field_]: value_};
|
|
164
164
|
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -173,69 +173,69 @@ for(const [key, value] of Object.entries(self_)) if(!body_(key, value)) break
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
export function internalEquals_(a_, b_) {
|
|
176
|
-
|
|
177
|
-
if(a_ === b_) {
|
|
178
|
-
return true;
|
|
179
|
-
} else if(Array.isArray(a_) || Array.isArray(b_)) {
|
|
180
|
-
if(!Array.isArray(a_) || !Array.isArray(b_)) return false;
|
|
181
|
-
if(a_.length !== b_.length) return false;
|
|
182
|
-
for(let i = 0; i < a_.length; i++) {
|
|
183
|
-
if(!internalEquals_(a_[i], b_[i])) return false;
|
|
184
|
-
}
|
|
185
|
-
return true;
|
|
186
|
-
} else if(typeof a_ === 'object' && typeof b_ === 'object' && a_ !== null && b_ !== null) {
|
|
187
|
-
const aKeys = Object.keys(a_);
|
|
188
|
-
const bKeys = Object.keys(b_);
|
|
189
|
-
if(aKeys.length !== bKeys.length) return false;
|
|
190
|
-
for(const key of aKeys) {
|
|
191
|
-
if(!Object.hasOwn(b_, key) || !internalEquals_(a_[key], b_[key])) return false;
|
|
192
|
-
}
|
|
193
|
-
return true;
|
|
194
|
-
} else {
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
176
|
+
|
|
177
|
+
if(a_ === b_) {
|
|
178
|
+
return true;
|
|
179
|
+
} else if(Array.isArray(a_) || Array.isArray(b_)) {
|
|
180
|
+
if(!Array.isArray(a_) || !Array.isArray(b_)) return false;
|
|
181
|
+
if(a_.length !== b_.length) return false;
|
|
182
|
+
for(let i = 0; i < a_.length; i++) {
|
|
183
|
+
if(!internalEquals_(a_[i], b_[i])) return false;
|
|
184
|
+
}
|
|
185
|
+
return true;
|
|
186
|
+
} else if(typeof a_ === 'object' && typeof b_ === 'object' && a_ !== null && b_ !== null) {
|
|
187
|
+
const aKeys = Object.keys(a_);
|
|
188
|
+
const bKeys = Object.keys(b_);
|
|
189
|
+
if(aKeys.length !== bKeys.length) return false;
|
|
190
|
+
for(const key of aKeys) {
|
|
191
|
+
if(!Object.hasOwn(b_, key) || !internalEquals_(a_[key], b_[key])) return false;
|
|
192
|
+
}
|
|
193
|
+
return true;
|
|
194
|
+
} else {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
197
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
export function internalCompare_(a_, b_) {
|
|
201
|
-
|
|
202
|
-
if(a_ === b_) {
|
|
203
|
-
return 0;
|
|
204
|
-
} else if (a_ === null || b_ === null) {
|
|
205
|
-
return a_ === null ? -1 : 1;
|
|
206
|
-
} else if (typeof a_ === 'boolean' || typeof b_ === 'boolean') {
|
|
207
|
-
if(typeof b_ !== 'boolean') return -1;
|
|
208
|
-
if(typeof a_ !== 'boolean') return 1;
|
|
209
|
-
return a_ < b_ ? -1 : 1;
|
|
210
|
-
} else if (typeof a_ === 'number' || typeof b_ === 'number') {
|
|
211
|
-
if(typeof b_ !== 'number') return -1;
|
|
212
|
-
if(typeof a_ !== 'number') return 1;
|
|
213
|
-
if(isNaN(a_)) return isNaN(b_) ? 0 : -1;
|
|
214
|
-
if(isNaN(b_)) return 1;
|
|
215
|
-
return a_ < b_ ? -1 : 1;
|
|
216
|
-
} else if (typeof a_ === 'string' || typeof b_ === 'string') {
|
|
217
|
-
if(typeof b_ !== 'string') return -1;
|
|
218
|
-
if(typeof a_ !== 'string') return 1;
|
|
219
|
-
return a_.localeCompare(b_, 'en');
|
|
220
|
-
} else if(Array.isArray(a_) || Array.isArray(b_)) {
|
|
221
|
-
if(!Array.isArray(a_) || !Array.isArray(b_)) return a_ < b_ ? -1 : 1;
|
|
222
|
-
const length = Math.min(a_.length, b_.length);
|
|
223
|
-
for(let i = 0; i < length; i++) {
|
|
224
|
-
const cmp = internalCompare_(a_[i], b_[i]);
|
|
225
|
-
if(cmp !== 0) return cmp;
|
|
226
|
-
}
|
|
227
|
-
return a_.length - b_.length;
|
|
228
|
-
} else {
|
|
229
|
-
const aKeys = Object.keys(a_).sort();
|
|
230
|
-
const bKeys = Object.keys(b_).sort();
|
|
231
|
-
const keyResult = internalCompare_(aKeys, bKeys);
|
|
232
|
-
if(keyResult !== 0) return keyResult;
|
|
233
|
-
for(const key of aKeys) {
|
|
234
|
-
const result = internalCompare_(a_[key], b_[key]);
|
|
235
|
-
if(result !== 0) return result;
|
|
236
|
-
}
|
|
237
|
-
return 0;
|
|
238
|
-
}
|
|
201
|
+
|
|
202
|
+
if(a_ === b_) {
|
|
203
|
+
return 0;
|
|
204
|
+
} else if (a_ === null || b_ === null) {
|
|
205
|
+
return a_ === null ? -1 : 1;
|
|
206
|
+
} else if (typeof a_ === 'boolean' || typeof b_ === 'boolean') {
|
|
207
|
+
if(typeof b_ !== 'boolean') return -1;
|
|
208
|
+
if(typeof a_ !== 'boolean') return 1;
|
|
209
|
+
return a_ < b_ ? -1 : 1;
|
|
210
|
+
} else if (typeof a_ === 'number' || typeof b_ === 'number') {
|
|
211
|
+
if(typeof b_ !== 'number') return -1;
|
|
212
|
+
if(typeof a_ !== 'number') return 1;
|
|
213
|
+
if(isNaN(a_)) return isNaN(b_) ? 0 : -1;
|
|
214
|
+
if(isNaN(b_)) return 1;
|
|
215
|
+
return a_ < b_ ? -1 : 1;
|
|
216
|
+
} else if (typeof a_ === 'string' || typeof b_ === 'string') {
|
|
217
|
+
if(typeof b_ !== 'string') return -1;
|
|
218
|
+
if(typeof a_ !== 'string') return 1;
|
|
219
|
+
return a_.localeCompare(b_, 'en');
|
|
220
|
+
} else if(Array.isArray(a_) || Array.isArray(b_)) {
|
|
221
|
+
if(!Array.isArray(a_) || !Array.isArray(b_)) return a_ < b_ ? -1 : 1;
|
|
222
|
+
const length = Math.min(a_.length, b_.length);
|
|
223
|
+
for(let i = 0; i < length; i++) {
|
|
224
|
+
const cmp = internalCompare_(a_[i], b_[i]);
|
|
225
|
+
if(cmp !== 0) return cmp;
|
|
226
|
+
}
|
|
227
|
+
return a_.length - b_.length;
|
|
228
|
+
} else {
|
|
229
|
+
const aKeys = Object.keys(a_).sort();
|
|
230
|
+
const bKeys = Object.keys(b_).sort();
|
|
231
|
+
const keyResult = internalCompare_(aKeys, bKeys);
|
|
232
|
+
if(keyResult !== 0) return keyResult;
|
|
233
|
+
for(const key of aKeys) {
|
|
234
|
+
const result = internalCompare_(a_[key], b_[key]);
|
|
235
|
+
if(result !== 0) return result;
|
|
236
|
+
}
|
|
237
|
+
return 0;
|
|
238
|
+
}
|
|
239
239
|
|
|
240
240
|
}
|
|
241
241
|
|
|
@@ -272,10 +272,10 @@ throw new Error('Function object is missing on this target in async context.');
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
export async function fields_$(body_, $task) {
|
|
275
|
-
|
|
276
|
-
const result = {};
|
|
277
|
-
await body_((k, v) => {result[k] = v}, $task);
|
|
278
|
-
return result;
|
|
275
|
+
|
|
276
|
+
const result = {};
|
|
277
|
+
await body_((k, v) => {result[k] = v}, $task);
|
|
278
|
+
return result;
|
|
279
279
|
|
|
280
280
|
}
|
|
281
281
|
|
|
@@ -300,8 +300,8 @@ throw new Error('Function internalCompare is missing on this target in async con
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
export function Json_write(self_, indentation_ = ff_core_Option.None()) {
|
|
303
|
-
|
|
304
|
-
return JSON.stringify(self_, null, indentation_.value_);
|
|
303
|
+
|
|
304
|
+
return JSON.stringify(self_, null, indentation_.value_);
|
|
305
305
|
|
|
306
306
|
}
|
|
307
307
|
|
|
@@ -310,50 +310,50 @@ return ff_core_Json.internalWith_(self_, field_, ff_core_Json_JsonLike$T.toJson_
|
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
export function Json_merge(self_, that_) {
|
|
313
|
-
|
|
314
|
-
if(typeof self_ !== 'object' || self_ === null || Array.isArray(self_)) {
|
|
315
|
-
throw new Error('Not an object: ' + JSON.stringify(self_));
|
|
316
|
-
}
|
|
317
|
-
if(typeof that_ !== 'object' || that_ === null || Array.isArray(that_)) {
|
|
318
|
-
throw new Error('Not an object: ' + JSON.stringify(that_));
|
|
319
|
-
}
|
|
320
|
-
return {...self_, ...that_};
|
|
313
|
+
|
|
314
|
+
if(typeof self_ !== 'object' || self_ === null || Array.isArray(self_)) {
|
|
315
|
+
throw new Error('Not an object: ' + JSON.stringify(self_));
|
|
316
|
+
}
|
|
317
|
+
if(typeof that_ !== 'object' || that_ === null || Array.isArray(that_)) {
|
|
318
|
+
throw new Error('Not an object: ' + JSON.stringify(that_));
|
|
319
|
+
}
|
|
320
|
+
return {...self_, ...that_};
|
|
321
321
|
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
export function Json_grabString(self_) {
|
|
325
|
-
|
|
326
|
-
if(typeof self_ !== 'string') throw new Error('Not a string: ' + JSON.stringify(self_));
|
|
327
|
-
return self_;
|
|
325
|
+
|
|
326
|
+
if(typeof self_ !== 'string') throw new Error('Not a string: ' + JSON.stringify(self_));
|
|
327
|
+
return self_;
|
|
328
328
|
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
export function Json_grabInt(self_) {
|
|
332
|
-
|
|
333
|
-
if(!Number.isSafeInteger(self_)) throw new Error('Not an int: ' + JSON.stringify(self_));
|
|
334
|
-
return Math.trunc(self_);
|
|
332
|
+
|
|
333
|
+
if(!Number.isSafeInteger(self_)) throw new Error('Not an int: ' + JSON.stringify(self_));
|
|
334
|
+
return Math.trunc(self_);
|
|
335
335
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
export function Json_grabFloat(self_) {
|
|
339
|
-
|
|
340
|
-
if(typeof self_ !== 'number') throw new Error('Not a float: ' + JSON.stringify(self_));
|
|
341
|
-
return self_;
|
|
339
|
+
|
|
340
|
+
if(typeof self_ !== 'number') throw new Error('Not a float: ' + JSON.stringify(self_));
|
|
341
|
+
return self_;
|
|
342
342
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
export function Json_grabBool(self_) {
|
|
346
|
-
|
|
347
|
-
if(self_ === true) return true;
|
|
348
|
-
if(self_ === false) return false;
|
|
349
|
-
throw new Error('Not a bool: ' + JSON.stringify(self_));
|
|
346
|
+
|
|
347
|
+
if(self_ === true) return true;
|
|
348
|
+
if(self_ === false) return false;
|
|
349
|
+
throw new Error('Not a bool: ' + JSON.stringify(self_));
|
|
350
350
|
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
export function Json_grabArray(self_) {
|
|
354
|
-
|
|
355
|
-
if(!Array.isArray(self_)) throw new Error('Not an array: ' + JSON.stringify(self_));
|
|
356
|
-
return self_;
|
|
354
|
+
|
|
355
|
+
if(!Array.isArray(self_)) throw new Error('Not an array: ' + JSON.stringify(self_));
|
|
356
|
+
return self_;
|
|
357
357
|
|
|
358
358
|
}
|
|
359
359
|
|
|
@@ -402,83 +402,83 @@ return ff_core_Option.Some(ff_core_Json.Json_grabMap(self_))
|
|
|
402
402
|
}
|
|
403
403
|
|
|
404
404
|
export function Json_isString(self_) {
|
|
405
|
-
|
|
406
|
-
return typeof self_ === 'string';
|
|
405
|
+
|
|
406
|
+
return typeof self_ === 'string';
|
|
407
407
|
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
export function Json_isInt(self_) {
|
|
411
|
-
|
|
412
|
-
return Number.isSafeInteger(self_);
|
|
411
|
+
|
|
412
|
+
return Number.isSafeInteger(self_);
|
|
413
413
|
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
export function Json_isFloat(self_) {
|
|
417
|
-
|
|
418
|
-
return typeof self_ === 'number';
|
|
417
|
+
|
|
418
|
+
return typeof self_ === 'number';
|
|
419
419
|
|
|
420
420
|
}
|
|
421
421
|
|
|
422
422
|
export function Json_isBool(self_) {
|
|
423
|
-
|
|
424
|
-
return typeof self_ === 'boolean';
|
|
423
|
+
|
|
424
|
+
return typeof self_ === 'boolean';
|
|
425
425
|
|
|
426
426
|
}
|
|
427
427
|
|
|
428
428
|
export function Json_isArray(self_) {
|
|
429
|
-
|
|
430
|
-
return Array.isArray(self_);
|
|
429
|
+
|
|
430
|
+
return Array.isArray(self_);
|
|
431
431
|
|
|
432
432
|
}
|
|
433
433
|
|
|
434
434
|
export function Json_isObject(self_) {
|
|
435
|
-
|
|
436
|
-
return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_);
|
|
435
|
+
|
|
436
|
+
return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_);
|
|
437
437
|
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
export function Json_isNull(self_) {
|
|
441
|
-
|
|
442
|
-
return self_ === null;
|
|
441
|
+
|
|
442
|
+
return self_ === null;
|
|
443
443
|
|
|
444
444
|
}
|
|
445
445
|
|
|
446
446
|
export function Json_field(self_, key_) {
|
|
447
|
-
|
|
448
|
-
return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_) && Object.hasOwn(self_, key_)
|
|
449
|
-
? self_[key_] : null;
|
|
447
|
+
|
|
448
|
+
return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_) && Object.hasOwn(self_, key_)
|
|
449
|
+
? self_[key_] : null;
|
|
450
450
|
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
export function Json_index(self_, key_) {
|
|
454
|
-
|
|
455
|
-
return typeof self_ === 'array' ? self_[key] ?? null : null;
|
|
454
|
+
|
|
455
|
+
return typeof self_ === 'array' ? self_[key] ?? null : null;
|
|
456
456
|
|
|
457
457
|
}
|
|
458
458
|
|
|
459
459
|
export function Json_hasField(self_, key_) {
|
|
460
|
-
|
|
461
|
-
return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_) && Object.hasOwn(self_, key_);
|
|
460
|
+
|
|
461
|
+
return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_) && Object.hasOwn(self_, key_);
|
|
462
462
|
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
export function Json_getField(self_, key_) {
|
|
466
|
-
|
|
467
|
-
return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_) && Object.hasOwn(self_, key_)
|
|
468
|
-
? ff_core_Option.Some(self_[key_]) : ff_core_Option.None();
|
|
466
|
+
|
|
467
|
+
return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_) && Object.hasOwn(self_, key_)
|
|
468
|
+
? ff_core_Option.Some(self_[key_]) : ff_core_Option.None();
|
|
469
469
|
|
|
470
470
|
}
|
|
471
471
|
|
|
472
472
|
export function Json_getIndex(self_, key_) {
|
|
473
|
-
|
|
474
|
-
return typeof self_ === 'array' ? ff_core_Option.Some(self_[key_] ?? null) : ff_core_Option.None();
|
|
473
|
+
|
|
474
|
+
return typeof self_ === 'array' ? ff_core_Option.Some(self_[key_] ?? null) : ff_core_Option.None();
|
|
475
475
|
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
export function Json_getFields(self_) {
|
|
479
|
-
|
|
480
|
-
return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_)
|
|
481
|
-
? ff_core_Option.Some(Object.keys(self_)) : ff_core_Option.None();
|
|
479
|
+
|
|
480
|
+
return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_)
|
|
481
|
+
? ff_core_Option.Some(Object.keys(self_)) : ff_core_Option.None();
|
|
482
482
|
|
|
483
483
|
}
|
|
484
484
|
|
|
@@ -96,26 +96,26 @@ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
export function new_() {
|
|
99
|
-
|
|
100
|
-
return [];
|
|
99
|
+
|
|
100
|
+
return [];
|
|
101
101
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
export function fill_(size_, value_) {
|
|
105
|
-
|
|
106
|
-
return new Array(size_).fill(value_);
|
|
105
|
+
|
|
106
|
+
return new Array(size_).fill(value_);
|
|
107
107
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
export function fillBy_(size_, body_) {
|
|
111
|
-
|
|
112
|
-
return Array.from({length: size_}, (_, i) => body_(i));
|
|
111
|
+
|
|
112
|
+
return Array.from({length: size_}, (_, i) => body_(i));
|
|
113
113
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
export function range_(size_) {
|
|
117
|
-
|
|
118
|
-
return Array.from({length: size_}, (_, i) => i);
|
|
117
|
+
|
|
118
|
+
return Array.from({length: size_}, (_, i) => i);
|
|
119
119
|
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -124,8 +124,8 @@ return left_ === right_
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
export function internalGrab_(self_, index_) {
|
|
127
|
-
|
|
128
|
-
return index_ < 0 || index_ >= self_.length ? ff_core_Try.internalThrowGrabException_() : self_[index_];
|
|
127
|
+
|
|
128
|
+
return index_ < 0 || index_ >= self_.length ? ff_core_Try.internalThrowGrabException_() : self_[index_];
|
|
129
129
|
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -138,12 +138,12 @@ throw new Error('Function fill is missing on this target in async context.');
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
export async function fillBy_$(size_, body_, $task) {
|
|
141
|
-
|
|
142
|
-
const array = new Array(size_);
|
|
143
|
-
for(let i = 0; i < size_; i++) {
|
|
144
|
-
array[i] = await(body_(_i));
|
|
145
|
-
}
|
|
146
|
-
return array;
|
|
141
|
+
|
|
142
|
+
const array = new Array(size_);
|
|
143
|
+
for(let i = 0; i < size_; i++) {
|
|
144
|
+
array[i] = await(body_(_i));
|
|
145
|
+
}
|
|
146
|
+
return array;
|
|
147
147
|
|
|
148
148
|
}
|
|
149
149
|
|
|
@@ -172,16 +172,16 @@ return self_.length
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
export function List_get(self_, index_) {
|
|
175
|
-
|
|
176
|
-
return index_ >= 0 && index_ < self_.length
|
|
177
|
-
? ff_core_Option.Some(self_[index_])
|
|
178
|
-
: ff_core_Option.None()
|
|
175
|
+
|
|
176
|
+
return index_ >= 0 && index_ < self_.length
|
|
177
|
+
? ff_core_Option.Some(self_[index_])
|
|
178
|
+
: ff_core_Option.None()
|
|
179
179
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
export function List_grab(self_, index_) {
|
|
183
|
-
|
|
184
|
-
return self_[index_] ?? internalGrab_(self_, index_);
|
|
183
|
+
|
|
184
|
+
return self_[index_] ?? internalGrab_(self_, index_);
|
|
185
185
|
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -245,13 +245,13 @@ return value_
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
export function List_modify(self_, index_, body_) {
|
|
248
|
-
|
|
249
|
-
if(index_ < 0 || index_ >= self_.length) {
|
|
250
|
-
ff_core_Try.internalThrowGrabException_()
|
|
251
|
-
}
|
|
252
|
-
let result = self_.slice();
|
|
253
|
-
result[index_] = body_(result[index_]);
|
|
254
|
-
return result;
|
|
248
|
+
|
|
249
|
+
if(index_ < 0 || index_ >= self_.length) {
|
|
250
|
+
ff_core_Try.internalThrowGrabException_()
|
|
251
|
+
}
|
|
252
|
+
let result = self_.slice();
|
|
253
|
+
result[index_] = body_(result[index_]);
|
|
254
|
+
return result;
|
|
255
255
|
|
|
256
256
|
}
|
|
257
257
|
|
|
@@ -316,8 +316,8 @@ return {array: self_.slice()}
|
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
export function List_each(self_, body_) {
|
|
319
|
-
|
|
320
|
-
return self_.forEach(body_);
|
|
319
|
+
|
|
320
|
+
return self_.forEach(body_);
|
|
321
321
|
|
|
322
322
|
}
|
|
323
323
|
|
|
@@ -373,8 +373,8 @@ return (!body_(_w1))
|
|
|
373
373
|
}
|
|
374
374
|
|
|
375
375
|
export function List_map(self_, body_) {
|
|
376
|
-
|
|
377
|
-
return self_.map(body_)
|
|
376
|
+
|
|
377
|
+
return self_.map(body_)
|
|
378
378
|
|
|
379
379
|
}
|
|
380
380
|
|
|
@@ -528,13 +528,13 @@ return value_
|
|
|
528
528
|
}
|
|
529
529
|
|
|
530
530
|
export async function List_modify$(self_, index_, body_, $task) {
|
|
531
|
-
|
|
532
|
-
if(index_ < 0 || index_ >= self_.length) {
|
|
533
|
-
ff_core_Try.internalThrowGrabException_()
|
|
534
|
-
}
|
|
535
|
-
let result = self_.slice();
|
|
536
|
-
result[index_] = await body_(result[index_], $task);
|
|
537
|
-
return result;
|
|
531
|
+
|
|
532
|
+
if(index_ < 0 || index_ >= self_.length) {
|
|
533
|
+
ff_core_Try.internalThrowGrabException_()
|
|
534
|
+
}
|
|
535
|
+
let result = self_.slice();
|
|
536
|
+
result[index_] = await body_(result[index_], $task);
|
|
537
|
+
return result;
|
|
538
538
|
|
|
539
539
|
}
|
|
540
540
|
|
|
@@ -599,10 +599,10 @@ throw new Error('Function List_toArray is missing on this target in async contex
|
|
|
599
599
|
}
|
|
600
600
|
|
|
601
601
|
export async function List_each$(self_, body_, $task) {
|
|
602
|
-
|
|
603
|
-
for(let i = 0; i < self_.length; i++) {
|
|
604
|
-
await body_(self_[i], $task)
|
|
605
|
-
}
|
|
602
|
+
|
|
603
|
+
for(let i = 0; i < self_.length; i++) {
|
|
604
|
+
await body_(self_[i], $task)
|
|
605
|
+
}
|
|
606
606
|
|
|
607
607
|
}
|
|
608
608
|
|
|
@@ -658,12 +658,12 @@ return (!(await body_(_w1, $task)))
|
|
|
658
658
|
}
|
|
659
659
|
|
|
660
660
|
export async function List_map$(self_, body_, $task) {
|
|
661
|
-
|
|
662
|
-
let result = [];
|
|
663
|
-
for(let i = 0; i < self_.length; i++) {
|
|
664
|
-
result.push(await body_(self_[i], $task));
|
|
665
|
-
}
|
|
666
|
-
return result;
|
|
661
|
+
|
|
662
|
+
let result = [];
|
|
663
|
+
for(let i = 0; i < self_.length; i++) {
|
|
664
|
+
result.push(await body_(self_[i], $task));
|
|
665
|
+
}
|
|
666
|
+
return result;
|
|
667
667
|
|
|
668
668
|
}
|
|
669
669
|
|