firefly-compiler 0.5.8 → 0.5.10
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/JsEmitter.ff +89 -1
- package/output/js/ff/compiler/Builder.mjs +22 -16
- package/output/js/ff/compiler/Compiler.mjs +2 -2
- package/output/js/ff/compiler/Inference.mjs +32 -22
- package/output/js/ff/compiler/JsEmitter.mjs +276 -2
- package/output/js/ff/compiler/LspHook.mjs +2 -2
- package/output/js/ff/compiler/Parser.mjs +84 -82
- package/output/js/ff/compiler/Resolver.mjs +38 -28
- package/output/js/ff/compiler/Tokenizer.mjs +10 -10
- package/output/js/ff/compiler/Unification.mjs +10 -8
- package/output/js/ff/core/Array.mjs +8 -8
- package/output/js/ff/core/Int.mjs +4 -4
- package/output/js/ff/core/IntMap.mjs +8 -8
- package/output/js/ff/core/Json.mjs +12 -10
- package/output/js/ff/core/List.mjs +130 -104
- package/output/js/ff/core/Map.mjs +8 -6
- package/output/js/ff/core/Random.mjs +18 -12
- package/output/js/ff/core/RbMap.mjs +2 -2
- package/output/js/ff/core/Serializable.mjs +6 -4
- package/output/js/ff/core/Set.mjs +6 -4
- package/output/js/ff/core/Stream.mjs +8 -8
- package/output/js/ff/core/StringMap.mjs +8 -8
- package/output/js/ff/core/Task.mjs +6 -4
- package/package.json +1 -1
- package/vscode/package.json +1 -1
|
@@ -152,11 +152,13 @@ return ff_compiler_Resolver.Resolver_resolveLetDefinition(self3_, _w1, true)
|
|
|
152
152
|
return ff_compiler_Resolver.Resolver_resolveFunctionDefinition(self3_, _w1, true, false)
|
|
153
153
|
})))
|
|
154
154
|
}))(module_);
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
for(let for_i = 0, for_a = module2_.instances_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
156
|
+
const _w1 = for_a[for_i];
|
|
157
|
+
for(let for_i = 0, for_a = _w1.typeArguments_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
158
|
+
const _w1 = for_a[for_i];
|
|
157
159
|
ff_compiler_Resolver.Resolver_checkInstanceType(self3_, _w1)
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
160
162
|
return module2_
|
|
161
163
|
}
|
|
162
164
|
|
|
@@ -169,9 +171,10 @@ const typeArguments_ = _1.generics_;
|
|
|
169
171
|
if(ff_core_Set.Set_contains(self_.asyncTypes_, name_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
|
|
170
172
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(type_.at_, "Traits must not be instantiated for capability types"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
171
173
|
};
|
|
172
|
-
|
|
174
|
+
for(let for_i = 0, for_a = typeArguments_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
175
|
+
const _w1 = for_a[for_i];
|
|
173
176
|
ff_compiler_Resolver.Resolver_checkInstanceType(self_, _w1)
|
|
174
|
-
}
|
|
177
|
+
}
|
|
175
178
|
return
|
|
176
179
|
}
|
|
177
180
|
{
|
|
@@ -183,21 +186,22 @@ return
|
|
|
183
186
|
|
|
184
187
|
export function Resolver_processImports(self_, imports_, modules_) {
|
|
185
188
|
let resolver_ = self_;
|
|
186
|
-
|
|
187
|
-
|
|
189
|
+
for(let for_i = 0, for_a = imports_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
190
|
+
const import_ = for_a[for_i];
|
|
191
|
+
do {
|
|
188
192
|
const _1 = ff_core_List.List_find(modules_, ((_w1) => {
|
|
189
193
|
return (ff_core_String.String_dropLast(_w1.file_, 3) === import_.file_)
|
|
190
194
|
}));
|
|
191
195
|
if(_1.Some) {
|
|
192
196
|
const module_ = _1.value_;
|
|
193
197
|
resolver_ = ff_compiler_Resolver.Resolver_processDefinitions(resolver_, module_, ff_core_Option.Some(import_.alias_))
|
|
194
|
-
|
|
198
|
+
break
|
|
195
199
|
}
|
|
196
200
|
if(_1.None) {
|
|
197
201
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(import_.at_, ("No such module: " + import_.file_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
198
202
|
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
203
|
+
} while(false)
|
|
204
|
+
};
|
|
201
205
|
return resolver_
|
|
202
206
|
}
|
|
203
207
|
|
|
@@ -317,13 +321,14 @@ return ff_compiler_Resolver.Resolver(_c.variables_, _c.variableLocations_, _c.va
|
|
|
317
321
|
if((!ff_core_Option.Option_any(ff_core_List.List_first(definition_.generics_), ((_w1) => {
|
|
318
322
|
return (_w1 === "Q$")
|
|
319
323
|
})))) {
|
|
320
|
-
|
|
324
|
+
for(let for_i = 0, for_a = [...definition_.commonFields_, ...ff_core_List.List_flatMap(definition_.variants_, ((_w1) => {
|
|
321
325
|
return _w1.fields_
|
|
322
|
-
}))],
|
|
326
|
+
}))], for_l = for_a.length; for_i < for_l; for_i++) {
|
|
327
|
+
const f_ = for_a[for_i];
|
|
323
328
|
if(ff_compiler_Resolver.Resolver_containsAsyncType(self2_, f_.valueType_)) {
|
|
324
329
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(f_.at_, "Only capabilities can contain fields of concrete capability types"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
325
330
|
}
|
|
326
|
-
}
|
|
331
|
+
}
|
|
327
332
|
};
|
|
328
333
|
{
|
|
329
334
|
const _1 = definition_;
|
|
@@ -1090,11 +1095,13 @@ return ff_compiler_Resolver.Resolver_resolveLetDefinition(self3_, _w1, true)
|
|
|
1090
1095
|
return ff_compiler_Resolver.Resolver_resolveFunctionDefinition(self3_, _w1, true, false)
|
|
1091
1096
|
})))
|
|
1092
1097
|
}))(module_);
|
|
1093
|
-
|
|
1094
|
-
|
|
1098
|
+
for(let for_i = 0, for_a = module2_.instances_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
1099
|
+
const _w1 = for_a[for_i];
|
|
1100
|
+
for(let for_i = 0, for_a = _w1.typeArguments_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
1101
|
+
const _w1 = for_a[for_i];
|
|
1095
1102
|
ff_compiler_Resolver.Resolver_checkInstanceType(self3_, _w1)
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1103
|
+
}
|
|
1104
|
+
};
|
|
1098
1105
|
return module2_
|
|
1099
1106
|
}
|
|
1100
1107
|
|
|
@@ -1107,9 +1114,10 @@ const typeArguments_ = _1.generics_;
|
|
|
1107
1114
|
if(ff_core_Set.Set_contains(self_.asyncTypes_, name_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
|
|
1108
1115
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(type_.at_, "Traits must not be instantiated for capability types"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
1109
1116
|
};
|
|
1110
|
-
|
|
1117
|
+
for(let for_i = 0, for_a = typeArguments_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
1118
|
+
const _w1 = for_a[for_i];
|
|
1111
1119
|
ff_compiler_Resolver.Resolver_checkInstanceType(self_, _w1)
|
|
1112
|
-
}
|
|
1120
|
+
}
|
|
1113
1121
|
return
|
|
1114
1122
|
}
|
|
1115
1123
|
{
|
|
@@ -1121,21 +1129,22 @@ return
|
|
|
1121
1129
|
|
|
1122
1130
|
export async function Resolver_processImports$(self_, imports_, modules_, $task) {
|
|
1123
1131
|
let resolver_ = self_;
|
|
1124
|
-
|
|
1125
|
-
|
|
1132
|
+
for(let for_i = 0, for_a = imports_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
1133
|
+
const import_ = for_a[for_i];
|
|
1134
|
+
do {
|
|
1126
1135
|
const _1 = ff_core_List.List_find(modules_, ((_w1) => {
|
|
1127
1136
|
return (ff_core_String.String_dropLast(_w1.file_, 3) === import_.file_)
|
|
1128
1137
|
}));
|
|
1129
1138
|
if(_1.Some) {
|
|
1130
1139
|
const module_ = _1.value_;
|
|
1131
1140
|
resolver_ = ff_compiler_Resolver.Resolver_processDefinitions(resolver_, module_, ff_core_Option.Some(import_.alias_))
|
|
1132
|
-
|
|
1141
|
+
break
|
|
1133
1142
|
}
|
|
1134
1143
|
if(_1.None) {
|
|
1135
1144
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(import_.at_, ("No such module: " + import_.file_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
1136
1145
|
}
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1146
|
+
} while(false)
|
|
1147
|
+
};
|
|
1139
1148
|
return resolver_
|
|
1140
1149
|
}
|
|
1141
1150
|
|
|
@@ -1255,13 +1264,14 @@ return ff_compiler_Resolver.Resolver(_c.variables_, _c.variableLocations_, _c.va
|
|
|
1255
1264
|
if((!ff_core_Option.Option_any(ff_core_List.List_first(definition_.generics_), ((_w1) => {
|
|
1256
1265
|
return (_w1 === "Q$")
|
|
1257
1266
|
})))) {
|
|
1258
|
-
|
|
1267
|
+
for(let for_i = 0, for_a = [...definition_.commonFields_, ...ff_core_List.List_flatMap(definition_.variants_, ((_w1) => {
|
|
1259
1268
|
return _w1.fields_
|
|
1260
|
-
}))],
|
|
1269
|
+
}))], for_l = for_a.length; for_i < for_l; for_i++) {
|
|
1270
|
+
const f_ = for_a[for_i];
|
|
1261
1271
|
if(ff_compiler_Resolver.Resolver_containsAsyncType(self2_, f_.valueType_)) {
|
|
1262
1272
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(f_.at_, "Only capabilities can contain fields of concrete capability types"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
1263
1273
|
}
|
|
1264
|
-
}
|
|
1274
|
+
}
|
|
1265
1275
|
};
|
|
1266
1276
|
{
|
|
1267
1277
|
const _1 = definition_;
|
|
@@ -134,7 +134,7 @@ if((!ff_core_Array.Array_isEmpty(tokens_))) {
|
|
|
134
134
|
const last_ = ff_core_Array.Array_grabLast(tokens_);
|
|
135
135
|
if((((last_.stopLine_ === startLine_) && ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind.equals_(last_.kind_, ff_compiler_Token.LLower())) && ff_compiler_Token.TokenKind_afterKeyword(kind_))) {
|
|
136
136
|
if((((completionLine_ === last_.startLine_) && (completionColumn_ >= ((1 + last_.startOffset_) - last_.startLineOffset_))) && (completionColumn_ <= ((1 + last_.stopOffset_) - last_.stopLineOffset_)))) {
|
|
137
|
-
|
|
137
|
+
tokens_.array.push(ff_compiler_Token.Token(file_, code_, ff_compiler_Token.LSeparator(), startLine_, startLineOffset_, startLineOffset_, startLine_, startLineOffset_, startLineOffset_))
|
|
138
138
|
} else {
|
|
139
139
|
ff_core_Array.Array_modify(tokens_, (ff_core_Array.Array_size(tokens_) - 1), ((_w1) => {
|
|
140
140
|
{
|
|
@@ -148,10 +148,10 @@ return ff_compiler_Token.Token(_c.file_, _c.code_, ff_compiler_Token.LKeyword(),
|
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
150
|
if((((last_.stopLine_ !== startLine_) && ff_compiler_Token.TokenKind_beforeSeparator(last_.kind_)) && ff_compiler_Token.TokenKind_afterSeparator(kind_))) {
|
|
151
|
-
|
|
151
|
+
tokens_.array.push(ff_compiler_Token.Token(file_, code_, ff_compiler_Token.LSeparator(), startLine_, startLineOffset_, startLineOffset_, startLine_, startLineOffset_, startLineOffset_))
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
|
-
|
|
154
|
+
tokens_.array.push(ff_compiler_Token.Token(file_, code_, kind_, startLine_, startLineOffset_, startOffset_, line_, lineOffset_, stopOffset_))
|
|
155
155
|
}
|
|
156
156
|
let i_ = 0;
|
|
157
157
|
function throwError_(message_) {
|
|
@@ -345,9 +345,9 @@ const error_ = _error;
|
|
|
345
345
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Syntax.Location(file_, line_, (i_ - lineOffset_)), "Unexpected end of file"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
346
346
|
}
|
|
347
347
|
};
|
|
348
|
-
|
|
348
|
+
for(let for_i = 0, for_a = ff_core_List.range_(5), for_l = for_a.length; for_i < for_l; for_i++) {
|
|
349
349
|
emitToken_(ff_compiler_Token.LEnd(), i_, i_)
|
|
350
|
-
}
|
|
350
|
+
};
|
|
351
351
|
return ff_core_Array.Array_drain(tokens_)
|
|
352
352
|
}
|
|
353
353
|
|
|
@@ -381,7 +381,7 @@ if((!ff_core_Array.Array_isEmpty(tokens_))) {
|
|
|
381
381
|
const last_ = ff_core_Array.Array_grabLast(tokens_);
|
|
382
382
|
if((((last_.stopLine_ === startLine_) && ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind.equals_(last_.kind_, ff_compiler_Token.LLower())) && ff_compiler_Token.TokenKind_afterKeyword(kind_))) {
|
|
383
383
|
if((((completionLine_ === last_.startLine_) && (completionColumn_ >= ((1 + last_.startOffset_) - last_.startLineOffset_))) && (completionColumn_ <= ((1 + last_.stopOffset_) - last_.stopLineOffset_)))) {
|
|
384
|
-
|
|
384
|
+
tokens_.array.push(ff_compiler_Token.Token(file_, code_, ff_compiler_Token.LSeparator(), startLine_, startLineOffset_, startLineOffset_, startLine_, startLineOffset_, startLineOffset_))
|
|
385
385
|
} else {
|
|
386
386
|
ff_core_Array.Array_modify(tokens_, (ff_core_Array.Array_size(tokens_) - 1), ((_w1) => {
|
|
387
387
|
{
|
|
@@ -395,10 +395,10 @@ return ff_compiler_Token.Token(_c.file_, _c.code_, ff_compiler_Token.LKeyword(),
|
|
|
395
395
|
}
|
|
396
396
|
};
|
|
397
397
|
if((((last_.stopLine_ !== startLine_) && ff_compiler_Token.TokenKind_beforeSeparator(last_.kind_)) && ff_compiler_Token.TokenKind_afterSeparator(kind_))) {
|
|
398
|
-
|
|
398
|
+
tokens_.array.push(ff_compiler_Token.Token(file_, code_, ff_compiler_Token.LSeparator(), startLine_, startLineOffset_, startLineOffset_, startLine_, startLineOffset_, startLineOffset_))
|
|
399
399
|
}
|
|
400
400
|
};
|
|
401
|
-
|
|
401
|
+
tokens_.array.push(ff_compiler_Token.Token(file_, code_, kind_, startLine_, startLineOffset_, startOffset_, line_, lineOffset_, stopOffset_))
|
|
402
402
|
}
|
|
403
403
|
let i_ = 0;
|
|
404
404
|
function throwError_(message_) {
|
|
@@ -592,9 +592,9 @@ const error_ = _error;
|
|
|
592
592
|
throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_compiler_Syntax.Location(file_, line_, (i_ - lineOffset_)), "Unexpected end of file"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
|
|
593
593
|
}
|
|
594
594
|
};
|
|
595
|
-
|
|
595
|
+
for(let for_i = 0, for_a = ff_core_List.range_(5), for_l = for_a.length; for_i < for_l; for_i++) {
|
|
596
596
|
emitToken_(ff_compiler_Token.LEnd(), i_, i_)
|
|
597
|
-
}
|
|
597
|
+
};
|
|
598
598
|
return ff_core_Array.Array_drain(tokens_)
|
|
599
599
|
}
|
|
600
600
|
|
|
@@ -312,17 +312,18 @@ const instantiation_ = ff_core_List.List_toMap(ff_core_List.List_zip(definition_
|
|
|
312
312
|
const traitType1_ = ff_compiler_Unification.Unification_instantiate(self_, instantiation_, ff_compiler_Syntax.TConstructor(at_, definition_.traitName_, definition_.typeArguments_));
|
|
313
313
|
const traitType2_ = ff_compiler_Syntax.TConstructor(at_, constraintName_, [type_, ...generics_]);
|
|
314
314
|
ff_compiler_Unification.Unification_unify(self_, at_, traitType1_, traitType2_);
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
for(let for_i = 0, for_a = definition_.constraints_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
316
|
+
const constraint_ = for_a[for_i];
|
|
317
|
+
do {
|
|
317
318
|
const _1 = ff_compiler_Unification.Unification_instantiateConstraint(self_, instantiation_, constraint_);
|
|
318
319
|
{
|
|
319
320
|
const constraintName_ = _1.name_;
|
|
320
321
|
const newGenerics_ = _1.generics_;
|
|
321
322
|
ff_compiler_Unification.Unification_constrain(self_, at_, ff_core_List.List_grabFirst(newGenerics_), constraintName_, ff_core_List.List_dropFirst(newGenerics_, 1))
|
|
322
|
-
|
|
323
|
+
break
|
|
323
324
|
}
|
|
325
|
+
} while(false)
|
|
324
326
|
}
|
|
325
|
-
}))
|
|
326
327
|
return
|
|
327
328
|
}
|
|
328
329
|
}
|
|
@@ -688,17 +689,18 @@ const instantiation_ = ff_core_List.List_toMap(ff_core_List.List_zip(definition_
|
|
|
688
689
|
const traitType1_ = ff_compiler_Unification.Unification_instantiate(self_, instantiation_, ff_compiler_Syntax.TConstructor(at_, definition_.traitName_, definition_.typeArguments_));
|
|
689
690
|
const traitType2_ = ff_compiler_Syntax.TConstructor(at_, constraintName_, [type_, ...generics_]);
|
|
690
691
|
ff_compiler_Unification.Unification_unify(self_, at_, traitType1_, traitType2_);
|
|
691
|
-
|
|
692
|
-
|
|
692
|
+
for(let for_i = 0, for_a = definition_.constraints_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
693
|
+
const constraint_ = for_a[for_i];
|
|
694
|
+
do {
|
|
693
695
|
const _1 = ff_compiler_Unification.Unification_instantiateConstraint(self_, instantiation_, constraint_);
|
|
694
696
|
{
|
|
695
697
|
const constraintName_ = _1.name_;
|
|
696
698
|
const newGenerics_ = _1.generics_;
|
|
697
699
|
ff_compiler_Unification.Unification_constrain(self_, at_, ff_core_List.List_grabFirst(newGenerics_), constraintName_, ff_core_List.List_dropFirst(newGenerics_, 1))
|
|
698
|
-
|
|
700
|
+
break
|
|
699
701
|
}
|
|
702
|
+
} while(false)
|
|
700
703
|
}
|
|
701
|
-
}))
|
|
702
704
|
return
|
|
703
705
|
}
|
|
704
706
|
}
|
|
@@ -591,26 +591,26 @@ throw new Error('Function Array_join is missing on this target in async context.
|
|
|
591
591
|
export function ff_core_Show_Show$ff_core_Array_Array(ff_core_Show_Show$T) { return {
|
|
592
592
|
show_(value_) {
|
|
593
593
|
const array_ = ff_core_Array.new_();
|
|
594
|
-
|
|
594
|
+
array_.array.push("[");
|
|
595
595
|
ff_core_Array.Array_each(value_, ((x_) => {
|
|
596
596
|
if((ff_core_Array.Array_size(array_) > 1)) {
|
|
597
|
-
|
|
597
|
+
array_.array.push(", ")
|
|
598
598
|
};
|
|
599
|
-
|
|
599
|
+
array_.array.push(ff_core_Show_Show$T.show_(x_))
|
|
600
600
|
}));
|
|
601
|
-
|
|
601
|
+
array_.array.push("].toArray()");
|
|
602
602
|
return ff_core_Array.Array_join(array_, "")
|
|
603
603
|
},
|
|
604
604
|
async show_$(value_, $task) {
|
|
605
605
|
const array_ = ff_core_Array.new_();
|
|
606
|
-
|
|
606
|
+
array_.array.push("[");
|
|
607
607
|
ff_core_Array.Array_each(value_, ((x_) => {
|
|
608
608
|
if((ff_core_Array.Array_size(array_) > 1)) {
|
|
609
|
-
|
|
609
|
+
array_.array.push(", ")
|
|
610
610
|
};
|
|
611
|
-
|
|
611
|
+
array_.array.push(ff_core_Show_Show$T.show_(x_))
|
|
612
612
|
}));
|
|
613
|
-
|
|
613
|
+
array_.array.push("].toArray()");
|
|
614
614
|
return ff_core_Array.Array_join(array_, "")
|
|
615
615
|
}
|
|
616
616
|
}}
|
|
@@ -141,7 +141,7 @@ export function Int_to(self_, inclusiveEnd_) {
|
|
|
141
141
|
const result_ = ff_core_Array.new_();
|
|
142
142
|
let n_ = self_;
|
|
143
143
|
while((n_ <= inclusiveEnd_)) {
|
|
144
|
-
|
|
144
|
+
result_.array.push(n_);
|
|
145
145
|
n_ += 1
|
|
146
146
|
};
|
|
147
147
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -151,7 +151,7 @@ export function Int_until(self_, exclusiveEnd_) {
|
|
|
151
151
|
const result_ = ff_core_Array.new_();
|
|
152
152
|
let n_ = self_;
|
|
153
153
|
while((n_ < exclusiveEnd_)) {
|
|
154
|
-
|
|
154
|
+
result_.array.push(n_);
|
|
155
155
|
n_ += 1
|
|
156
156
|
};
|
|
157
157
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -221,7 +221,7 @@ export async function Int_to$(self_, inclusiveEnd_, $task) {
|
|
|
221
221
|
const result_ = ff_core_Array.new_();
|
|
222
222
|
let n_ = self_;
|
|
223
223
|
while((n_ <= inclusiveEnd_)) {
|
|
224
|
-
|
|
224
|
+
result_.array.push(n_);
|
|
225
225
|
n_ += 1
|
|
226
226
|
};
|
|
227
227
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -231,7 +231,7 @@ export async function Int_until$(self_, exclusiveEnd_, $task) {
|
|
|
231
231
|
const result_ = ff_core_Array.new_();
|
|
232
232
|
let n_ = self_;
|
|
233
233
|
while((n_ < exclusiveEnd_)) {
|
|
234
|
-
|
|
234
|
+
result_.array.push(n_);
|
|
235
235
|
n_ += 1
|
|
236
236
|
};
|
|
237
237
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -150,7 +150,7 @@ for(const [k, v] of self_) if(!body_(k, v)) break
|
|
|
150
150
|
export function IntMap_toArray(self_) {
|
|
151
151
|
const array_ = ff_core_Array.new_();
|
|
152
152
|
ff_core_IntMap.IntMap_each(self_, ((k_, v_) => {
|
|
153
|
-
|
|
153
|
+
array_.array.push(ff_core_Pair.Pair(k_, v_))
|
|
154
154
|
}));
|
|
155
155
|
return array_
|
|
156
156
|
}
|
|
@@ -170,7 +170,7 @@ return ff_core_List.List_toMap(ff_core_IntMap.IntMap_toList(self_), ff_core_Orde
|
|
|
170
170
|
export function IntMap_keys(self_) {
|
|
171
171
|
const array_ = ff_core_Array.new_();
|
|
172
172
|
ff_core_IntMap.IntMap_each(self_, ((k_, v_) => {
|
|
173
|
-
|
|
173
|
+
array_.array.push(k_)
|
|
174
174
|
}));
|
|
175
175
|
return ff_core_Array.Array_toList(array_, 0, 9007199254740991)
|
|
176
176
|
}
|
|
@@ -178,7 +178,7 @@ return ff_core_Array.Array_toList(array_, 0, 9007199254740991)
|
|
|
178
178
|
export function IntMap_values(self_) {
|
|
179
179
|
const array_ = ff_core_Array.new_();
|
|
180
180
|
ff_core_IntMap.IntMap_each(self_, ((k_, v_) => {
|
|
181
|
-
|
|
181
|
+
array_.array.push(v_)
|
|
182
182
|
}));
|
|
183
183
|
return ff_core_Array.Array_toList(array_, 0, 9007199254740991)
|
|
184
184
|
}
|
|
@@ -233,7 +233,7 @@ for(const [k, v] of self_) if(!await body_(k, v)) break
|
|
|
233
233
|
export async function IntMap_toArray$(self_, $task) {
|
|
234
234
|
const array_ = ff_core_Array.new_();
|
|
235
235
|
ff_core_IntMap.IntMap_each(self_, ((k_, v_) => {
|
|
236
|
-
|
|
236
|
+
array_.array.push(ff_core_Pair.Pair(k_, v_))
|
|
237
237
|
}));
|
|
238
238
|
return array_
|
|
239
239
|
}
|
|
@@ -253,7 +253,7 @@ return ff_core_List.List_toMap(ff_core_IntMap.IntMap_toList(self_), ff_core_Orde
|
|
|
253
253
|
export async function IntMap_keys$(self_, $task) {
|
|
254
254
|
const array_ = ff_core_Array.new_();
|
|
255
255
|
ff_core_IntMap.IntMap_each(self_, ((k_, v_) => {
|
|
256
|
-
|
|
256
|
+
array_.array.push(k_)
|
|
257
257
|
}));
|
|
258
258
|
return ff_core_Array.Array_toList(array_, 0, 9007199254740991)
|
|
259
259
|
}
|
|
@@ -261,7 +261,7 @@ return ff_core_Array.Array_toList(array_, 0, 9007199254740991)
|
|
|
261
261
|
export async function IntMap_values$(self_, $task) {
|
|
262
262
|
const array_ = ff_core_Array.new_();
|
|
263
263
|
ff_core_IntMap.IntMap_each(self_, ((k_, v_) => {
|
|
264
|
-
|
|
264
|
+
array_.array.push(v_)
|
|
265
265
|
}));
|
|
266
266
|
return ff_core_Array.Array_toList(array_, 0, 9007199254740991)
|
|
267
267
|
}
|
|
@@ -286,7 +286,7 @@ return
|
|
|
286
286
|
}
|
|
287
287
|
if(_1.Some) {
|
|
288
288
|
const array_ = _1.value_;
|
|
289
|
-
|
|
289
|
+
array_.array.push(value_)
|
|
290
290
|
return
|
|
291
291
|
}
|
|
292
292
|
}
|
|
@@ -301,7 +301,7 @@ return
|
|
|
301
301
|
}
|
|
302
302
|
if(_1.Some) {
|
|
303
303
|
const array_ = _1.value_;
|
|
304
|
-
|
|
304
|
+
array_.array.push(value_)
|
|
305
305
|
return
|
|
306
306
|
}
|
|
307
307
|
}
|
|
@@ -505,7 +505,7 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.G
|
|
|
505
505
|
export function Json_map(self_, body_) {
|
|
506
506
|
const array_ = ff_core_Array.new_();
|
|
507
507
|
ff_core_Json.Json_each(self_, ((field_, value_) => {
|
|
508
|
-
|
|
508
|
+
array_.array.push(body_(field_, value_))
|
|
509
509
|
}));
|
|
510
510
|
return ff_core_Array.Array_drain(array_)
|
|
511
511
|
}
|
|
@@ -681,7 +681,7 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.G
|
|
|
681
681
|
export async function Json_map$(self_, body_, $task) {
|
|
682
682
|
const array_ = ff_core_Array.new_();
|
|
683
683
|
(await ff_core_Json.Json_each$(self_, (async (field_, value_, $task) => {
|
|
684
|
-
|
|
684
|
+
array_.array.push((await body_(field_, value_, $task)))
|
|
685
685
|
}), $task));
|
|
686
686
|
return ff_core_Array.Array_drain(array_)
|
|
687
687
|
}
|
|
@@ -825,7 +825,8 @@ fromJson_(json_) {
|
|
|
825
825
|
return ff_core_Option.Option_flatMap(ff_core_Json.Json_getArray(json_), ((array_) => {
|
|
826
826
|
let convertible_ = true;
|
|
827
827
|
const result_ = ff_core_Array.new_();
|
|
828
|
-
|
|
828
|
+
for(let for_i = 0, for_a = array_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
829
|
+
const item_ = for_a[for_i];
|
|
829
830
|
do {
|
|
830
831
|
const _1 = ff_core_Json_JsonLike$T.fromJson_(item_);
|
|
831
832
|
if(_1.None) {
|
|
@@ -834,12 +835,12 @@ break
|
|
|
834
835
|
}
|
|
835
836
|
if(_1.Some) {
|
|
836
837
|
const value_ = _1.value_;
|
|
837
|
-
|
|
838
|
+
result_.array.push(value_)
|
|
838
839
|
break
|
|
839
840
|
}
|
|
840
841
|
} while(false);
|
|
841
|
-
|
|
842
|
-
}
|
|
842
|
+
if(!convertible_) break
|
|
843
|
+
};
|
|
843
844
|
if(convertible_) {
|
|
844
845
|
return ff_core_Option.Some(ff_core_Array.Array_drain(result_))
|
|
845
846
|
} else return ff_core_Option.None()
|
|
@@ -854,7 +855,8 @@ async fromJson_$(json_, $task) {
|
|
|
854
855
|
return ff_core_Option.Option_flatMap(ff_core_Json.Json_getArray(json_), ((array_) => {
|
|
855
856
|
let convertible_ = true;
|
|
856
857
|
const result_ = ff_core_Array.new_();
|
|
857
|
-
|
|
858
|
+
for(let for_i = 0, for_a = array_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
859
|
+
const item_ = for_a[for_i];
|
|
858
860
|
do {
|
|
859
861
|
const _1 = ff_core_Json_JsonLike$T.fromJson_(item_);
|
|
860
862
|
if(_1.None) {
|
|
@@ -863,12 +865,12 @@ break
|
|
|
863
865
|
}
|
|
864
866
|
if(_1.Some) {
|
|
865
867
|
const value_ = _1.value_;
|
|
866
|
-
|
|
868
|
+
result_.array.push(value_)
|
|
867
869
|
break
|
|
868
870
|
}
|
|
869
871
|
} while(false);
|
|
870
|
-
|
|
871
|
-
}
|
|
872
|
+
if(!convertible_) break
|
|
873
|
+
};
|
|
872
874
|
if(convertible_) {
|
|
873
875
|
return ff_core_Option.Some(ff_core_Array.Array_drain(result_))
|
|
874
876
|
} else return ff_core_Option.None()
|