@elaraai/east 0.0.1-beta.3 → 0.0.1-beta.30
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/LICENSE.md +15 -666
- package/README.md +30 -8
- package/dist/src/analyze.d.ts +3 -0
- package/dist/src/analyze.d.ts.map +1 -1
- package/dist/src/analyze.js +52 -13
- package/dist/src/analyze.js.map +1 -1
- package/dist/src/ast.d.ts +34 -33
- package/dist/src/ast.d.ts.map +1 -1
- package/dist/src/ast_to_ir.d.ts +6 -0
- package/dist/src/ast_to_ir.d.ts.map +1 -1
- package/dist/src/ast_to_ir.js +134 -101
- package/dist/src/ast_to_ir.js.map +1 -1
- package/dist/src/builtins.d.ts +1 -1
- package/dist/src/builtins.d.ts.map +1 -1
- package/dist/src/builtins.js +32 -0
- package/dist/src/builtins.js.map +1 -1
- package/dist/src/comparison.d.ts.map +1 -1
- package/dist/src/comparison.js +12 -4
- package/dist/src/comparison.js.map +1 -1
- package/dist/src/compile.d.ts +26 -1
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +374 -257
- package/dist/src/compile.js.map +1 -1
- package/dist/src/datetime_format/types.d.ts +23 -23
- package/dist/src/eastir.d.ts.map +1 -1
- package/dist/src/eastir.js +21 -5
- package/dist/src/eastir.js.map +1 -1
- package/dist/src/error.d.ts +12 -1
- package/dist/src/error.d.ts.map +1 -1
- package/dist/src/error.js +31 -1
- package/dist/src/error.js.map +1 -1
- package/dist/src/expr/array.d.ts +109 -1
- package/dist/src/expr/array.d.ts.map +1 -1
- package/dist/src/expr/array.js +204 -44
- package/dist/src/expr/array.js.map +1 -1
- package/dist/src/expr/ast.d.ts +1 -1
- package/dist/src/expr/ast.d.ts.map +1 -1
- package/dist/src/expr/ast.js +16 -28
- package/dist/src/expr/ast.js.map +1 -1
- package/dist/src/expr/asyncfunction.js +1 -1
- package/dist/src/expr/asyncfunction.js.map +1 -1
- package/dist/src/expr/blob.d.ts +73 -1
- package/dist/src/expr/blob.d.ts.map +1 -1
- package/dist/src/expr/blob.js +97 -7
- package/dist/src/expr/blob.js.map +1 -1
- package/dist/src/expr/block.d.ts +206 -8
- package/dist/src/expr/block.d.ts.map +1 -1
- package/dist/src/expr/block.js +623 -136
- package/dist/src/expr/block.js.map +1 -1
- package/dist/src/expr/boolean.d.ts +44 -0
- package/dist/src/expr/boolean.d.ts.map +1 -1
- package/dist/src/expr/boolean.js +57 -5
- package/dist/src/expr/boolean.js.map +1 -1
- package/dist/src/expr/datetime.d.ts +135 -0
- package/dist/src/expr/datetime.d.ts.map +1 -1
- package/dist/src/expr/datetime.js +183 -33
- package/dist/src/expr/datetime.js.map +1 -1
- package/dist/src/expr/dict.d.ts +42 -0
- package/dist/src/expr/dict.d.ts.map +1 -1
- package/dist/src/expr/dict.js +105 -55
- package/dist/src/expr/dict.js.map +1 -1
- package/dist/src/expr/expr.d.ts +1 -1
- package/dist/src/expr/expr.d.ts.map +1 -1
- package/dist/src/expr/expr.js.map +1 -1
- package/dist/src/expr/float.d.ts +153 -0
- package/dist/src/expr/float.d.ts.map +1 -1
- package/dist/src/expr/float.js +190 -16
- package/dist/src/expr/float.js.map +1 -1
- package/dist/src/expr/function.d.ts +7 -2
- package/dist/src/expr/function.d.ts.map +1 -1
- package/dist/src/expr/function.js +1 -1
- package/dist/src/expr/function.js.map +1 -1
- package/dist/src/expr/index.d.ts +202 -2
- package/dist/src/expr/index.d.ts.map +1 -1
- package/dist/src/expr/index.js +207 -2
- package/dist/src/expr/index.js.map +1 -1
- package/dist/src/expr/integer.d.ts +180 -0
- package/dist/src/expr/integer.d.ts.map +1 -1
- package/dist/src/expr/integer.js +188 -17
- package/dist/src/expr/integer.js.map +1 -1
- package/dist/src/expr/libs/blob.js +2 -2
- package/dist/src/expr/libs/blob.js.map +1 -1
- package/dist/src/expr/libs/integer.d.ts +19 -0
- package/dist/src/expr/libs/integer.d.ts.map +1 -1
- package/dist/src/expr/libs/integer.js +47 -0
- package/dist/src/expr/libs/integer.js.map +1 -1
- package/dist/src/expr/libs/string.js +1 -1
- package/dist/src/expr/libs/string.js.map +1 -1
- package/dist/src/expr/recursive.d.ts +83 -0
- package/dist/src/expr/recursive.d.ts.map +1 -0
- package/dist/src/expr/recursive.js +99 -0
- package/dist/src/expr/recursive.js.map +1 -0
- package/dist/src/expr/ref.js +3 -3
- package/dist/src/expr/ref.js.map +1 -1
- package/dist/src/expr/set.d.ts +44 -2
- package/dist/src/expr/set.d.ts.map +1 -1
- package/dist/src/expr/set.js +97 -47
- package/dist/src/expr/set.js.map +1 -1
- package/dist/src/expr/string.d.ts +134 -0
- package/dist/src/expr/string.d.ts.map +1 -1
- package/dist/src/expr/string.js +172 -22
- package/dist/src/expr/string.js.map +1 -1
- package/dist/src/expr/struct.d.ts +1 -1
- package/dist/src/expr/struct.d.ts.map +1 -1
- package/dist/src/expr/struct.js +1 -1
- package/dist/src/expr/struct.js.map +1 -1
- package/dist/src/expr/types.d.ts +7 -6
- package/dist/src/expr/types.d.ts.map +1 -1
- package/dist/src/expr/variant.d.ts +123 -1
- package/dist/src/expr/variant.d.ts.map +1 -1
- package/dist/src/expr/variant.js +66 -2
- package/dist/src/expr/variant.js.map +1 -1
- package/dist/src/fuzz.d.ts +36 -2
- package/dist/src/fuzz.d.ts.map +1 -1
- package/dist/src/fuzz.js +344 -77
- package/dist/src/fuzz.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +12 -0
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +13 -0
- package/dist/src/internal.js.map +1 -1
- package/dist/src/ir.d.ts +1547 -1505
- package/dist/src/ir.d.ts.map +1 -1
- package/dist/src/ir.js +49 -34
- package/dist/src/ir.js.map +1 -1
- package/dist/src/location.d.ts +30 -10
- package/dist/src/location.d.ts.map +1 -1
- package/dist/src/location.js +70 -28
- package/dist/src/location.js.map +1 -1
- package/dist/src/patch/apply.d.ts +15 -0
- package/dist/src/patch/apply.d.ts.map +1 -0
- package/dist/src/patch/apply.js +380 -0
- package/dist/src/patch/apply.js.map +1 -0
- package/dist/src/patch/compose.d.ts +15 -0
- package/dist/src/patch/compose.d.ts.map +1 -0
- package/dist/src/patch/compose.js +480 -0
- package/dist/src/patch/compose.js.map +1 -0
- package/dist/src/patch/diff.d.ts +15 -0
- package/dist/src/patch/diff.d.ts.map +1 -0
- package/dist/src/patch/diff.js +328 -0
- package/dist/src/patch/diff.js.map +1 -0
- package/dist/src/patch/fuzz.d.ts +73 -0
- package/dist/src/patch/fuzz.d.ts.map +1 -0
- package/dist/src/patch/fuzz.js +159 -0
- package/dist/src/patch/fuzz.js.map +1 -0
- package/dist/src/patch/index.d.ts +18 -0
- package/dist/src/patch/index.d.ts.map +1 -0
- package/dist/src/patch/index.js +20 -0
- package/dist/src/patch/index.js.map +1 -0
- package/dist/src/patch/invert.d.ts +15 -0
- package/dist/src/patch/invert.d.ts.map +1 -0
- package/dist/src/patch/invert.js +302 -0
- package/dist/src/patch/invert.js.map +1 -0
- package/dist/src/patch/type_of_patch.d.ts +17 -0
- package/dist/src/patch/type_of_patch.d.ts.map +1 -0
- package/dist/src/patch/type_of_patch.js +143 -0
- package/dist/src/patch/type_of_patch.js.map +1 -0
- package/dist/src/patch/types.d.ts +166 -0
- package/dist/src/patch/types.d.ts.map +1 -0
- package/dist/src/patch/types.js +69 -0
- package/dist/src/patch/types.js.map +1 -0
- package/dist/src/platform.d.ts +6 -0
- package/dist/src/platform.d.ts.map +1 -1
- package/dist/src/serialization/beast.d.ts.map +1 -1
- package/dist/src/serialization/beast.js +53 -18
- package/dist/src/serialization/beast.js.map +1 -1
- package/dist/src/serialization/beast2.d.ts +39 -3
- package/dist/src/serialization/beast2.d.ts.map +1 -1
- package/dist/src/serialization/beast2.js +241 -18
- package/dist/src/serialization/beast2.js.map +1 -1
- package/dist/src/serialization/csv.d.ts +139 -0
- package/dist/src/serialization/csv.d.ts.map +1 -0
- package/dist/src/serialization/csv.js +615 -0
- package/dist/src/serialization/csv.js.map +1 -0
- package/dist/src/serialization/index.d.ts +2 -1
- package/dist/src/serialization/index.d.ts.map +1 -1
- package/dist/src/serialization/index.js +2 -1
- package/dist/src/serialization/index.js.map +1 -1
- package/dist/src/type_of_type.d.ts +45 -34
- package/dist/src/type_of_type.d.ts.map +1 -1
- package/dist/src/type_of_type.js +62 -1
- package/dist/src/type_of_type.js.map +1 -1
- package/dist/src/types.d.ts +8 -8
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +4 -4
- package/dist/src/types.js.map +1 -1
- package/package.json +4 -5
package/dist/src/compile.js
CHANGED
|
@@ -5,19 +5,47 @@
|
|
|
5
5
|
import {} from "./builtins.js";
|
|
6
6
|
import { printLocationValue } from "./ir.js";
|
|
7
7
|
import { compareFor, equalFor, greaterEqualFor, greaterFor, isFor, lessEqualFor, lessFor, notEqualFor } from "./comparison.js";
|
|
8
|
+
import { diffFor } from "./patch/diff.js";
|
|
9
|
+
import { applyFor } from "./patch/apply.js";
|
|
10
|
+
import { composeFor } from "./patch/compose.js";
|
|
11
|
+
import { invertFor } from "./patch/invert.js";
|
|
12
|
+
import { ConflictError } from "./patch/index.js";
|
|
8
13
|
import { printFor, parseFor } from "./serialization/east.js";
|
|
9
14
|
import { variant } from "./containers/variant.js";
|
|
10
|
-
import { EastError } from "./error.js";
|
|
15
|
+
import { EastError, InternalError } from "./error.js";
|
|
11
16
|
import { SortedSet } from "./containers/sortedset.js";
|
|
12
17
|
import { SortedMap } from "./containers/sortedmap.js";
|
|
13
18
|
import { BufferWriter } from "./serialization/binary-utils.js";
|
|
14
|
-
import { decodeBeast2For, decodeBeastFor, encodeBeast2For, encodeBeastFor, fromJSONFor, toJSONFor } from "./serialization/index.js";
|
|
19
|
+
import { decodeBeast2For, decodeBeastFor, encodeBeast2For, encodeBeastFor, fromJSONFor, toJSONFor, decodeCsvFor, encodeCsvFor } from "./serialization/index.js";
|
|
15
20
|
import { formatDateTime } from "./datetime_format/print.js";
|
|
16
21
|
import { parseDateTimeFormatted } from "./datetime_format/parse.js";
|
|
17
22
|
import { EastTypeValueType, isTypeValueEqual, expandTypeValue } from "./type_of_type.js";
|
|
18
23
|
import { ref } from "./containers/ref.js";
|
|
19
24
|
export { isTypeValueEqual };
|
|
20
25
|
export const printTypeValue = printFor(EastTypeValueType);
|
|
26
|
+
/**
|
|
27
|
+
* Symbol used to attach source IR to compiled functions.
|
|
28
|
+
* This enables serialization of free functions (functions with no captures).
|
|
29
|
+
*/
|
|
30
|
+
export const EAST_IR_SYMBOL = Symbol.for("east.ir");
|
|
31
|
+
/**
|
|
32
|
+
* Symbol used to attach capture values to compiled functions.
|
|
33
|
+
* This enables serialization of closures (functions with captures).
|
|
34
|
+
*/
|
|
35
|
+
export const EAST_CAPTURES_SYMBOL = Symbol.for("east.captures");
|
|
36
|
+
/** Determines if a variable requires boxing (mutable + captured) */
|
|
37
|
+
export function requiresBoxing(variable) {
|
|
38
|
+
return variable.mutable && variable.captured;
|
|
39
|
+
}
|
|
40
|
+
/** Get a context value, throwing InternalError if missing */
|
|
41
|
+
function getContextValue(ctx, name) {
|
|
42
|
+
const value = ctx[name];
|
|
43
|
+
if (value === undefined) {
|
|
44
|
+
throw new InternalError(`Variable '${name}' not found in runtime context`);
|
|
45
|
+
}
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
// =============================================================================
|
|
21
49
|
/** @internal Track iteration locks to prevent concurrent modification */
|
|
22
50
|
const iterationLocks = new WeakMap();
|
|
23
51
|
/** @internal Lock a collection for iteration (prevents size/keyset modifications) */
|
|
@@ -63,7 +91,7 @@ class BreakException {
|
|
|
63
91
|
*
|
|
64
92
|
* @internal
|
|
65
93
|
*/
|
|
66
|
-
export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx = true, compilingNodes = new Set()) {
|
|
94
|
+
export function compile_internal(ir, ctx, platform, asyncPlatformFns, platformDef, fresh_ctx = true, compilingNodes = new Set()) {
|
|
67
95
|
// The IR is checked prior to compilation, so we can assume it's valid here.
|
|
68
96
|
// The compiler needs to take care that Promises are properly awaited, so most IR nodes need both sync and async implementations.
|
|
69
97
|
// We assume unnecessary `async` functions degrade performance but unnecessary `await`s are not too bad, so while we could be more "specific" in our awaits we do not bother
|
|
@@ -73,7 +101,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
73
101
|
return (_ctx) => v;
|
|
74
102
|
}
|
|
75
103
|
else if (ir.type === "Error") {
|
|
76
|
-
const message_compiled = compile_internal(ir.value.message, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
104
|
+
const message_compiled = compile_internal(ir.value.message, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
77
105
|
const location = ir.value.location;
|
|
78
106
|
if (ir.value.isAsync) {
|
|
79
107
|
return async (ctx) => { throw new EastError(await message_compiled(ctx), { location: location }); };
|
|
@@ -83,15 +111,15 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
83
111
|
}
|
|
84
112
|
}
|
|
85
113
|
else if (ir.type === "TryCatch") {
|
|
86
|
-
const try_body = compile_internal(ir.value.try_body, Object.create(ctx), platform, asyncPlatformFns, true, compilingNodes);
|
|
114
|
+
const try_body = compile_internal(ir.value.try_body, Object.create(ctx), platform, asyncPlatformFns, platformDef, true, compilingNodes);
|
|
87
115
|
const new_ctx = Object.create(ctx);
|
|
88
116
|
const message_name = ir.value.message.value.name;
|
|
89
117
|
const stack_name = ir.value.stack.value.name;
|
|
90
118
|
new_ctx[message_name] = ir.value.message.value.type;
|
|
91
119
|
new_ctx[stack_name] = ir.value.stack.value.type;
|
|
92
|
-
const catch_body = compile_internal(ir.value.catch_body, new_ctx, platform, asyncPlatformFns, true, compilingNodes);
|
|
120
|
+
const catch_body = compile_internal(ir.value.catch_body, new_ctx, platform, asyncPlatformFns, platformDef, true, compilingNodes);
|
|
93
121
|
// Don't include finally unless necessary (Value nodes are effect free)
|
|
94
|
-
const finally_body = ir.value.finally_body.type === "Value" ? undefined : compile_internal(ir.value.finally_body, Object.create(ctx), platform, asyncPlatformFns, true, compilingNodes);
|
|
122
|
+
const finally_body = ir.value.finally_body.type === "Value" ? undefined : compile_internal(ir.value.finally_body, Object.create(ctx), platform, asyncPlatformFns, platformDef, true, compilingNodes);
|
|
95
123
|
if (ir.value.isAsync) {
|
|
96
124
|
if (finally_body === undefined) {
|
|
97
125
|
return async (ctx) => {
|
|
@@ -101,8 +129,8 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
101
129
|
catch (e) {
|
|
102
130
|
if (e instanceof EastError) {
|
|
103
131
|
const new_ctx = Object.create(ctx);
|
|
104
|
-
new_ctx[message_name] = e.message;
|
|
105
|
-
new_ctx[stack_name] = e.location;
|
|
132
|
+
new_ctx[message_name] = variant("value", e.message);
|
|
133
|
+
new_ctx[stack_name] = variant("value", e.location);
|
|
106
134
|
return await catch_body(new_ctx);
|
|
107
135
|
}
|
|
108
136
|
else {
|
|
@@ -119,8 +147,8 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
119
147
|
catch (e) {
|
|
120
148
|
if (e instanceof EastError) {
|
|
121
149
|
const new_ctx = Object.create(ctx);
|
|
122
|
-
new_ctx[message_name] = e.message;
|
|
123
|
-
new_ctx[stack_name] = e.location;
|
|
150
|
+
new_ctx[message_name] = variant("value", e.message);
|
|
151
|
+
new_ctx[stack_name] = variant("value", e.location);
|
|
124
152
|
return await catch_body(new_ctx);
|
|
125
153
|
}
|
|
126
154
|
else {
|
|
@@ -142,8 +170,8 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
142
170
|
catch (e) {
|
|
143
171
|
if (e instanceof EastError) {
|
|
144
172
|
const new_ctx = Object.create(ctx);
|
|
145
|
-
new_ctx[message_name] = e.message;
|
|
146
|
-
new_ctx[stack_name] = e.location;
|
|
173
|
+
new_ctx[message_name] = variant("value", e.message);
|
|
174
|
+
new_ctx[stack_name] = variant("value", e.location);
|
|
147
175
|
return catch_body(new_ctx);
|
|
148
176
|
}
|
|
149
177
|
else {
|
|
@@ -160,8 +188,8 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
160
188
|
catch (e) {
|
|
161
189
|
if (e instanceof EastError) {
|
|
162
190
|
const new_ctx = Object.create(ctx);
|
|
163
|
-
new_ctx[message_name] = e.message;
|
|
164
|
-
new_ctx[stack_name] = e.location;
|
|
191
|
+
new_ctx[message_name] = variant("value", e.message);
|
|
192
|
+
new_ctx[stack_name] = variant("value", e.location);
|
|
165
193
|
return catch_body(new_ctx);
|
|
166
194
|
}
|
|
167
195
|
else {
|
|
@@ -177,73 +205,58 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
177
205
|
}
|
|
178
206
|
else if (ir.type === "Variable") {
|
|
179
207
|
const name = ir.value.name;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
return (ctx) => ctx[name];
|
|
185
|
-
}
|
|
208
|
+
// All context values are variants - read via .value
|
|
209
|
+
return (ctx) => getContextValue(ctx, name).value;
|
|
186
210
|
}
|
|
187
211
|
else if (ir.type === "Let") {
|
|
188
|
-
const compiled_statement = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
212
|
+
const compiled_statement = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
189
213
|
const name = ir.value.variable.value.name;
|
|
190
214
|
ctx[name] = ir.value.variable.value.type;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
return (ctx) => {
|
|
200
|
-
ctx[name] = { x: compiled_statement(ctx) };
|
|
201
|
-
return null;
|
|
202
|
-
};
|
|
203
|
-
}
|
|
215
|
+
const boxed = requiresBoxing(ir.value.variable.value);
|
|
216
|
+
if (ir.value.isAsync) {
|
|
217
|
+
return async (ctx) => {
|
|
218
|
+
ctx[name] = boxed
|
|
219
|
+
? variant("boxed", await compiled_statement(ctx))
|
|
220
|
+
: variant("value", await compiled_statement(ctx));
|
|
221
|
+
return null;
|
|
222
|
+
};
|
|
204
223
|
}
|
|
205
224
|
else {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
return (ctx) => {
|
|
214
|
-
ctx[name] = compiled_statement(ctx);
|
|
215
|
-
return null;
|
|
216
|
-
};
|
|
217
|
-
}
|
|
225
|
+
return (ctx) => {
|
|
226
|
+
ctx[name] = boxed
|
|
227
|
+
? variant("boxed", compiled_statement(ctx))
|
|
228
|
+
: variant("value", compiled_statement(ctx));
|
|
229
|
+
return null;
|
|
230
|
+
};
|
|
218
231
|
}
|
|
219
232
|
}
|
|
220
233
|
else if (ir.type === "Assign") {
|
|
221
234
|
const name = ir.value.variable.value.name;
|
|
222
|
-
const compiled_statement = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
223
|
-
if (ir.value.variable.value
|
|
235
|
+
const compiled_statement = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
236
|
+
if (requiresBoxing(ir.value.variable.value)) {
|
|
237
|
+
// Boxed variables: mutate in place via .value
|
|
224
238
|
if (ir.value.isAsync) {
|
|
225
239
|
return async (ctx) => {
|
|
226
|
-
|
|
227
|
-
ctx[name].x = value;
|
|
240
|
+
getContextValue(ctx, name).value = await compiled_statement(ctx);
|
|
228
241
|
return null;
|
|
229
242
|
};
|
|
230
243
|
}
|
|
231
244
|
else {
|
|
232
245
|
return (ctx) => {
|
|
233
|
-
|
|
234
|
-
ctx[name].x = value;
|
|
246
|
+
getContextValue(ctx, name).value = compiled_statement(ctx);
|
|
235
247
|
return null;
|
|
236
248
|
};
|
|
237
249
|
}
|
|
238
250
|
}
|
|
239
251
|
else {
|
|
252
|
+
// Non-boxed variables: replace the variant
|
|
240
253
|
if (ir.value.isAsync) {
|
|
241
254
|
return async (ctx) => {
|
|
242
255
|
const value = await compiled_statement(ctx);
|
|
243
256
|
// We need to check in which prototype the variable lives
|
|
244
257
|
while (!Object.hasOwn(ctx, name))
|
|
245
258
|
ctx = Object.getPrototypeOf(ctx);
|
|
246
|
-
ctx[name] = value;
|
|
259
|
+
ctx[name] = variant("value", value);
|
|
247
260
|
return null;
|
|
248
261
|
};
|
|
249
262
|
}
|
|
@@ -253,7 +266,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
253
266
|
// We need to check in which prototype the variable lives
|
|
254
267
|
while (!Object.hasOwn(ctx, name))
|
|
255
268
|
ctx = Object.getPrototypeOf(ctx);
|
|
256
|
-
ctx[name] = value;
|
|
269
|
+
ctx[name] = variant("value", value);
|
|
257
270
|
return null;
|
|
258
271
|
};
|
|
259
272
|
}
|
|
@@ -262,69 +275,105 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
262
275
|
else if (ir.type === "As") {
|
|
263
276
|
// in dynamically typed runtimes like Javascript, this is a no-op
|
|
264
277
|
// (for statically typed runtimes this assists in unifying types in branches)
|
|
265
|
-
return compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, fresh_ctx, compilingNodes);
|
|
278
|
+
return compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, fresh_ctx, compilingNodes);
|
|
266
279
|
}
|
|
267
280
|
else if (ir.type === "UnwrapRecursive") {
|
|
268
281
|
// in dynamically typed runtimes like Javascript, this is a no-op
|
|
269
282
|
// (for statically typed runtimes this assists in e.g. typing a reference or pointer)
|
|
270
|
-
return compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, fresh_ctx, compilingNodes);
|
|
283
|
+
return compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, fresh_ctx, compilingNodes);
|
|
271
284
|
}
|
|
272
285
|
else if (ir.type === "WrapRecursive") {
|
|
273
286
|
// in dynamically typed runtimes like Javascript, this is a no-op
|
|
274
287
|
// (for statically typed runtimes this assists in e.g. typing a heap allocation)
|
|
275
|
-
return compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
288
|
+
return compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
276
289
|
}
|
|
277
290
|
else if (ir.type === "Function") {
|
|
278
|
-
|
|
291
|
+
// Compile-time type context for body compilation
|
|
292
|
+
const typeCtx = {};
|
|
279
293
|
for (const variable of ir.value.captures) {
|
|
280
|
-
|
|
294
|
+
typeCtx[variable.value.name] = variable.value.type;
|
|
281
295
|
}
|
|
282
296
|
for (const parameter of ir.value.parameters) {
|
|
283
|
-
|
|
284
|
-
ctx2[parameter_name] = parameter.value.type;
|
|
297
|
+
typeCtx[parameter.value.name] = parameter.value.type;
|
|
285
298
|
}
|
|
286
|
-
const compiled_body = compile_internal(ir.value.body,
|
|
299
|
+
const compiled_body = compile_internal(ir.value.body, typeCtx, platform, asyncPlatformFns, platformDef, true, compilingNodes);
|
|
287
300
|
const capture_names = ir.value.captures.map(v => v.value.name);
|
|
288
301
|
const parameter_names = ir.value.parameters.map(v => v.value.name);
|
|
302
|
+
// Store original IR for potential serialization
|
|
303
|
+
const originalIR = ir;
|
|
289
304
|
return (ctx) => {
|
|
290
|
-
|
|
305
|
+
// Runtime context for captured values
|
|
306
|
+
const captureCtx = {};
|
|
291
307
|
for (const name of capture_names) {
|
|
292
|
-
|
|
308
|
+
captureCtx[name] = getContextValue(ctx, name);
|
|
293
309
|
}
|
|
294
|
-
|
|
295
|
-
const
|
|
296
|
-
parameter_names.forEach((name, i) =>
|
|
297
|
-
return compiled_body(
|
|
310
|
+
const fn = (...args) => {
|
|
311
|
+
const fnCtx = { ...captureCtx };
|
|
312
|
+
parameter_names.forEach((name, i) => fnCtx[name] = variant("value", args[i]));
|
|
313
|
+
return compiled_body(fnCtx);
|
|
298
314
|
};
|
|
315
|
+
// Attach IR to function for serialization support
|
|
316
|
+
Object.defineProperty(fn, EAST_IR_SYMBOL, {
|
|
317
|
+
value: originalIR,
|
|
318
|
+
writable: false,
|
|
319
|
+
enumerable: false,
|
|
320
|
+
configurable: false
|
|
321
|
+
});
|
|
322
|
+
// Attach capture values for serialization support
|
|
323
|
+
Object.defineProperty(fn, EAST_CAPTURES_SYMBOL, {
|
|
324
|
+
value: captureCtx,
|
|
325
|
+
writable: false,
|
|
326
|
+
enumerable: false,
|
|
327
|
+
configurable: false
|
|
328
|
+
});
|
|
329
|
+
return fn;
|
|
299
330
|
};
|
|
300
331
|
}
|
|
301
332
|
else if (ir.type === "AsyncFunction") {
|
|
302
|
-
|
|
333
|
+
// Compile-time type context for body compilation
|
|
334
|
+
const typeCtx = {};
|
|
303
335
|
for (const variable of ir.value.captures) {
|
|
304
|
-
|
|
336
|
+
typeCtx[variable.value.name] = variable.value.type;
|
|
305
337
|
}
|
|
306
338
|
for (const parameter of ir.value.parameters) {
|
|
307
|
-
|
|
308
|
-
ctx2[parameter_name] = parameter.value.type;
|
|
339
|
+
typeCtx[parameter.value.name] = parameter.value.type;
|
|
309
340
|
}
|
|
310
|
-
const compiled_body = compile_internal(ir.value.body,
|
|
341
|
+
const compiled_body = compile_internal(ir.value.body, typeCtx, platform, asyncPlatformFns, platformDef, true, compilingNodes);
|
|
311
342
|
const capture_names = ir.value.captures.map(v => v.value.name);
|
|
312
343
|
const parameter_names = ir.value.parameters.map(v => v.value.name);
|
|
344
|
+
// Store original IR for potential serialization
|
|
345
|
+
const originalIR = ir;
|
|
313
346
|
return (ctx) => {
|
|
314
|
-
|
|
347
|
+
// Runtime context for captured values
|
|
348
|
+
const captureCtx = {};
|
|
315
349
|
for (const name of capture_names) {
|
|
316
|
-
|
|
350
|
+
captureCtx[name] = getContextValue(ctx, name);
|
|
317
351
|
}
|
|
318
|
-
|
|
319
|
-
const
|
|
320
|
-
parameter_names.forEach((name, i) =>
|
|
321
|
-
return compiled_body(
|
|
352
|
+
const fn = (...args) => {
|
|
353
|
+
const fnCtx = { ...captureCtx };
|
|
354
|
+
parameter_names.forEach((name, i) => fnCtx[name] = variant("value", args[i]));
|
|
355
|
+
return compiled_body(fnCtx); // Promise can pass through in tail position
|
|
322
356
|
};
|
|
357
|
+
// Attach IR to function for serialization support
|
|
358
|
+
Object.defineProperty(fn, EAST_IR_SYMBOL, {
|
|
359
|
+
value: originalIR,
|
|
360
|
+
writable: false,
|
|
361
|
+
enumerable: false,
|
|
362
|
+
configurable: false
|
|
363
|
+
});
|
|
364
|
+
// Attach capture values for serialization support
|
|
365
|
+
Object.defineProperty(fn, EAST_CAPTURES_SYMBOL, {
|
|
366
|
+
value: captureCtx,
|
|
367
|
+
writable: false,
|
|
368
|
+
enumerable: false,
|
|
369
|
+
configurable: false
|
|
370
|
+
});
|
|
371
|
+
return fn;
|
|
323
372
|
};
|
|
324
373
|
}
|
|
325
374
|
else if (ir.type === "Call") {
|
|
326
|
-
const compiled_f = compile_internal(ir.value.function, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
327
|
-
const compiled_args = ir.value.arguments.map(argument => compile_internal(argument, ctx, platform, asyncPlatformFns, false, compilingNodes));
|
|
375
|
+
const compiled_f = compile_internal(ir.value.function, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
376
|
+
const compiled_args = ir.value.arguments.map(argument => compile_internal(argument, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes));
|
|
328
377
|
const location = ir.value.location;
|
|
329
378
|
if (ir.value.isAsync) {
|
|
330
379
|
// need to await the arguments
|
|
@@ -341,7 +390,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
341
390
|
return e.value;
|
|
342
391
|
}
|
|
343
392
|
else if (e instanceof EastError) {
|
|
344
|
-
e.location.push(location); // The fact that we need to push the call location not the definition location means we need to handle this here
|
|
393
|
+
e.location.push(...location); // The fact that we need to push the call location not the definition location means we need to handle this here
|
|
345
394
|
throw (e);
|
|
346
395
|
}
|
|
347
396
|
else if (e instanceof ContinueException) {
|
|
@@ -366,7 +415,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
366
415
|
return e.value;
|
|
367
416
|
}
|
|
368
417
|
else if (e instanceof EastError) {
|
|
369
|
-
e.location.push(location); // The fact that we need to push the call location not the definition location means we need to handle this here
|
|
418
|
+
e.location.push(...location); // The fact that we need to push the call location not the definition location means we need to handle this here
|
|
370
419
|
throw (e);
|
|
371
420
|
}
|
|
372
421
|
else if (e instanceof ContinueException) {
|
|
@@ -383,8 +432,8 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
383
432
|
}
|
|
384
433
|
}
|
|
385
434
|
else if (ir.type === "CallAsync") {
|
|
386
|
-
const compiled_f = compile_internal(ir.value.function, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
387
|
-
const compiled_args = ir.value.arguments.map(argument => compile_internal(argument, ctx, platform, asyncPlatformFns, false, compilingNodes));
|
|
435
|
+
const compiled_f = compile_internal(ir.value.function, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
436
|
+
const compiled_args = ir.value.arguments.map(argument => compile_internal(argument, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes));
|
|
388
437
|
const location = ir.value.location;
|
|
389
438
|
return async (ctx) => {
|
|
390
439
|
try {
|
|
@@ -399,7 +448,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
399
448
|
return e.value;
|
|
400
449
|
}
|
|
401
450
|
else if (e instanceof EastError) {
|
|
402
|
-
e.location.push(location); // The fact that we need to push the call location not the definition location means we need to handle this here
|
|
451
|
+
e.location.push(...location); // The fact that we need to push the call location not the definition location means we need to handle this here
|
|
403
452
|
throw (e);
|
|
404
453
|
}
|
|
405
454
|
else if (e instanceof ContinueException) {
|
|
@@ -422,11 +471,11 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
422
471
|
asyncPredicate = true;
|
|
423
472
|
}
|
|
424
473
|
ifs.push({
|
|
425
|
-
predicate: compile_internal(predicate, ctx, platform, asyncPlatformFns, false, compilingNodes),
|
|
426
|
-
body: compile_internal(body, Object.create(ctx), platform, asyncPlatformFns, true, compilingNodes),
|
|
474
|
+
predicate: compile_internal(predicate, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes),
|
|
475
|
+
body: compile_internal(body, Object.create(ctx), platform, asyncPlatformFns, platformDef, true, compilingNodes),
|
|
427
476
|
});
|
|
428
477
|
}
|
|
429
|
-
const else_body = compile_internal(ir.value.else_body, Object.create(ctx), platform, asyncPlatformFns, true, compilingNodes);
|
|
478
|
+
const else_body = compile_internal(ir.value.else_body, Object.create(ctx), platform, asyncPlatformFns, platformDef, true, compilingNodes);
|
|
430
479
|
if (ir.value.isAsync) {
|
|
431
480
|
if (asyncPredicate) {
|
|
432
481
|
return async (ctx) => {
|
|
@@ -461,7 +510,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
461
510
|
}
|
|
462
511
|
}
|
|
463
512
|
else if (ir.type === "Match") {
|
|
464
|
-
const compiled_variant = compile_internal(ir.value.variant, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
513
|
+
const compiled_variant = compile_internal(ir.value.variant, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
465
514
|
const compiled_cases = {};
|
|
466
515
|
const data_names = {};
|
|
467
516
|
for (const { case: k, variable, body } of ir.value.cases) {
|
|
@@ -469,14 +518,14 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
469
518
|
const data_name = variable.value.name;
|
|
470
519
|
data_names[k] = data_name;
|
|
471
520
|
ctx2[data_name] = variable.value.type;
|
|
472
|
-
compiled_cases[k] = compile_internal(body, ctx2, platform, asyncPlatformFns, true, compilingNodes);
|
|
521
|
+
compiled_cases[k] = compile_internal(body, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
|
|
473
522
|
}
|
|
474
523
|
if (ir.value.isAsync) {
|
|
475
524
|
if (ir.value.variant.value.isAsync) {
|
|
476
525
|
return async (ctx) => {
|
|
477
526
|
const v = await compiled_variant(ctx);
|
|
478
527
|
const ctx2 = Object.create(ctx);
|
|
479
|
-
ctx2[data_names[v.type]] = v.value;
|
|
528
|
+
ctx2[data_names[v.type]] = variant("value", v.value);
|
|
480
529
|
return await compiled_cases[v.type](ctx2);
|
|
481
530
|
};
|
|
482
531
|
}
|
|
@@ -484,7 +533,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
484
533
|
return async (ctx) => {
|
|
485
534
|
const v = compiled_variant(ctx);
|
|
486
535
|
const ctx2 = Object.create(ctx);
|
|
487
|
-
ctx2[data_names[v.type]] = v.value;
|
|
536
|
+
ctx2[data_names[v.type]] = variant("value", v.value);
|
|
488
537
|
return await compiled_cases[v.type](ctx2);
|
|
489
538
|
};
|
|
490
539
|
}
|
|
@@ -493,15 +542,15 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
493
542
|
return (ctx) => {
|
|
494
543
|
const v = compiled_variant(ctx);
|
|
495
544
|
const ctx2 = Object.create(ctx);
|
|
496
|
-
ctx2[data_names[v.type]] = v.value;
|
|
545
|
+
ctx2[data_names[v.type]] = variant("value", v.value);
|
|
497
546
|
return compiled_cases[v.type](ctx2);
|
|
498
547
|
};
|
|
499
548
|
}
|
|
500
549
|
}
|
|
501
550
|
else if (ir.type === "While") {
|
|
502
|
-
const compiled_predicate = compile_internal(ir.value.predicate, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
551
|
+
const compiled_predicate = compile_internal(ir.value.predicate, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
503
552
|
const ctx2 = Object.create(ctx);
|
|
504
|
-
const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, true, compilingNodes);
|
|
553
|
+
const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
|
|
505
554
|
const label = ir.value.label.name;
|
|
506
555
|
if (ir.value.isAsync) {
|
|
507
556
|
return async (ctx) => {
|
|
@@ -550,13 +599,13 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
550
599
|
}
|
|
551
600
|
else if (ir.type === "ForArray") {
|
|
552
601
|
const value_type = expandTypeValue(ir.value.array.value.type).value;
|
|
553
|
-
const compiled_array = compile_internal(ir.value.array, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
602
|
+
const compiled_array = compile_internal(ir.value.array, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
554
603
|
const ctx2 = Object.create(ctx);
|
|
555
604
|
const key_name = ir.value.key.value.name;
|
|
556
605
|
const value_name = ir.value.value.value.name;
|
|
557
606
|
ctx2[key_name] = variant("Integer", null);
|
|
558
607
|
ctx2[value_name] = value_type;
|
|
559
|
-
const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, true, compilingNodes);
|
|
608
|
+
const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
|
|
560
609
|
const label = ir.value.label.name;
|
|
561
610
|
if (ir.value.isAsync) {
|
|
562
611
|
return async (ctx) => {
|
|
@@ -565,8 +614,8 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
565
614
|
try {
|
|
566
615
|
for (const [key, value] of array.entries()) {
|
|
567
616
|
const ctx2 = Object.create(ctx);
|
|
568
|
-
ctx2[key_name] = BigInt(key);
|
|
569
|
-
ctx2[value_name] = value;
|
|
617
|
+
ctx2[key_name] = variant("value", BigInt(key));
|
|
618
|
+
ctx2[value_name] = variant("value", value);
|
|
570
619
|
try {
|
|
571
620
|
await compiled_body(ctx2);
|
|
572
621
|
}
|
|
@@ -596,8 +645,8 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
596
645
|
try {
|
|
597
646
|
for (const [key, value] of array.entries()) {
|
|
598
647
|
const ctx2 = Object.create(ctx);
|
|
599
|
-
ctx2[key_name] = BigInt(key);
|
|
600
|
-
ctx2[value_name] = value;
|
|
648
|
+
ctx2[key_name] = variant("value", BigInt(key));
|
|
649
|
+
ctx2[value_name] = variant("value", value);
|
|
601
650
|
try {
|
|
602
651
|
compiled_body(ctx2);
|
|
603
652
|
}
|
|
@@ -623,11 +672,11 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
623
672
|
}
|
|
624
673
|
else if (ir.type === "ForSet") {
|
|
625
674
|
const key_type = expandTypeValue(ir.value.set.value.type).value;
|
|
626
|
-
const compiled_set = compile_internal(ir.value.set, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
675
|
+
const compiled_set = compile_internal(ir.value.set, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
627
676
|
const ctx2 = Object.create(ctx);
|
|
628
677
|
const key_name = ir.value.key.value.name;
|
|
629
678
|
ctx2[key_name] = key_type;
|
|
630
|
-
const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, true, compilingNodes);
|
|
679
|
+
const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
|
|
631
680
|
const label = ir.value.label.name;
|
|
632
681
|
if (ir.value.isAsync) {
|
|
633
682
|
return async (ctx) => {
|
|
@@ -636,7 +685,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
636
685
|
try {
|
|
637
686
|
for (const key of set) {
|
|
638
687
|
const ctx2 = Object.create(ctx);
|
|
639
|
-
ctx2[key_name] = key;
|
|
688
|
+
ctx2[key_name] = variant("value", key);
|
|
640
689
|
try {
|
|
641
690
|
await compiled_body(ctx2);
|
|
642
691
|
}
|
|
@@ -666,7 +715,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
666
715
|
try {
|
|
667
716
|
for (const key of set) {
|
|
668
717
|
const ctx2 = Object.create(ctx);
|
|
669
|
-
ctx2[key_name] = key;
|
|
718
|
+
ctx2[key_name] = variant("value", key);
|
|
670
719
|
try {
|
|
671
720
|
compiled_body(ctx2);
|
|
672
721
|
}
|
|
@@ -693,13 +742,13 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
693
742
|
else if (ir.type === "ForDict") {
|
|
694
743
|
const key_type = expandTypeValue(ir.value.dict.value.type).value.key;
|
|
695
744
|
const value_type = expandTypeValue(ir.value.dict.value.type).value.value;
|
|
696
|
-
const compiled_dict = compile_internal(ir.value.dict, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
745
|
+
const compiled_dict = compile_internal(ir.value.dict, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
697
746
|
const ctx2 = Object.create(ctx);
|
|
698
747
|
const key_name = ir.value.key.value.name;
|
|
699
748
|
const value_name = ir.value.value.value.name;
|
|
700
749
|
ctx2[key_name] = key_type;
|
|
701
750
|
ctx2[value_name] = value_type;
|
|
702
|
-
const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, true, compilingNodes);
|
|
751
|
+
const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
|
|
703
752
|
const label = ir.value.label.name;
|
|
704
753
|
if (ir.value.isAsync) {
|
|
705
754
|
return async (ctx) => {
|
|
@@ -708,8 +757,8 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
708
757
|
try {
|
|
709
758
|
for (const [key, value] of dict) {
|
|
710
759
|
const ctx2 = Object.create(ctx);
|
|
711
|
-
ctx2[key_name] = key;
|
|
712
|
-
ctx2[value_name] = value;
|
|
760
|
+
ctx2[key_name] = variant("value", key);
|
|
761
|
+
ctx2[value_name] = variant("value", value);
|
|
713
762
|
try {
|
|
714
763
|
await compiled_body(ctx2);
|
|
715
764
|
}
|
|
@@ -739,8 +788,8 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
739
788
|
try {
|
|
740
789
|
for (const [key, value] of dict) {
|
|
741
790
|
const ctx2 = Object.create(ctx);
|
|
742
|
-
ctx2[key_name] = key;
|
|
743
|
-
ctx2[value_name] = value;
|
|
791
|
+
ctx2[key_name] = variant("value", key);
|
|
792
|
+
ctx2[value_name] = variant("value", value);
|
|
744
793
|
try {
|
|
745
794
|
compiled_body(ctx2);
|
|
746
795
|
}
|
|
@@ -770,7 +819,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
770
819
|
if (fresh_ctx) {
|
|
771
820
|
const compiled_statements = [];
|
|
772
821
|
for (const statement of ir.value.statements) {
|
|
773
|
-
const compiled_statement = compile_internal(statement, ctx, platform, asyncPlatformFns, true, compilingNodes);
|
|
822
|
+
const compiled_statement = compile_internal(statement, ctx, platform, asyncPlatformFns, platformDef, true, compilingNodes);
|
|
774
823
|
compiled_statements.push(compiled_statement);
|
|
775
824
|
}
|
|
776
825
|
if (ir.value.isAsync) {
|
|
@@ -796,7 +845,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
796
845
|
const ctx2 = Object.create(ctx);
|
|
797
846
|
const compiled_statements = [];
|
|
798
847
|
for (const statement of ir.value.statements) {
|
|
799
|
-
const compiled_statement = compile_internal(statement, ctx2, platform, asyncPlatformFns, true, compilingNodes);
|
|
848
|
+
const compiled_statement = compile_internal(statement, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
|
|
800
849
|
compiled_statements.push(compiled_statement);
|
|
801
850
|
}
|
|
802
851
|
if (ir.value.isAsync) {
|
|
@@ -822,7 +871,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
822
871
|
}
|
|
823
872
|
}
|
|
824
873
|
else if (ir.type === "GetField") {
|
|
825
|
-
const struct = compile_internal(ir.value.struct, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
874
|
+
const struct = compile_internal(ir.value.struct, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
826
875
|
const field = ir.value.field;
|
|
827
876
|
if (ir.value.isAsync) {
|
|
828
877
|
return async (ctx) => (await struct(ctx))[field];
|
|
@@ -833,7 +882,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
833
882
|
}
|
|
834
883
|
else if (ir.type === "Struct") {
|
|
835
884
|
const fields = ir.value.fields.map(f => {
|
|
836
|
-
return compile_internal(f.value, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
885
|
+
return compile_internal(f.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
837
886
|
});
|
|
838
887
|
const keys = ir.value.fields.map(f => f.name);
|
|
839
888
|
if (ir.value.isAsync) {
|
|
@@ -851,7 +900,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
851
900
|
}
|
|
852
901
|
else if (ir.type === "Variant") {
|
|
853
902
|
const k = ir.value.case;
|
|
854
|
-
const v = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
903
|
+
const v = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
855
904
|
if (ir.value.isAsync) {
|
|
856
905
|
return async (ctx) => variant(k, await v(ctx));
|
|
857
906
|
}
|
|
@@ -860,7 +909,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
860
909
|
}
|
|
861
910
|
}
|
|
862
911
|
else if (ir.type === "NewRef") {
|
|
863
|
-
const value = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
912
|
+
const value = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
864
913
|
if (ir.value.isAsync) {
|
|
865
914
|
return async (ctx) => ref(await value(ctx));
|
|
866
915
|
}
|
|
@@ -870,7 +919,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
870
919
|
}
|
|
871
920
|
else if (ir.type === "NewArray") {
|
|
872
921
|
const values = ir.value.values.map(a => {
|
|
873
|
-
return compile_internal(a, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
922
|
+
return compile_internal(a, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
874
923
|
});
|
|
875
924
|
if (ir.value.isAsync) {
|
|
876
925
|
return async (ctx) => {
|
|
@@ -887,7 +936,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
887
936
|
}
|
|
888
937
|
else if (ir.type === "NewSet") {
|
|
889
938
|
const values = ir.value.values.map(a => {
|
|
890
|
-
return compile_internal(a, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
939
|
+
return compile_internal(a, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
891
940
|
});
|
|
892
941
|
const keyComparer = compareFor(ir.value.type.value);
|
|
893
942
|
if (ir.value.isAsync) {
|
|
@@ -905,7 +954,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
905
954
|
}
|
|
906
955
|
else if (ir.type === "NewDict") {
|
|
907
956
|
const values = ir.value.values.map(({ key, value }) => {
|
|
908
|
-
return [compile_internal(key, ctx, platform, asyncPlatformFns, false, compilingNodes), compile_internal(value, ctx, platform, asyncPlatformFns, false, compilingNodes)];
|
|
957
|
+
return [compile_internal(key, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes), compile_internal(value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes)];
|
|
909
958
|
});
|
|
910
959
|
const keyComparer = compareFor(ir.value.type.value.key);
|
|
911
960
|
if (ir.value.isAsync) {
|
|
@@ -922,7 +971,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
922
971
|
}
|
|
923
972
|
}
|
|
924
973
|
else if (ir.type === "Return") {
|
|
925
|
-
const compiled_value = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
974
|
+
const compiled_value = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
926
975
|
if (ir.value.isAsync) {
|
|
927
976
|
return async (ctx) => {
|
|
928
977
|
throw new ReturnException(await compiled_value(ctx));
|
|
@@ -952,7 +1001,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
952
1001
|
if (a.value.isAsync) {
|
|
953
1002
|
argsAsync = true;
|
|
954
1003
|
}
|
|
955
|
-
return compile_internal(a, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
1004
|
+
return compile_internal(a, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
956
1005
|
});
|
|
957
1006
|
// Special optimization for regex builtins with literal pattern/flags
|
|
958
1007
|
if ((ir.value.builtin === "RegexContains" || ir.value.builtin === "RegexIndexOf" || ir.value.builtin === "RegexReplace") &&
|
|
@@ -1127,7 +1176,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
1127
1176
|
}
|
|
1128
1177
|
}
|
|
1129
1178
|
}
|
|
1130
|
-
const evaluator = builtin_evaluators[ir.value.builtin](ir.value.location, ...ir.value.type_parameters);
|
|
1179
|
+
const evaluator = builtin_evaluators[ir.value.builtin](ir.value.location, platformDef, ...ir.value.type_parameters);
|
|
1131
1180
|
if (argsAsync) {
|
|
1132
1181
|
return async (ctx) => {
|
|
1133
1182
|
const args_resolved = [];
|
|
@@ -1147,11 +1196,27 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
|
|
|
1147
1196
|
if (a.value.isAsync) {
|
|
1148
1197
|
argsAsync = true;
|
|
1149
1198
|
}
|
|
1150
|
-
return compile_internal(a, ctx, platform, asyncPlatformFns, false, compilingNodes);
|
|
1199
|
+
return compile_internal(a, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
|
|
1151
1200
|
});
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1201
|
+
// Look up platform function definition to check if generic
|
|
1202
|
+
const platformFn = platformDef.find(p => p.name === ir.value.name);
|
|
1203
|
+
const typeParams = ir.value.type_parameters ?? [];
|
|
1204
|
+
// Get evaluator - for generic functions, call factory with type params
|
|
1205
|
+
let evaluator;
|
|
1206
|
+
if (typeParams.length > 0 && platformFn?.type_parameters && platformFn.type_parameters.length > 0) {
|
|
1207
|
+
// Generic platform function - fn is a factory that takes type params
|
|
1208
|
+
if (!platformFn.fn) {
|
|
1209
|
+
throw new Error(`Generic platform function '${ir.value.name}' has no implementation at ${printLocationValue(ir.value.location)}`);
|
|
1210
|
+
}
|
|
1211
|
+
evaluator = platformFn.fn(...typeParams);
|
|
1212
|
+
}
|
|
1213
|
+
else {
|
|
1214
|
+
// Non-generic - use platform map for backwards compatibility
|
|
1215
|
+
const platformEvaluator = platform[ir.value.name];
|
|
1216
|
+
if (platformEvaluator === undefined) {
|
|
1217
|
+
throw new Error(`Evaluator for platform function ${JSON.stringify(ir.value.name)} not found at ${printLocationValue(ir.value.location)}`);
|
|
1218
|
+
}
|
|
1219
|
+
evaluator = platformEvaluator;
|
|
1155
1220
|
}
|
|
1156
1221
|
if (argsAsync) {
|
|
1157
1222
|
return async (ctx) => {
|
|
@@ -1180,7 +1245,7 @@ function call_function(location, compiled_f, ...args) {
|
|
|
1180
1245
|
return e.value;
|
|
1181
1246
|
}
|
|
1182
1247
|
else if (e instanceof EastError) {
|
|
1183
|
-
e.location.push(location); // The fact that we need to push the call location not the definition location means we need to handle this here
|
|
1248
|
+
e.location.push(...location); // The fact that we need to push the call location not the definition location means we need to handle this here
|
|
1184
1249
|
throw (e);
|
|
1185
1250
|
}
|
|
1186
1251
|
else if (e instanceof ContinueException) {
|
|
@@ -1196,13 +1261,43 @@ function call_function(location, compiled_f, ...args) {
|
|
|
1196
1261
|
}
|
|
1197
1262
|
/** @internal */
|
|
1198
1263
|
const builtin_evaluators = {
|
|
1199
|
-
Is: (_location, T) => isFor(T),
|
|
1200
|
-
Equal: (_location, T) => equalFor(T),
|
|
1201
|
-
NotEqual: (_location, T) => notEqualFor(T),
|
|
1202
|
-
Less: (_location, T) => lessFor(T),
|
|
1203
|
-
LessEqual: (_location, T) => lessEqualFor(T),
|
|
1204
|
-
Greater: (_location, T) => greaterFor(T),
|
|
1205
|
-
GreaterEqual: (_location, T) => greaterEqualFor(T),
|
|
1264
|
+
Is: (_location, _platformDef, T) => isFor(T),
|
|
1265
|
+
Equal: (_location, _platformDef, T) => equalFor(T),
|
|
1266
|
+
NotEqual: (_location, _platformDef, T) => notEqualFor(T),
|
|
1267
|
+
Less: (_location, _platformDef, T) => lessFor(T),
|
|
1268
|
+
LessEqual: (_location, _platformDef, T) => lessEqualFor(T),
|
|
1269
|
+
Greater: (_location, _platformDef, T) => greaterFor(T),
|
|
1270
|
+
GreaterEqual: (_location, _platformDef, T) => greaterEqualFor(T),
|
|
1271
|
+
Diff: (_location, _platformDef, T) => diffFor(T),
|
|
1272
|
+
ApplyPatch: (location, _platformDef, T) => {
|
|
1273
|
+
const apply = applyFor(T);
|
|
1274
|
+
return (base, patch) => {
|
|
1275
|
+
try {
|
|
1276
|
+
return apply(base, patch);
|
|
1277
|
+
}
|
|
1278
|
+
catch (e) {
|
|
1279
|
+
if (e instanceof ConflictError) {
|
|
1280
|
+
throw new EastError(e.message, { location });
|
|
1281
|
+
}
|
|
1282
|
+
throw e;
|
|
1283
|
+
}
|
|
1284
|
+
};
|
|
1285
|
+
},
|
|
1286
|
+
ComposePatch: (location, _platformDef, T) => {
|
|
1287
|
+
const compose = composeFor(T);
|
|
1288
|
+
return (first, second) => {
|
|
1289
|
+
try {
|
|
1290
|
+
return compose(first, second);
|
|
1291
|
+
}
|
|
1292
|
+
catch (e) {
|
|
1293
|
+
if (e instanceof ConflictError) {
|
|
1294
|
+
throw new EastError(e.message, { location });
|
|
1295
|
+
}
|
|
1296
|
+
throw e;
|
|
1297
|
+
}
|
|
1298
|
+
};
|
|
1299
|
+
},
|
|
1300
|
+
InvertPatch: (_location, _platformDef, T) => invertFor(T),
|
|
1206
1301
|
BooleanNot: (_location) => (x) => !x,
|
|
1207
1302
|
BooleanOr: (_location) => (x, y) => x || y,
|
|
1208
1303
|
BooleanAnd: (_location) => (x, y) => x && y,
|
|
@@ -1257,10 +1352,10 @@ const builtin_evaluators = {
|
|
|
1257
1352
|
FloatSin: (_location) => (value) => Math.sin(value),
|
|
1258
1353
|
FloatCos: (_location) => (value) => Math.cos(value),
|
|
1259
1354
|
FloatTan: (_location) => (value) => Math.tan(value),
|
|
1260
|
-
Print: (_location, T) => {
|
|
1355
|
+
Print: (_location, _platformDef, T) => {
|
|
1261
1356
|
return printFor(T);
|
|
1262
1357
|
},
|
|
1263
|
-
Parse: (location, T) => {
|
|
1358
|
+
Parse: (location, _platformDef, T) => {
|
|
1264
1359
|
const p = parseFor(T);
|
|
1265
1360
|
return (x) => {
|
|
1266
1361
|
const result = p(x);
|
|
@@ -1460,7 +1555,7 @@ const builtin_evaluators = {
|
|
|
1460
1555
|
return buffer.toUint8Array();
|
|
1461
1556
|
};
|
|
1462
1557
|
},
|
|
1463
|
-
StringParseJSON: (location, type) => {
|
|
1558
|
+
StringParseJSON: (location, _platformDef, type) => {
|
|
1464
1559
|
const fromJSON = fromJSONFor(type);
|
|
1465
1560
|
return (x) => {
|
|
1466
1561
|
let parsed;
|
|
@@ -1478,7 +1573,7 @@ const builtin_evaluators = {
|
|
|
1478
1573
|
}
|
|
1479
1574
|
};
|
|
1480
1575
|
},
|
|
1481
|
-
StringPrintJSON: (_location, type) => {
|
|
1576
|
+
StringPrintJSON: (_location, _platformDef, type) => {
|
|
1482
1577
|
const toJSON = toJSONFor(type);
|
|
1483
1578
|
return (x) => JSON.stringify(toJSON(x));
|
|
1484
1579
|
},
|
|
@@ -1555,13 +1650,13 @@ const builtin_evaluators = {
|
|
|
1555
1650
|
}
|
|
1556
1651
|
};
|
|
1557
1652
|
},
|
|
1558
|
-
BlobEncodeBeast: (_location, type) => {
|
|
1653
|
+
BlobEncodeBeast: (_location, _platformDef, type) => {
|
|
1559
1654
|
const encodeBeast = encodeBeastFor(type);
|
|
1560
1655
|
return (value) => {
|
|
1561
1656
|
return encodeBeast(value);
|
|
1562
1657
|
};
|
|
1563
1658
|
},
|
|
1564
|
-
BlobDecodeBeast: (location, type) => {
|
|
1659
|
+
BlobDecodeBeast: (location, _platformDef, type) => {
|
|
1565
1660
|
const decodeBeast = decodeBeastFor(type);
|
|
1566
1661
|
return (data) => {
|
|
1567
1662
|
try {
|
|
@@ -1572,14 +1667,14 @@ const builtin_evaluators = {
|
|
|
1572
1667
|
}
|
|
1573
1668
|
};
|
|
1574
1669
|
},
|
|
1575
|
-
BlobEncodeBeast2: (_location, type) => {
|
|
1670
|
+
BlobEncodeBeast2: (_location, _platformDef, type) => {
|
|
1576
1671
|
const encodeBeast2 = encodeBeast2For(type);
|
|
1577
1672
|
return (value) => {
|
|
1578
1673
|
return encodeBeast2(value);
|
|
1579
1674
|
};
|
|
1580
1675
|
},
|
|
1581
|
-
BlobDecodeBeast2: (location, type) => {
|
|
1582
|
-
const decodeBeast2 = decodeBeast2For(type);
|
|
1676
|
+
BlobDecodeBeast2: (location, platformDef, type) => {
|
|
1677
|
+
const decodeBeast2 = decodeBeast2For(type, { platform: platformDef });
|
|
1583
1678
|
return (data) => {
|
|
1584
1679
|
try {
|
|
1585
1680
|
return decodeBeast2(data);
|
|
@@ -1589,17 +1684,39 @@ const builtin_evaluators = {
|
|
|
1589
1684
|
}
|
|
1590
1685
|
};
|
|
1591
1686
|
},
|
|
1592
|
-
|
|
1687
|
+
BlobDecodeCsv: (location, _platformDef, structType, _configType) => {
|
|
1688
|
+
return (data, config) => {
|
|
1689
|
+
try {
|
|
1690
|
+
const decoder = decodeCsvFor(structType, config);
|
|
1691
|
+
return decoder(data);
|
|
1692
|
+
}
|
|
1693
|
+
catch (e) {
|
|
1694
|
+
throw new EastError(`Failed to decode CSV data: ${e.message}`, { location });
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
},
|
|
1698
|
+
ArrayEncodeCsv: (location, _platformDef, structType, _configType) => {
|
|
1699
|
+
return (data, config) => {
|
|
1700
|
+
try {
|
|
1701
|
+
const encoder = encodeCsvFor(structType, config);
|
|
1702
|
+
return encoder(data);
|
|
1703
|
+
}
|
|
1704
|
+
catch (e) {
|
|
1705
|
+
throw new EastError(`Failed to encode CSV data: ${e.message}`, { location });
|
|
1706
|
+
}
|
|
1707
|
+
};
|
|
1708
|
+
},
|
|
1709
|
+
RefGet: (_location, _platformDef, _T) => (ref) => {
|
|
1593
1710
|
return ref.value;
|
|
1594
1711
|
},
|
|
1595
|
-
RefUpdate: (location, _T) => (ref, value) => {
|
|
1712
|
+
RefUpdate: (location, _platformDef, _T) => (ref, value) => {
|
|
1596
1713
|
if (Object.isFrozen(ref)) {
|
|
1597
1714
|
throw new EastError("Cannot modify frozen Ref", { location });
|
|
1598
1715
|
}
|
|
1599
1716
|
ref.value = value;
|
|
1600
1717
|
return null;
|
|
1601
1718
|
},
|
|
1602
|
-
RefMerge: (location, _T) => (ref, value, merger) => {
|
|
1719
|
+
RefMerge: (location, _platformDef, _T) => (ref, value, merger) => {
|
|
1603
1720
|
if (Object.isFrozen(ref)) {
|
|
1604
1721
|
throw new EastError("Cannot modify frozen Ref", { location });
|
|
1605
1722
|
}
|
|
@@ -1607,7 +1724,7 @@ const builtin_evaluators = {
|
|
|
1607
1724
|
ref.value = new_value;
|
|
1608
1725
|
return null;
|
|
1609
1726
|
},
|
|
1610
|
-
ArrayGenerate: (location, _T) => (size, f) => {
|
|
1727
|
+
ArrayGenerate: (location, _platformDef, _T) => (size, f) => {
|
|
1611
1728
|
const result = [];
|
|
1612
1729
|
for (let i = 0n; i < size; i += 1n) {
|
|
1613
1730
|
const v = call_function(location, f, i);
|
|
@@ -1648,12 +1765,12 @@ const builtin_evaluators = {
|
|
|
1648
1765
|
}
|
|
1649
1766
|
return result;
|
|
1650
1767
|
},
|
|
1651
|
-
ArraySize: (_location, _T) => (array) => BigInt(array.length),
|
|
1652
|
-
ArrayHas: (_location, _T) => (array, key) => {
|
|
1768
|
+
ArraySize: (_location, _platformDef, _T) => (array) => BigInt(array.length),
|
|
1769
|
+
ArrayHas: (_location, _platformDef, _T) => (array, key) => {
|
|
1653
1770
|
const i = Number(key);
|
|
1654
1771
|
return i >= 0 && i < array.length;
|
|
1655
1772
|
},
|
|
1656
|
-
ArrayGet: (location, _T) => (array, key) => {
|
|
1773
|
+
ArrayGet: (location, _platformDef, _T) => (array, key) => {
|
|
1657
1774
|
const i = Number(key);
|
|
1658
1775
|
if (i < 0 || i >= array.length) {
|
|
1659
1776
|
throw new EastError(`Array index ${key} out of bounds`, { location });
|
|
@@ -1662,7 +1779,7 @@ const builtin_evaluators = {
|
|
|
1662
1779
|
return array[i];
|
|
1663
1780
|
}
|
|
1664
1781
|
},
|
|
1665
|
-
ArrayGetOrDefault: (location, _T) => (array, key, defaultFn) => {
|
|
1782
|
+
ArrayGetOrDefault: (location, _platformDef, _T) => (array, key, defaultFn) => {
|
|
1666
1783
|
const i = Number(key);
|
|
1667
1784
|
if (i < 0 || i >= array.length) {
|
|
1668
1785
|
return call_function(location, defaultFn, key);
|
|
@@ -1671,7 +1788,7 @@ const builtin_evaluators = {
|
|
|
1671
1788
|
return array[i];
|
|
1672
1789
|
}
|
|
1673
1790
|
},
|
|
1674
|
-
ArrayTryGet: (_location, _T) => (array, key) => {
|
|
1791
|
+
ArrayTryGet: (_location, _platformDef, _T) => (array, key) => {
|
|
1675
1792
|
const i = Number(key);
|
|
1676
1793
|
if (i < 0 || i >= array.length) {
|
|
1677
1794
|
return variant("none", null);
|
|
@@ -1680,7 +1797,7 @@ const builtin_evaluators = {
|
|
|
1680
1797
|
return variant("some", array[i]);
|
|
1681
1798
|
}
|
|
1682
1799
|
},
|
|
1683
|
-
ArrayUpdate: (location, _T) => (array, key, value) => {
|
|
1800
|
+
ArrayUpdate: (location, _platformDef, _T) => (array, key, value) => {
|
|
1684
1801
|
if (Object.isFrozen(array)) {
|
|
1685
1802
|
throw new EastError("Cannot modify frozen Array", { location });
|
|
1686
1803
|
}
|
|
@@ -1693,7 +1810,7 @@ const builtin_evaluators = {
|
|
|
1693
1810
|
return null;
|
|
1694
1811
|
}
|
|
1695
1812
|
},
|
|
1696
|
-
ArrayMerge: (location, _T) => (array, key, value, merger) => {
|
|
1813
|
+
ArrayMerge: (location, _platformDef, _T) => (array, key, value, merger) => {
|
|
1697
1814
|
if (Object.isFrozen(array)) {
|
|
1698
1815
|
throw new EastError("Cannot modify frozen Array", { location });
|
|
1699
1816
|
}
|
|
@@ -1707,7 +1824,7 @@ const builtin_evaluators = {
|
|
|
1707
1824
|
return null;
|
|
1708
1825
|
}
|
|
1709
1826
|
},
|
|
1710
|
-
ArrayPushLast: (location, _T) => (array, value) => {
|
|
1827
|
+
ArrayPushLast: (location, _platformDef, _T) => (array, value) => {
|
|
1711
1828
|
if (Object.isFrozen(array)) {
|
|
1712
1829
|
throw new EastError("Cannot modify frozen Array", { location });
|
|
1713
1830
|
}
|
|
@@ -1717,7 +1834,7 @@ const builtin_evaluators = {
|
|
|
1717
1834
|
array.push(value);
|
|
1718
1835
|
return null;
|
|
1719
1836
|
},
|
|
1720
|
-
ArrayPopLast: (location, _T) => (array) => {
|
|
1837
|
+
ArrayPopLast: (location, _platformDef, _T) => (array) => {
|
|
1721
1838
|
if (Object.isFrozen(array)) {
|
|
1722
1839
|
throw new EastError("Cannot modify frozen Array", { location });
|
|
1723
1840
|
}
|
|
@@ -1731,7 +1848,7 @@ const builtin_evaluators = {
|
|
|
1731
1848
|
return array.pop();
|
|
1732
1849
|
}
|
|
1733
1850
|
},
|
|
1734
|
-
ArrayPushFirst: (location, _T) => (array, value) => {
|
|
1851
|
+
ArrayPushFirst: (location, _platformDef, _T) => (array, value) => {
|
|
1735
1852
|
if (Object.isFrozen(array)) {
|
|
1736
1853
|
throw new EastError("Cannot modify frozen Array", { location });
|
|
1737
1854
|
}
|
|
@@ -1741,7 +1858,7 @@ const builtin_evaluators = {
|
|
|
1741
1858
|
array.unshift(value);
|
|
1742
1859
|
return null;
|
|
1743
1860
|
},
|
|
1744
|
-
ArrayPopFirst: (location, _T) => (array) => {
|
|
1861
|
+
ArrayPopFirst: (location, _platformDef, _T) => (array) => {
|
|
1745
1862
|
if (Object.isFrozen(array)) {
|
|
1746
1863
|
throw new EastError("Cannot modify frozen Array", { location });
|
|
1747
1864
|
}
|
|
@@ -1755,7 +1872,7 @@ const builtin_evaluators = {
|
|
|
1755
1872
|
return array.shift();
|
|
1756
1873
|
}
|
|
1757
1874
|
},
|
|
1758
|
-
ArrayAppend: (location, _T) => (array, other) => {
|
|
1875
|
+
ArrayAppend: (location, _platformDef, _T) => (array, other) => {
|
|
1759
1876
|
if (Object.isFrozen(array)) {
|
|
1760
1877
|
throw new EastError("Cannot modify frozen Array", { location });
|
|
1761
1878
|
}
|
|
@@ -1765,7 +1882,7 @@ const builtin_evaluators = {
|
|
|
1765
1882
|
array.push(...other);
|
|
1766
1883
|
return null;
|
|
1767
1884
|
},
|
|
1768
|
-
ArrayPrepend: (location, _T) => (array, other) => {
|
|
1885
|
+
ArrayPrepend: (location, _platformDef, _T) => (array, other) => {
|
|
1769
1886
|
if (Object.isFrozen(array)) {
|
|
1770
1887
|
throw new EastError("Cannot modify frozen Array", { location });
|
|
1771
1888
|
}
|
|
@@ -1775,7 +1892,7 @@ const builtin_evaluators = {
|
|
|
1775
1892
|
array.unshift(...other);
|
|
1776
1893
|
return null;
|
|
1777
1894
|
},
|
|
1778
|
-
ArrayMergeAll: (location, _T, _T2) => (array, other, merger) => {
|
|
1895
|
+
ArrayMergeAll: (location, _platformDef, _T, _T2) => (array, other, merger) => {
|
|
1779
1896
|
if (Object.isFrozen(array)) {
|
|
1780
1897
|
throw new EastError("Cannot modify frozen Array", { location });
|
|
1781
1898
|
}
|
|
@@ -1799,7 +1916,7 @@ const builtin_evaluators = {
|
|
|
1799
1916
|
}
|
|
1800
1917
|
return null;
|
|
1801
1918
|
},
|
|
1802
|
-
ArrayClear: (location, _T) => (array) => {
|
|
1919
|
+
ArrayClear: (location, _platformDef, _T) => (array) => {
|
|
1803
1920
|
if (Object.isFrozen(array)) {
|
|
1804
1921
|
throw new EastError("Cannot modify frozen Array", { location });
|
|
1805
1922
|
}
|
|
@@ -1809,7 +1926,7 @@ const builtin_evaluators = {
|
|
|
1809
1926
|
array.length = 0;
|
|
1810
1927
|
return null;
|
|
1811
1928
|
},
|
|
1812
|
-
ArraySortInPlace: (location, T, T2) => (array, by) => {
|
|
1929
|
+
ArraySortInPlace: (location, _platformDef, T, T2) => (array, by) => {
|
|
1813
1930
|
if (Object.isFrozen(array)) {
|
|
1814
1931
|
throw new EastError("Cannot modify frozen Array", { location });
|
|
1815
1932
|
}
|
|
@@ -1830,7 +1947,7 @@ const builtin_evaluators = {
|
|
|
1830
1947
|
}
|
|
1831
1948
|
return null;
|
|
1832
1949
|
},
|
|
1833
|
-
ArrayReverseInPlace: (location, _T) => (array) => {
|
|
1950
|
+
ArrayReverseInPlace: (location, _platformDef, _T) => (array) => {
|
|
1834
1951
|
if (Object.isFrozen(array)) {
|
|
1835
1952
|
throw new EastError("Cannot modify frozen Array", { location });
|
|
1836
1953
|
}
|
|
@@ -1840,7 +1957,7 @@ const builtin_evaluators = {
|
|
|
1840
1957
|
array.reverse();
|
|
1841
1958
|
return null;
|
|
1842
1959
|
},
|
|
1843
|
-
ArraySort: (location, T, T2) => (array, by) => {
|
|
1960
|
+
ArraySort: (location, _platformDef, T, T2) => (array, by) => {
|
|
1844
1961
|
const cmp = compareFor(T2);
|
|
1845
1962
|
const newArray = [...array];
|
|
1846
1963
|
newArray.sort((a, b) => {
|
|
@@ -1850,12 +1967,12 @@ const builtin_evaluators = {
|
|
|
1850
1967
|
});
|
|
1851
1968
|
return newArray;
|
|
1852
1969
|
},
|
|
1853
|
-
ArrayReverse: (_location, _T) => (array) => {
|
|
1970
|
+
ArrayReverse: (_location, _platformDef, _T) => (array) => {
|
|
1854
1971
|
const newArray = [...array];
|
|
1855
1972
|
newArray.reverse();
|
|
1856
1973
|
return newArray;
|
|
1857
1974
|
},
|
|
1858
|
-
ArrayIsSorted: (location, T, T2) => {
|
|
1975
|
+
ArrayIsSorted: (location, _platformDef, T, T2) => {
|
|
1859
1976
|
const cmp = compareFor(T2);
|
|
1860
1977
|
return (array, by) => {
|
|
1861
1978
|
if (array.length < 2)
|
|
@@ -1877,7 +1994,7 @@ const builtin_evaluators = {
|
|
|
1877
1994
|
return true;
|
|
1878
1995
|
};
|
|
1879
1996
|
},
|
|
1880
|
-
ArrayFindSortedFirst: (location, T, T2) => {
|
|
1997
|
+
ArrayFindSortedFirst: (location, _platformDef, T, T2) => {
|
|
1881
1998
|
const cmp = compareFor(T2);
|
|
1882
1999
|
return (array, key, by) => {
|
|
1883
2000
|
let low = 0;
|
|
@@ -1901,7 +2018,7 @@ const builtin_evaluators = {
|
|
|
1901
2018
|
return BigInt(low);
|
|
1902
2019
|
};
|
|
1903
2020
|
},
|
|
1904
|
-
ArrayFindSortedLast: (location, T, T2) => {
|
|
2021
|
+
ArrayFindSortedLast: (location, _platformDef, T, T2) => {
|
|
1905
2022
|
const cmp = compareFor(T2);
|
|
1906
2023
|
return (array, key, by) => {
|
|
1907
2024
|
let low = 0;
|
|
@@ -1925,7 +2042,7 @@ const builtin_evaluators = {
|
|
|
1925
2042
|
return BigInt(low);
|
|
1926
2043
|
};
|
|
1927
2044
|
},
|
|
1928
|
-
ArrayFindSortedRange: (location, T, T2) => {
|
|
2045
|
+
ArrayFindSortedRange: (location, _platformDef, T, T2) => {
|
|
1929
2046
|
const cmp = compareFor(T2);
|
|
1930
2047
|
return (array, key, by) => {
|
|
1931
2048
|
let lo = -1;
|
|
@@ -1983,7 +2100,7 @@ const builtin_evaluators = {
|
|
|
1983
2100
|
return { start: BigInt(lo + 1), end: BigInt(lo + 1) };
|
|
1984
2101
|
};
|
|
1985
2102
|
},
|
|
1986
|
-
ArrayFindFirst: (location, T, T2) => {
|
|
2103
|
+
ArrayFindFirst: (location, _platformDef, T, T2) => {
|
|
1987
2104
|
const cmp = compareFor(T2);
|
|
1988
2105
|
return (array, value, by) => {
|
|
1989
2106
|
lockForIteration(array);
|
|
@@ -2001,15 +2118,15 @@ const builtin_evaluators = {
|
|
|
2001
2118
|
}
|
|
2002
2119
|
};
|
|
2003
2120
|
},
|
|
2004
|
-
ArrayConcat: (_location, _T) => (a1, a2) => {
|
|
2121
|
+
ArrayConcat: (_location, _platformDef, _T) => (a1, a2) => {
|
|
2005
2122
|
return [...a1, ...a2];
|
|
2006
2123
|
},
|
|
2007
|
-
ArraySlice: (_location, _T) => (array, start, end) => {
|
|
2124
|
+
ArraySlice: (_location, _platformDef, _T) => (array, start, end) => {
|
|
2008
2125
|
const startNum = Number(start);
|
|
2009
2126
|
const endNum = Number(end);
|
|
2010
2127
|
return array.slice(startNum, endNum);
|
|
2011
2128
|
},
|
|
2012
|
-
ArrayGetKeys: (location, _T) => (array, keys, onMissing) => {
|
|
2129
|
+
ArrayGetKeys: (location, _platformDef, _T) => (array, keys, onMissing) => {
|
|
2013
2130
|
return keys.map(k => {
|
|
2014
2131
|
const i = Number(k);
|
|
2015
2132
|
if (i < 0 || i >= array.length) {
|
|
@@ -2020,7 +2137,7 @@ const builtin_evaluators = {
|
|
|
2020
2137
|
}
|
|
2021
2138
|
});
|
|
2022
2139
|
},
|
|
2023
|
-
ArrayForEach: (location, _T, _T2) => (array, f) => {
|
|
2140
|
+
ArrayForEach: (location, _platformDef, _T, _T2) => (array, f) => {
|
|
2024
2141
|
lockForIteration(array);
|
|
2025
2142
|
try {
|
|
2026
2143
|
array.forEach((x, i) => {
|
|
@@ -2032,10 +2149,10 @@ const builtin_evaluators = {
|
|
|
2032
2149
|
unlockForIteration(array);
|
|
2033
2150
|
}
|
|
2034
2151
|
},
|
|
2035
|
-
ArrayCopy: (_location, _T) => (array) => {
|
|
2152
|
+
ArrayCopy: (_location, _platformDef, _T) => (array) => {
|
|
2036
2153
|
return [...array];
|
|
2037
2154
|
},
|
|
2038
|
-
ArrayMap: (location, _T, _T2) => (array, f) => {
|
|
2155
|
+
ArrayMap: (location, _platformDef, _T, _T2) => (array, f) => {
|
|
2039
2156
|
lockForIteration(array);
|
|
2040
2157
|
try {
|
|
2041
2158
|
return array.map((x, i) => {
|
|
@@ -2046,7 +2163,7 @@ const builtin_evaluators = {
|
|
|
2046
2163
|
unlockForIteration(array);
|
|
2047
2164
|
}
|
|
2048
2165
|
},
|
|
2049
|
-
ArrayFilter: (location, _T, _T2) => (array, f) => {
|
|
2166
|
+
ArrayFilter: (location, _platformDef, _T, _T2) => (array, f) => {
|
|
2050
2167
|
lockForIteration(array);
|
|
2051
2168
|
try {
|
|
2052
2169
|
return array.filter((x, i) => {
|
|
@@ -2057,7 +2174,7 @@ const builtin_evaluators = {
|
|
|
2057
2174
|
unlockForIteration(array);
|
|
2058
2175
|
}
|
|
2059
2176
|
},
|
|
2060
|
-
ArrayFilterMap: (location, _T, _T2) => (array, f) => {
|
|
2177
|
+
ArrayFilterMap: (location, _platformDef, _T, _T2) => (array, f) => {
|
|
2061
2178
|
lockForIteration(array);
|
|
2062
2179
|
try {
|
|
2063
2180
|
const result = [];
|
|
@@ -2073,7 +2190,7 @@ const builtin_evaluators = {
|
|
|
2073
2190
|
unlockForIteration(array);
|
|
2074
2191
|
}
|
|
2075
2192
|
},
|
|
2076
|
-
ArrayFirstMap: (location, _T, _T2) => (array, f) => {
|
|
2193
|
+
ArrayFirstMap: (location, _platformDef, _T, _T2) => (array, f) => {
|
|
2077
2194
|
lockForIteration(array);
|
|
2078
2195
|
try {
|
|
2079
2196
|
for (let i = 0; i < array.length; i++) {
|
|
@@ -2088,7 +2205,7 @@ const builtin_evaluators = {
|
|
|
2088
2205
|
unlockForIteration(array);
|
|
2089
2206
|
}
|
|
2090
2207
|
},
|
|
2091
|
-
ArrayFold: (location, _T, _T2) => (array, init, f) => {
|
|
2208
|
+
ArrayFold: (location, _platformDef, _T, _T2) => (array, init, f) => {
|
|
2092
2209
|
lockForIteration(array);
|
|
2093
2210
|
try {
|
|
2094
2211
|
return array.reduce((acc, x, i) => {
|
|
@@ -2099,7 +2216,7 @@ const builtin_evaluators = {
|
|
|
2099
2216
|
unlockForIteration(array);
|
|
2100
2217
|
}
|
|
2101
2218
|
},
|
|
2102
|
-
ArrayMapReduce: (location, _T, _T2) => (array, mapFn, reduceFn) => {
|
|
2219
|
+
ArrayMapReduce: (location, _platformDef, _T, _T2) => (array, mapFn, reduceFn) => {
|
|
2103
2220
|
if (array.length === 0) {
|
|
2104
2221
|
throw new EastError("Cannot reduce empty array with no initial value", { location });
|
|
2105
2222
|
}
|
|
@@ -2116,8 +2233,8 @@ const builtin_evaluators = {
|
|
|
2116
2233
|
unlockForIteration(array);
|
|
2117
2234
|
}
|
|
2118
2235
|
},
|
|
2119
|
-
ArrayStringJoin: (_location) => (x, y) => x.join(y),
|
|
2120
|
-
ArrayToSet: (location, _T, T2) => {
|
|
2236
|
+
ArrayStringJoin: (_location, _platformDef) => (x, y) => x.join(y),
|
|
2237
|
+
ArrayToSet: (location, _platformDef, _T, T2) => {
|
|
2121
2238
|
const compare = compareFor(T2);
|
|
2122
2239
|
return (array, f) => {
|
|
2123
2240
|
lockForIteration(array);
|
|
@@ -2134,7 +2251,7 @@ const builtin_evaluators = {
|
|
|
2134
2251
|
}
|
|
2135
2252
|
};
|
|
2136
2253
|
},
|
|
2137
|
-
ArrayToDict: (location, _T, K2, _T2) => {
|
|
2254
|
+
ArrayToDict: (location, _platformDef, _T, K2, _T2) => {
|
|
2138
2255
|
const compare = compareFor(K2);
|
|
2139
2256
|
return (array, keyFn, valueFn, onConflict) => {
|
|
2140
2257
|
const result = new SortedMap([], compare);
|
|
@@ -2160,12 +2277,12 @@ const builtin_evaluators = {
|
|
|
2160
2277
|
}
|
|
2161
2278
|
};
|
|
2162
2279
|
},
|
|
2163
|
-
ArrayFlattenToArray: (location, _T) => (array, fn) => {
|
|
2280
|
+
ArrayFlattenToArray: (location, _platformDef, _T) => (array, fn) => {
|
|
2164
2281
|
return array.flatMap(v => {
|
|
2165
2282
|
return call_function(location, fn, v);
|
|
2166
2283
|
});
|
|
2167
2284
|
},
|
|
2168
|
-
ArrayFlattenToSet: (location, _T, K2) => {
|
|
2285
|
+
ArrayFlattenToSet: (location, _platformDef, _T, K2) => {
|
|
2169
2286
|
const compare = compareFor(K2);
|
|
2170
2287
|
return (array, fn) => {
|
|
2171
2288
|
const result = new SortedSet([], compare);
|
|
@@ -2184,7 +2301,7 @@ const builtin_evaluators = {
|
|
|
2184
2301
|
}
|
|
2185
2302
|
};
|
|
2186
2303
|
},
|
|
2187
|
-
ArrayFlattenToDict: (location, _T, K2, _T2) => {
|
|
2304
|
+
ArrayFlattenToDict: (location, _platformDef, _T, K2, _T2) => {
|
|
2188
2305
|
const compare = compareFor(K2);
|
|
2189
2306
|
return (array, fn, onConflict) => {
|
|
2190
2307
|
const result = new SortedMap([], compare);
|
|
@@ -2210,7 +2327,7 @@ const builtin_evaluators = {
|
|
|
2210
2327
|
}
|
|
2211
2328
|
};
|
|
2212
2329
|
},
|
|
2213
|
-
ArrayGroupFold: (location, _T, K2, _V2) => {
|
|
2330
|
+
ArrayGroupFold: (location, _platformDef, _T, K2, _V2) => {
|
|
2214
2331
|
const compare = compareFor(K2);
|
|
2215
2332
|
return (array, keyFn, init, folder) => {
|
|
2216
2333
|
const result = new SortedMap([], compare);
|
|
@@ -2233,7 +2350,7 @@ const builtin_evaluators = {
|
|
|
2233
2350
|
}
|
|
2234
2351
|
};
|
|
2235
2352
|
},
|
|
2236
|
-
SetGenerate: (location, K) => {
|
|
2353
|
+
SetGenerate: (location, _platformDef, K) => {
|
|
2237
2354
|
const keyComparer = compareFor(K);
|
|
2238
2355
|
return (size, keyFn, onConflict) => {
|
|
2239
2356
|
const result = new SortedSet([], keyComparer);
|
|
@@ -2249,9 +2366,9 @@ const builtin_evaluators = {
|
|
|
2249
2366
|
return result;
|
|
2250
2367
|
};
|
|
2251
2368
|
},
|
|
2252
|
-
SetSize: (_location, _K) => (s) => BigInt(s.size),
|
|
2253
|
-
SetHas: (_location, _K) => (s, key) => s.has(key),
|
|
2254
|
-
SetInsert: (location, K) => {
|
|
2369
|
+
SetSize: (_location, _platformDef, _K) => (s) => BigInt(s.size),
|
|
2370
|
+
SetHas: (_location, _platformDef, _K) => (s, key) => s.has(key),
|
|
2371
|
+
SetInsert: (location, _platformDef, K) => {
|
|
2255
2372
|
const print = printFor(K);
|
|
2256
2373
|
return (s, key) => {
|
|
2257
2374
|
if (Object.isFrozen(s)) {
|
|
@@ -2268,7 +2385,7 @@ const builtin_evaluators = {
|
|
|
2268
2385
|
return null;
|
|
2269
2386
|
};
|
|
2270
2387
|
},
|
|
2271
|
-
SetTryInsert: (location, _K) => (s, key) => {
|
|
2388
|
+
SetTryInsert: (location, _platformDef, _K) => (s, key) => {
|
|
2272
2389
|
if (Object.isFrozen(s)) {
|
|
2273
2390
|
throw new EastError("Cannot modify frozen Set", { location });
|
|
2274
2391
|
}
|
|
@@ -2279,7 +2396,7 @@ const builtin_evaluators = {
|
|
|
2279
2396
|
s.add(key);
|
|
2280
2397
|
return s.size > size_before;
|
|
2281
2398
|
},
|
|
2282
|
-
SetDelete: (location, K) => {
|
|
2399
|
+
SetDelete: (location, _platformDef, K) => {
|
|
2283
2400
|
const print = printFor(K);
|
|
2284
2401
|
return (s, key) => {
|
|
2285
2402
|
if (Object.isFrozen(s)) {
|
|
@@ -2294,7 +2411,7 @@ const builtin_evaluators = {
|
|
|
2294
2411
|
return null;
|
|
2295
2412
|
};
|
|
2296
2413
|
},
|
|
2297
|
-
SetTryDelete: (location, _K) => (s, key) => {
|
|
2414
|
+
SetTryDelete: (location, _platformDef, _K) => (s, key) => {
|
|
2298
2415
|
if (Object.isFrozen(s)) {
|
|
2299
2416
|
throw new EastError("Cannot modify frozen Set", { location });
|
|
2300
2417
|
}
|
|
@@ -2303,7 +2420,7 @@ const builtin_evaluators = {
|
|
|
2303
2420
|
}
|
|
2304
2421
|
return s.delete(key);
|
|
2305
2422
|
},
|
|
2306
|
-
SetClear: (location, _K) => (s) => {
|
|
2423
|
+
SetClear: (location, _platformDef, _K) => (s) => {
|
|
2307
2424
|
if (Object.isFrozen(s)) {
|
|
2308
2425
|
throw new EastError("Cannot modify frozen Set", { location });
|
|
2309
2426
|
}
|
|
@@ -2313,7 +2430,7 @@ const builtin_evaluators = {
|
|
|
2313
2430
|
s.clear();
|
|
2314
2431
|
return null;
|
|
2315
2432
|
},
|
|
2316
|
-
SetUnionInPlace: (location, _K) => (s1, s2) => {
|
|
2433
|
+
SetUnionInPlace: (location, _platformDef, _K) => (s1, s2) => {
|
|
2317
2434
|
if (Object.isFrozen(s1)) {
|
|
2318
2435
|
throw new EastError("Cannot modify frozen Set", { location });
|
|
2319
2436
|
}
|
|
@@ -2323,19 +2440,19 @@ const builtin_evaluators = {
|
|
|
2323
2440
|
s2.forEach(v => s1.add(v));
|
|
2324
2441
|
return null;
|
|
2325
2442
|
},
|
|
2326
|
-
SetUnion: (_location, _K) => (s1, s2) => s1.union(s2),
|
|
2327
|
-
SetIntersect: (_location, _K) => (s1, s2) => s1.intersection(s2),
|
|
2328
|
-
SetDiff: (_location, _K) => (s1, s2) => s1.difference(s2),
|
|
2329
|
-
SetSymDiff: (_location, _K) => (s1, s2) => s1.symmetricDifference(s2),
|
|
2330
|
-
SetIsSubset: (_location, _K) => (s1, s2) => s1.isSubsetOf(s2),
|
|
2331
|
-
SetIsDisjoint: (_location, _K) => (s1, s2) => s1.isDisjointFrom(s2),
|
|
2332
|
-
SetCopy: (_location, K) => {
|
|
2443
|
+
SetUnion: (_location, _platformDef, _K) => (s1, s2) => s1.union(s2),
|
|
2444
|
+
SetIntersect: (_location, _platformDef, _K) => (s1, s2) => s1.intersection(s2),
|
|
2445
|
+
SetDiff: (_location, _platformDef, _K) => (s1, s2) => s1.difference(s2),
|
|
2446
|
+
SetSymDiff: (_location, _platformDef, _K) => (s1, s2) => s1.symmetricDifference(s2),
|
|
2447
|
+
SetIsSubset: (_location, _platformDef, _K) => (s1, s2) => s1.isSubsetOf(s2),
|
|
2448
|
+
SetIsDisjoint: (_location, _platformDef, _K) => (s1, s2) => s1.isDisjointFrom(s2),
|
|
2449
|
+
SetCopy: (_location, _platformDef, K) => {
|
|
2333
2450
|
const compare = compareFor(K);
|
|
2334
2451
|
return (s) => {
|
|
2335
2452
|
return new SortedSet([...s], compare);
|
|
2336
2453
|
};
|
|
2337
2454
|
},
|
|
2338
|
-
SetForEach: (location, _K, _T2) => (s, f) => {
|
|
2455
|
+
SetForEach: (location, _platformDef, _K, _T2) => (s, f) => {
|
|
2339
2456
|
lockForIteration(s);
|
|
2340
2457
|
try {
|
|
2341
2458
|
s.forEach(x => {
|
|
@@ -2347,7 +2464,7 @@ const builtin_evaluators = {
|
|
|
2347
2464
|
unlockForIteration(s);
|
|
2348
2465
|
}
|
|
2349
2466
|
},
|
|
2350
|
-
SetFilter: (location, K) => {
|
|
2467
|
+
SetFilter: (location, _platformDef, K) => {
|
|
2351
2468
|
const compare = compareFor(K);
|
|
2352
2469
|
return (s, f) => {
|
|
2353
2470
|
const result = new SortedSet([], compare);
|
|
@@ -2366,7 +2483,7 @@ const builtin_evaluators = {
|
|
|
2366
2483
|
}
|
|
2367
2484
|
};
|
|
2368
2485
|
},
|
|
2369
|
-
SetFilterMap: (location, K, _V2) => {
|
|
2486
|
+
SetFilterMap: (location, _platformDef, K, _V2) => {
|
|
2370
2487
|
const compare = compareFor(K);
|
|
2371
2488
|
return (s, f) => {
|
|
2372
2489
|
const result = new SortedMap([], compare);
|
|
@@ -2385,7 +2502,7 @@ const builtin_evaluators = {
|
|
|
2385
2502
|
}
|
|
2386
2503
|
};
|
|
2387
2504
|
},
|
|
2388
|
-
SetFirstMap: (location, _K, _T2) => (s, f) => {
|
|
2505
|
+
SetFirstMap: (location, _platformDef, _K, _T2) => (s, f) => {
|
|
2389
2506
|
lockForIteration(s);
|
|
2390
2507
|
try {
|
|
2391
2508
|
for (const k of s) {
|
|
@@ -2400,7 +2517,7 @@ const builtin_evaluators = {
|
|
|
2400
2517
|
unlockForIteration(s);
|
|
2401
2518
|
}
|
|
2402
2519
|
},
|
|
2403
|
-
SetMapReduce: (location, _K, _T2) => (s, mapFn, reduceFn) => {
|
|
2520
|
+
SetMapReduce: (location, _platformDef, _K, _T2) => (s, mapFn, reduceFn) => {
|
|
2404
2521
|
if (s.size === 0) {
|
|
2405
2522
|
throw new EastError("Cannot reduce empty set with no initial value", { location });
|
|
2406
2523
|
}
|
|
@@ -2419,7 +2536,7 @@ const builtin_evaluators = {
|
|
|
2419
2536
|
unlockForIteration(s);
|
|
2420
2537
|
}
|
|
2421
2538
|
},
|
|
2422
|
-
SetMap: (location, K, _T2) => {
|
|
2539
|
+
SetMap: (location, _platformDef, K, _T2) => {
|
|
2423
2540
|
const compare = compareFor(K);
|
|
2424
2541
|
return (s, f) => {
|
|
2425
2542
|
const result = new SortedMap([], compare);
|
|
@@ -2436,7 +2553,7 @@ const builtin_evaluators = {
|
|
|
2436
2553
|
}
|
|
2437
2554
|
};
|
|
2438
2555
|
},
|
|
2439
|
-
SetReduce: (location, _K, _T2) => (s, f, init) => {
|
|
2556
|
+
SetReduce: (location, _platformDef, _K, _T2) => (s, f, init) => {
|
|
2440
2557
|
let acc = init;
|
|
2441
2558
|
lockForIteration(s);
|
|
2442
2559
|
try {
|
|
@@ -2449,7 +2566,7 @@ const builtin_evaluators = {
|
|
|
2449
2566
|
unlockForIteration(s);
|
|
2450
2567
|
}
|
|
2451
2568
|
},
|
|
2452
|
-
SetToArray: (location, _K, _T2) => (s, valueFn) => {
|
|
2569
|
+
SetToArray: (location, _platformDef, _K, _T2) => (s, valueFn) => {
|
|
2453
2570
|
const ret = [];
|
|
2454
2571
|
lockForIteration(s);
|
|
2455
2572
|
try {
|
|
@@ -2463,7 +2580,7 @@ const builtin_evaluators = {
|
|
|
2463
2580
|
unlockForIteration(s);
|
|
2464
2581
|
}
|
|
2465
2582
|
},
|
|
2466
|
-
SetToSet: (location, K, K2) => {
|
|
2583
|
+
SetToSet: (location, _platformDef, K, K2) => {
|
|
2467
2584
|
const compare = compareFor(K2);
|
|
2468
2585
|
return (s, f) => {
|
|
2469
2586
|
const result = new SortedSet([], compare);
|
|
@@ -2481,7 +2598,7 @@ const builtin_evaluators = {
|
|
|
2481
2598
|
}
|
|
2482
2599
|
};
|
|
2483
2600
|
},
|
|
2484
|
-
SetToDict: (location, K, K2, _V2) => {
|
|
2601
|
+
SetToDict: (location, _platformDef, K, K2, _V2) => {
|
|
2485
2602
|
const compare = compareFor(K2);
|
|
2486
2603
|
return (s, keyFn, valueFn, onConflict) => {
|
|
2487
2604
|
const result = new SortedMap([], compare);
|
|
@@ -2506,7 +2623,7 @@ const builtin_evaluators = {
|
|
|
2506
2623
|
}
|
|
2507
2624
|
};
|
|
2508
2625
|
},
|
|
2509
|
-
SetFlattenToArray: (location, _K, _T2) => (s, fn) => {
|
|
2626
|
+
SetFlattenToArray: (location, _platformDef, _K, _T2) => (s, fn) => {
|
|
2510
2627
|
const ret = [];
|
|
2511
2628
|
lockForIteration(s);
|
|
2512
2629
|
try {
|
|
@@ -2520,7 +2637,7 @@ const builtin_evaluators = {
|
|
|
2520
2637
|
unlockForIteration(s);
|
|
2521
2638
|
}
|
|
2522
2639
|
},
|
|
2523
|
-
SetFlattenToSet: (location, _K, K2) => {
|
|
2640
|
+
SetFlattenToSet: (location, _platformDef, _K, K2) => {
|
|
2524
2641
|
const compare = compareFor(K2);
|
|
2525
2642
|
return (s, fn) => {
|
|
2526
2643
|
const result = new SortedSet([], compare);
|
|
@@ -2539,7 +2656,7 @@ const builtin_evaluators = {
|
|
|
2539
2656
|
}
|
|
2540
2657
|
};
|
|
2541
2658
|
},
|
|
2542
|
-
SetFlattenToDict: (location, _K, K2, _V2) => {
|
|
2659
|
+
SetFlattenToDict: (location, _platformDef, _K, K2, _V2) => {
|
|
2543
2660
|
const compare = compareFor(K2);
|
|
2544
2661
|
return (s, fn, onConflict) => {
|
|
2545
2662
|
const result = new SortedMap([], compare);
|
|
@@ -2565,7 +2682,7 @@ const builtin_evaluators = {
|
|
|
2565
2682
|
}
|
|
2566
2683
|
};
|
|
2567
2684
|
},
|
|
2568
|
-
SetGroupFold: (location, _K, K2, _T2) => {
|
|
2685
|
+
SetGroupFold: (location, _platformDef, _K, K2, _T2) => {
|
|
2569
2686
|
const compare = compareFor(K2);
|
|
2570
2687
|
return (s, keyFn, init, folder) => {
|
|
2571
2688
|
const result = new SortedMap([], compare);
|
|
@@ -2587,7 +2704,7 @@ const builtin_evaluators = {
|
|
|
2587
2704
|
}
|
|
2588
2705
|
};
|
|
2589
2706
|
},
|
|
2590
|
-
DictGenerate: (location, K, _V) => {
|
|
2707
|
+
DictGenerate: (location, _platformDef, K, _V) => {
|
|
2591
2708
|
const keyComparer = compareFor(K);
|
|
2592
2709
|
return (size, keyFn, valueFn, onConflict) => {
|
|
2593
2710
|
const result = new SortedMap([], keyComparer);
|
|
@@ -2606,9 +2723,9 @@ const builtin_evaluators = {
|
|
|
2606
2723
|
return result;
|
|
2607
2724
|
};
|
|
2608
2725
|
},
|
|
2609
|
-
DictSize: (_location, _K, _V) => (d) => BigInt(d.size),
|
|
2610
|
-
DictHas: (_location, _K, _V) => (d, key) => d.has(key),
|
|
2611
|
-
DictGet: (location, K, _V) => {
|
|
2726
|
+
DictSize: (_location, _platformDef, _K, _V) => (d) => BigInt(d.size),
|
|
2727
|
+
DictHas: (_location, _platformDef, _K, _V) => (d, key) => d.has(key),
|
|
2728
|
+
DictGet: (location, _platformDef, K, _V) => {
|
|
2612
2729
|
const print = printFor(K);
|
|
2613
2730
|
return (d, key) => {
|
|
2614
2731
|
const result = d.get(key);
|
|
@@ -2620,7 +2737,7 @@ const builtin_evaluators = {
|
|
|
2620
2737
|
}
|
|
2621
2738
|
};
|
|
2622
2739
|
},
|
|
2623
|
-
DictGetOrDefault: (location, _K, _V) => (d, key, onMissingFn) => {
|
|
2740
|
+
DictGetOrDefault: (location, _platformDef, _K, _V) => (d, key, onMissingFn) => {
|
|
2624
2741
|
const result = d.get(key);
|
|
2625
2742
|
if (result === undefined) {
|
|
2626
2743
|
return call_function(location, onMissingFn, key);
|
|
@@ -2629,7 +2746,7 @@ const builtin_evaluators = {
|
|
|
2629
2746
|
return result;
|
|
2630
2747
|
}
|
|
2631
2748
|
},
|
|
2632
|
-
DictTryGet: (_location, _K, _V) => (d, key) => {
|
|
2749
|
+
DictTryGet: (_location, _platformDef, _K, _V) => (d, key) => {
|
|
2633
2750
|
const result = d.get(key);
|
|
2634
2751
|
if (result === undefined) {
|
|
2635
2752
|
return variant("none", null);
|
|
@@ -2638,7 +2755,7 @@ const builtin_evaluators = {
|
|
|
2638
2755
|
return variant("some", result);
|
|
2639
2756
|
}
|
|
2640
2757
|
},
|
|
2641
|
-
DictInsert: (location, K, _V) => {
|
|
2758
|
+
DictInsert: (location, _platformDef, K, _V) => {
|
|
2642
2759
|
const print = printFor(K);
|
|
2643
2760
|
return (d, key, value) => {
|
|
2644
2761
|
if (Object.isFrozen(d)) {
|
|
@@ -2657,7 +2774,7 @@ const builtin_evaluators = {
|
|
|
2657
2774
|
return null;
|
|
2658
2775
|
};
|
|
2659
2776
|
},
|
|
2660
|
-
DictGetOrInsert: (location, _K, _V) => (d, key, onMissing) => {
|
|
2777
|
+
DictGetOrInsert: (location, _platformDef, _K, _V) => (d, key, onMissing) => {
|
|
2661
2778
|
if (Object.isFrozen(d)) {
|
|
2662
2779
|
throw new EastError("Cannot modify frozen Dict", { location });
|
|
2663
2780
|
}
|
|
@@ -2674,7 +2791,7 @@ const builtin_evaluators = {
|
|
|
2674
2791
|
return existing;
|
|
2675
2792
|
}
|
|
2676
2793
|
},
|
|
2677
|
-
DictInsertOrUpdate: (location, _K, _V) => (d, key, value, onConflictFn) => {
|
|
2794
|
+
DictInsertOrUpdate: (location, _platformDef, _K, _V) => (d, key, value, onConflictFn) => {
|
|
2678
2795
|
if (Object.isFrozen(d)) {
|
|
2679
2796
|
throw new EastError("Cannot modify frozen Dict", { location });
|
|
2680
2797
|
}
|
|
@@ -2691,7 +2808,7 @@ const builtin_evaluators = {
|
|
|
2691
2808
|
}
|
|
2692
2809
|
return null;
|
|
2693
2810
|
},
|
|
2694
|
-
DictUpdate: (location, K, _V) => {
|
|
2811
|
+
DictUpdate: (location, _platformDef, K, _V) => {
|
|
2695
2812
|
const print = printFor(K);
|
|
2696
2813
|
return (d, key, value) => {
|
|
2697
2814
|
if (Object.isFrozen(d)) {
|
|
@@ -2706,7 +2823,7 @@ const builtin_evaluators = {
|
|
|
2706
2823
|
}
|
|
2707
2824
|
};
|
|
2708
2825
|
},
|
|
2709
|
-
DictSwap: (location, K, _V) => {
|
|
2826
|
+
DictSwap: (location, _platformDef, K, _V) => {
|
|
2710
2827
|
const print = printFor(K);
|
|
2711
2828
|
return (d, key, value) => {
|
|
2712
2829
|
if (Object.isFrozen(d)) {
|
|
@@ -2720,7 +2837,7 @@ const builtin_evaluators = {
|
|
|
2720
2837
|
return existing;
|
|
2721
2838
|
};
|
|
2722
2839
|
},
|
|
2723
|
-
DictMerge: (location, _K, _V) => (d, key, value, mergeFn, initialFn) => {
|
|
2840
|
+
DictMerge: (location, _platformDef, _K, _V) => (d, key, value, mergeFn, initialFn) => {
|
|
2724
2841
|
if (Object.isFrozen(d)) {
|
|
2725
2842
|
throw new EastError("Cannot modify frozen Dict", { location });
|
|
2726
2843
|
}
|
|
@@ -2735,7 +2852,7 @@ const builtin_evaluators = {
|
|
|
2735
2852
|
d.set(key, new_value);
|
|
2736
2853
|
return null;
|
|
2737
2854
|
},
|
|
2738
|
-
DictDelete: (location, K, _V) => {
|
|
2855
|
+
DictDelete: (location, _platformDef, K, _V) => {
|
|
2739
2856
|
const print = printFor(K);
|
|
2740
2857
|
return (d, key) => {
|
|
2741
2858
|
if (Object.isFrozen(d)) {
|
|
@@ -2751,7 +2868,7 @@ const builtin_evaluators = {
|
|
|
2751
2868
|
return null;
|
|
2752
2869
|
};
|
|
2753
2870
|
},
|
|
2754
|
-
DictTryDelete: (location, _K, _V) => (d, key) => {
|
|
2871
|
+
DictTryDelete: (location, _platformDef, _K, _V) => (d, key) => {
|
|
2755
2872
|
if (Object.isFrozen(d)) {
|
|
2756
2873
|
throw new EastError("Cannot modify frozen Dict", { location });
|
|
2757
2874
|
}
|
|
@@ -2760,7 +2877,7 @@ const builtin_evaluators = {
|
|
|
2760
2877
|
}
|
|
2761
2878
|
return d.delete(key);
|
|
2762
2879
|
},
|
|
2763
|
-
DictPop: (location, K, _V) => {
|
|
2880
|
+
DictPop: (location, _platformDef, K, _V) => {
|
|
2764
2881
|
const print = printFor(K);
|
|
2765
2882
|
return (d, key) => {
|
|
2766
2883
|
if (Object.isFrozen(d)) {
|
|
@@ -2779,7 +2896,7 @@ const builtin_evaluators = {
|
|
|
2779
2896
|
}
|
|
2780
2897
|
};
|
|
2781
2898
|
},
|
|
2782
|
-
DictClear: (location, _K, _V) => (d) => {
|
|
2899
|
+
DictClear: (location, _platformDef, _K, _V) => (d) => {
|
|
2783
2900
|
if (Object.isFrozen(d)) {
|
|
2784
2901
|
throw new EastError("Cannot modify frozen Dict", { location });
|
|
2785
2902
|
}
|
|
@@ -2789,7 +2906,7 @@ const builtin_evaluators = {
|
|
|
2789
2906
|
d.clear();
|
|
2790
2907
|
return null;
|
|
2791
2908
|
},
|
|
2792
|
-
DictUnionInPlace: (location, _K, _V) => (d1, d2, onConflict) => {
|
|
2909
|
+
DictUnionInPlace: (location, _platformDef, _K, _V) => (d1, d2, onConflict) => {
|
|
2793
2910
|
if (Object.isFrozen(d1)) {
|
|
2794
2911
|
throw new EastError("Cannot modify frozen Dict", { location });
|
|
2795
2912
|
}
|
|
@@ -2808,7 +2925,7 @@ const builtin_evaluators = {
|
|
|
2808
2925
|
});
|
|
2809
2926
|
return null;
|
|
2810
2927
|
},
|
|
2811
|
-
DictMergeAll: (location, _K, _V) => (d1, d2, mergeFn, initialFn) => {
|
|
2928
|
+
DictMergeAll: (location, _platformDef, _K, _V) => (d1, d2, mergeFn, initialFn) => {
|
|
2812
2929
|
if (Object.isFrozen(d1)) {
|
|
2813
2930
|
throw new EastError("Cannot modify frozen Dict", { location });
|
|
2814
2931
|
}
|
|
@@ -2825,13 +2942,13 @@ const builtin_evaluators = {
|
|
|
2825
2942
|
});
|
|
2826
2943
|
return null;
|
|
2827
2944
|
},
|
|
2828
|
-
DictKeys: (_location, K, _V) => {
|
|
2945
|
+
DictKeys: (_location, _platformDef, K, _V) => {
|
|
2829
2946
|
const compare = compareFor(K);
|
|
2830
2947
|
return (d) => {
|
|
2831
2948
|
return new SortedSet([...d.keys()], compare);
|
|
2832
2949
|
};
|
|
2833
2950
|
},
|
|
2834
|
-
DictGetKeys: (location, K, _V) => {
|
|
2951
|
+
DictGetKeys: (location, _platformDef, K, _V) => {
|
|
2835
2952
|
const compare = compareFor(K);
|
|
2836
2953
|
return (d, keys, onMissing) => {
|
|
2837
2954
|
const result = new SortedMap([], compare);
|
|
@@ -2848,7 +2965,7 @@ const builtin_evaluators = {
|
|
|
2848
2965
|
return result;
|
|
2849
2966
|
};
|
|
2850
2967
|
},
|
|
2851
|
-
DictForEach: (location, _K, _V, _T2) => (d, f) => {
|
|
2968
|
+
DictForEach: (location, _platformDef, _K, _V, _T2) => (d, f) => {
|
|
2852
2969
|
lockForIteration(d);
|
|
2853
2970
|
try {
|
|
2854
2971
|
d.forEach((v, k) => {
|
|
@@ -2860,13 +2977,13 @@ const builtin_evaluators = {
|
|
|
2860
2977
|
unlockForIteration(d);
|
|
2861
2978
|
}
|
|
2862
2979
|
},
|
|
2863
|
-
DictCopy: (_location, K, _V) => {
|
|
2980
|
+
DictCopy: (_location, _platformDef, K, _V) => {
|
|
2864
2981
|
const compare = compareFor(K);
|
|
2865
2982
|
return (d) => {
|
|
2866
2983
|
return new SortedMap([...d], compare);
|
|
2867
2984
|
};
|
|
2868
2985
|
},
|
|
2869
|
-
DictMap: (location, K, _V, _V2) => {
|
|
2986
|
+
DictMap: (location, _platformDef, K, _V, _V2) => {
|
|
2870
2987
|
const compare = compareFor(K);
|
|
2871
2988
|
return (d, f) => {
|
|
2872
2989
|
const result = new SortedMap([], compare);
|
|
@@ -2883,7 +3000,7 @@ const builtin_evaluators = {
|
|
|
2883
3000
|
}
|
|
2884
3001
|
};
|
|
2885
3002
|
},
|
|
2886
|
-
DictFilter: (location, K, _V) => {
|
|
3003
|
+
DictFilter: (location, _platformDef, K, _V) => {
|
|
2887
3004
|
const compare = compareFor(K);
|
|
2888
3005
|
return (d, f) => {
|
|
2889
3006
|
const result = new SortedMap([], compare);
|
|
@@ -2902,7 +3019,7 @@ const builtin_evaluators = {
|
|
|
2902
3019
|
}
|
|
2903
3020
|
};
|
|
2904
3021
|
},
|
|
2905
|
-
DictFilterMap: (location, K, _V, _V2) => {
|
|
3022
|
+
DictFilterMap: (location, _platformDef, K, _V, _V2) => {
|
|
2906
3023
|
const compare = compareFor(K);
|
|
2907
3024
|
return (d, f) => {
|
|
2908
3025
|
const result = new SortedMap([], compare);
|
|
@@ -2921,7 +3038,7 @@ const builtin_evaluators = {
|
|
|
2921
3038
|
}
|
|
2922
3039
|
};
|
|
2923
3040
|
},
|
|
2924
|
-
DictFirstMap: (location, _K, _V, _T2) => (d, f) => {
|
|
3041
|
+
DictFirstMap: (location, _platformDef, _K, _V, _T2) => (d, f) => {
|
|
2925
3042
|
lockForIteration(d);
|
|
2926
3043
|
try {
|
|
2927
3044
|
for (const [k, v] of d) {
|
|
@@ -2936,7 +3053,7 @@ const builtin_evaluators = {
|
|
|
2936
3053
|
unlockForIteration(d);
|
|
2937
3054
|
}
|
|
2938
3055
|
},
|
|
2939
|
-
DictMapReduce: (location, _K, _V, _T2) => (d, mapFn, reduceFn) => {
|
|
3056
|
+
DictMapReduce: (location, _platformDef, _K, _V, _T2) => (d, mapFn, reduceFn) => {
|
|
2940
3057
|
if (d.size === 0) {
|
|
2941
3058
|
throw new EastError("Cannot reduce empty dictionary with no initial value", { location });
|
|
2942
3059
|
}
|
|
@@ -2955,7 +3072,7 @@ const builtin_evaluators = {
|
|
|
2955
3072
|
unlockForIteration(d);
|
|
2956
3073
|
}
|
|
2957
3074
|
},
|
|
2958
|
-
DictReduce: (location, _K, _V, _T2) => (d, f, init) => {
|
|
3075
|
+
DictReduce: (location, _platformDef, _K, _V, _T2) => (d, f, init) => {
|
|
2959
3076
|
let acc = init;
|
|
2960
3077
|
lockForIteration(d);
|
|
2961
3078
|
try {
|
|
@@ -2968,7 +3085,7 @@ const builtin_evaluators = {
|
|
|
2968
3085
|
unlockForIteration(d);
|
|
2969
3086
|
}
|
|
2970
3087
|
},
|
|
2971
|
-
DictToArray: (location, _K, _V, _T2) => (d, valueFn) => {
|
|
3088
|
+
DictToArray: (location, _platformDef, _K, _V, _T2) => (d, valueFn) => {
|
|
2972
3089
|
const ret = [];
|
|
2973
3090
|
lockForIteration(d);
|
|
2974
3091
|
try {
|
|
@@ -2982,7 +3099,7 @@ const builtin_evaluators = {
|
|
|
2982
3099
|
unlockForIteration(d);
|
|
2983
3100
|
}
|
|
2984
3101
|
},
|
|
2985
|
-
DictToSet: (location, _K, _V, K2) => {
|
|
3102
|
+
DictToSet: (location, _platformDef, _K, _V, K2) => {
|
|
2986
3103
|
const compare = compareFor(K2);
|
|
2987
3104
|
return (d, fn) => {
|
|
2988
3105
|
const result = new SortedSet([], compare);
|
|
@@ -2999,7 +3116,7 @@ const builtin_evaluators = {
|
|
|
2999
3116
|
}
|
|
3000
3117
|
};
|
|
3001
3118
|
},
|
|
3002
|
-
DictToDict: (location, K, _V, K2, _V2) => {
|
|
3119
|
+
DictToDict: (location, _platformDef, K, _V, K2, _V2) => {
|
|
3003
3120
|
const compare = compareFor(K2);
|
|
3004
3121
|
return (d, keyFn, valueFn, onConflict) => {
|
|
3005
3122
|
const result = new SortedMap([], compare);
|
|
@@ -3024,7 +3141,7 @@ const builtin_evaluators = {
|
|
|
3024
3141
|
}
|
|
3025
3142
|
};
|
|
3026
3143
|
},
|
|
3027
|
-
DictFlattenToArray: (location, _K, _V, _T2) => (d, fn) => {
|
|
3144
|
+
DictFlattenToArray: (location, _platformDef, _K, _V, _T2) => (d, fn) => {
|
|
3028
3145
|
const ret = [];
|
|
3029
3146
|
lockForIteration(d);
|
|
3030
3147
|
try {
|
|
@@ -3040,7 +3157,7 @@ const builtin_evaluators = {
|
|
|
3040
3157
|
unlockForIteration(d);
|
|
3041
3158
|
}
|
|
3042
3159
|
},
|
|
3043
|
-
DictFlattenToSet: (location, _K, _V, K2) => {
|
|
3160
|
+
DictFlattenToSet: (location, _platformDef, _K, _V, K2) => {
|
|
3044
3161
|
const compare = compareFor(K2);
|
|
3045
3162
|
return (d, fn) => {
|
|
3046
3163
|
const result = new SortedSet([], compare);
|
|
@@ -3059,7 +3176,7 @@ const builtin_evaluators = {
|
|
|
3059
3176
|
}
|
|
3060
3177
|
};
|
|
3061
3178
|
},
|
|
3062
|
-
DictFlattenToDict: (location, _K, _V, K2, _V2) => {
|
|
3179
|
+
DictFlattenToDict: (location, _platformDef, _K, _V, K2, _V2) => {
|
|
3063
3180
|
const compare = compareFor(K2);
|
|
3064
3181
|
return (d, fn, onConflict) => {
|
|
3065
3182
|
const result = new SortedMap([], compare);
|
|
@@ -3085,7 +3202,7 @@ const builtin_evaluators = {
|
|
|
3085
3202
|
}
|
|
3086
3203
|
};
|
|
3087
3204
|
},
|
|
3088
|
-
DictGroupFold: (location, _K, _V, K2, _T2) => {
|
|
3205
|
+
DictGroupFold: (location, _platformDef, _K, _V, K2, _T2) => {
|
|
3089
3206
|
const compare = compareFor(K2);
|
|
3090
3207
|
return (d, keyFn, init, folder) => {
|
|
3091
3208
|
const result = new SortedMap([], compare);
|