@elaraai/east 0.0.1-beta.15 → 0.0.1-beta.17

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.
@@ -18,6 +18,11 @@ import { EastTypeValueType, isTypeValueEqual, expandTypeValue } from "./type_of_
18
18
  import { ref } from "./containers/ref.js";
19
19
  export { isTypeValueEqual };
20
20
  export const printTypeValue = printFor(EastTypeValueType);
21
+ /**
22
+ * Symbol used to attach source IR to compiled functions.
23
+ * This enables serialization of free functions (functions with no captures).
24
+ */
25
+ export const EAST_IR_SYMBOL = Symbol.for("east.ir");
21
26
  /** @internal Track iteration locks to prevent concurrent modification */
22
27
  const iterationLocks = new WeakMap();
23
28
  /** @internal Lock a collection for iteration (prevents size/keyset modifications) */
@@ -63,7 +68,7 @@ class BreakException {
63
68
  *
64
69
  * @internal
65
70
  */
66
- export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx = true, compilingNodes = new Set()) {
71
+ export function compile_internal(ir, ctx, platform, asyncPlatformFns, platformDef, fresh_ctx = true, compilingNodes = new Set()) {
67
72
  // The IR is checked prior to compilation, so we can assume it's valid here.
68
73
  // The compiler needs to take care that Promises are properly awaited, so most IR nodes need both sync and async implementations.
69
74
  // 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 +78,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
73
78
  return (_ctx) => v;
74
79
  }
75
80
  else if (ir.type === "Error") {
76
- const message_compiled = compile_internal(ir.value.message, ctx, platform, asyncPlatformFns, false, compilingNodes);
81
+ const message_compiled = compile_internal(ir.value.message, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
77
82
  const location = ir.value.location;
78
83
  if (ir.value.isAsync) {
79
84
  return async (ctx) => { throw new EastError(await message_compiled(ctx), { location: location }); };
@@ -83,15 +88,15 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
83
88
  }
84
89
  }
85
90
  else if (ir.type === "TryCatch") {
86
- const try_body = compile_internal(ir.value.try_body, Object.create(ctx), platform, asyncPlatformFns, true, compilingNodes);
91
+ const try_body = compile_internal(ir.value.try_body, Object.create(ctx), platform, asyncPlatformFns, platformDef, true, compilingNodes);
87
92
  const new_ctx = Object.create(ctx);
88
93
  const message_name = ir.value.message.value.name;
89
94
  const stack_name = ir.value.stack.value.name;
90
95
  new_ctx[message_name] = ir.value.message.value.type;
91
96
  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);
97
+ const catch_body = compile_internal(ir.value.catch_body, new_ctx, platform, asyncPlatformFns, platformDef, true, compilingNodes);
93
98
  // 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);
99
+ 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
100
  if (ir.value.isAsync) {
96
101
  if (finally_body === undefined) {
97
102
  return async (ctx) => {
@@ -185,7 +190,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
185
190
  }
186
191
  }
187
192
  else if (ir.type === "Let") {
188
- const compiled_statement = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, false, compilingNodes);
193
+ const compiled_statement = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
189
194
  const name = ir.value.variable.value.name;
190
195
  ctx[name] = ir.value.variable.value.type;
191
196
  if (ir.value.variable.value.mutable && ir.value.variable.value.captured) {
@@ -219,7 +224,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
219
224
  }
220
225
  else if (ir.type === "Assign") {
221
226
  const name = ir.value.variable.value.name;
222
- const compiled_statement = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, false, compilingNodes);
227
+ const compiled_statement = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
223
228
  if (ir.value.variable.value.mutable && ir.value.variable.value.captured) {
224
229
  if (ir.value.isAsync) {
225
230
  return async (ctx) => {
@@ -262,17 +267,17 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
262
267
  else if (ir.type === "As") {
263
268
  // in dynamically typed runtimes like Javascript, this is a no-op
264
269
  // (for statically typed runtimes this assists in unifying types in branches)
265
- return compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, fresh_ctx, compilingNodes);
270
+ return compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, fresh_ctx, compilingNodes);
266
271
  }
267
272
  else if (ir.type === "UnwrapRecursive") {
268
273
  // in dynamically typed runtimes like Javascript, this is a no-op
269
274
  // (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);
275
+ return compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, fresh_ctx, compilingNodes);
271
276
  }
272
277
  else if (ir.type === "WrapRecursive") {
273
278
  // in dynamically typed runtimes like Javascript, this is a no-op
274
279
  // (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);
280
+ return compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
276
281
  }
277
282
  else if (ir.type === "Function") {
278
283
  const ctx2 = {};
@@ -283,19 +288,29 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
283
288
  const parameter_name = parameter.value.name;
284
289
  ctx2[parameter_name] = parameter.value.type;
285
290
  }
286
- const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, true, compilingNodes);
291
+ const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
287
292
  const capture_names = ir.value.captures.map(v => v.value.name);
288
293
  const parameter_names = ir.value.parameters.map(v => v.value.name);
294
+ // Store original IR for potential serialization
295
+ const originalIR = ir;
289
296
  return (ctx) => {
290
297
  const ctx2 = {};
291
298
  for (const name of capture_names) {
292
299
  ctx2[name] = ctx[name];
293
300
  }
294
- return (...args) => {
301
+ const fn = (...args) => {
295
302
  const ctx3 = { ...ctx2 };
296
303
  parameter_names.forEach((name, i) => ctx3[name] = args[i]);
297
304
  return compiled_body(ctx3);
298
305
  };
306
+ // Attach IR to function for serialization support
307
+ Object.defineProperty(fn, EAST_IR_SYMBOL, {
308
+ value: originalIR,
309
+ writable: false,
310
+ enumerable: false,
311
+ configurable: false
312
+ });
313
+ return fn;
299
314
  };
300
315
  }
301
316
  else if (ir.type === "AsyncFunction") {
@@ -307,24 +322,34 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
307
322
  const parameter_name = parameter.value.name;
308
323
  ctx2[parameter_name] = parameter.value.type;
309
324
  }
310
- const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, true, compilingNodes);
325
+ const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
311
326
  const capture_names = ir.value.captures.map(v => v.value.name);
312
327
  const parameter_names = ir.value.parameters.map(v => v.value.name);
328
+ // Store original IR for potential serialization
329
+ const originalIR = ir;
313
330
  return (ctx) => {
314
331
  const ctx2 = {};
315
332
  for (const name of capture_names) {
316
333
  ctx2[name] = ctx[name];
317
334
  }
318
- return (...args) => {
335
+ const fn = (...args) => {
319
336
  const ctx3 = { ...ctx2 };
320
337
  parameter_names.forEach((name, i) => ctx3[name] = args[i]);
321
338
  return compiled_body(ctx3); // Promise can pass through in tail position
322
339
  };
340
+ // Attach IR to function for serialization support
341
+ Object.defineProperty(fn, EAST_IR_SYMBOL, {
342
+ value: originalIR,
343
+ writable: false,
344
+ enumerable: false,
345
+ configurable: false
346
+ });
347
+ return fn;
323
348
  };
324
349
  }
325
350
  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));
351
+ const compiled_f = compile_internal(ir.value.function, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
352
+ const compiled_args = ir.value.arguments.map(argument => compile_internal(argument, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes));
328
353
  const location = ir.value.location;
329
354
  if (ir.value.isAsync) {
330
355
  // need to await the arguments
@@ -383,8 +408,8 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
383
408
  }
384
409
  }
385
410
  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));
411
+ const compiled_f = compile_internal(ir.value.function, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
412
+ const compiled_args = ir.value.arguments.map(argument => compile_internal(argument, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes));
388
413
  const location = ir.value.location;
389
414
  return async (ctx) => {
390
415
  try {
@@ -422,11 +447,11 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
422
447
  asyncPredicate = true;
423
448
  }
424
449
  ifs.push({
425
- predicate: compile_internal(predicate, ctx, platform, asyncPlatformFns, false, compilingNodes),
426
- body: compile_internal(body, Object.create(ctx), platform, asyncPlatformFns, true, compilingNodes),
450
+ predicate: compile_internal(predicate, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes),
451
+ body: compile_internal(body, Object.create(ctx), platform, asyncPlatformFns, platformDef, true, compilingNodes),
427
452
  });
428
453
  }
429
- const else_body = compile_internal(ir.value.else_body, Object.create(ctx), platform, asyncPlatformFns, true, compilingNodes);
454
+ const else_body = compile_internal(ir.value.else_body, Object.create(ctx), platform, asyncPlatformFns, platformDef, true, compilingNodes);
430
455
  if (ir.value.isAsync) {
431
456
  if (asyncPredicate) {
432
457
  return async (ctx) => {
@@ -461,7 +486,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
461
486
  }
462
487
  }
463
488
  else if (ir.type === "Match") {
464
- const compiled_variant = compile_internal(ir.value.variant, ctx, platform, asyncPlatformFns, false, compilingNodes);
489
+ const compiled_variant = compile_internal(ir.value.variant, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
465
490
  const compiled_cases = {};
466
491
  const data_names = {};
467
492
  for (const { case: k, variable, body } of ir.value.cases) {
@@ -469,7 +494,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
469
494
  const data_name = variable.value.name;
470
495
  data_names[k] = data_name;
471
496
  ctx2[data_name] = variable.value.type;
472
- compiled_cases[k] = compile_internal(body, ctx2, platform, asyncPlatformFns, true, compilingNodes);
497
+ compiled_cases[k] = compile_internal(body, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
473
498
  }
474
499
  if (ir.value.isAsync) {
475
500
  if (ir.value.variant.value.isAsync) {
@@ -499,9 +524,9 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
499
524
  }
500
525
  }
501
526
  else if (ir.type === "While") {
502
- const compiled_predicate = compile_internal(ir.value.predicate, ctx, platform, asyncPlatformFns, false, compilingNodes);
527
+ const compiled_predicate = compile_internal(ir.value.predicate, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
503
528
  const ctx2 = Object.create(ctx);
504
- const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, true, compilingNodes);
529
+ const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
505
530
  const label = ir.value.label.name;
506
531
  if (ir.value.isAsync) {
507
532
  return async (ctx) => {
@@ -550,13 +575,13 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
550
575
  }
551
576
  else if (ir.type === "ForArray") {
552
577
  const value_type = expandTypeValue(ir.value.array.value.type).value;
553
- const compiled_array = compile_internal(ir.value.array, ctx, platform, asyncPlatformFns, false, compilingNodes);
578
+ const compiled_array = compile_internal(ir.value.array, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
554
579
  const ctx2 = Object.create(ctx);
555
580
  const key_name = ir.value.key.value.name;
556
581
  const value_name = ir.value.value.value.name;
557
582
  ctx2[key_name] = variant("Integer", null);
558
583
  ctx2[value_name] = value_type;
559
- const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, true, compilingNodes);
584
+ const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
560
585
  const label = ir.value.label.name;
561
586
  if (ir.value.isAsync) {
562
587
  return async (ctx) => {
@@ -623,11 +648,11 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
623
648
  }
624
649
  else if (ir.type === "ForSet") {
625
650
  const key_type = expandTypeValue(ir.value.set.value.type).value;
626
- const compiled_set = compile_internal(ir.value.set, ctx, platform, asyncPlatformFns, false, compilingNodes);
651
+ const compiled_set = compile_internal(ir.value.set, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
627
652
  const ctx2 = Object.create(ctx);
628
653
  const key_name = ir.value.key.value.name;
629
654
  ctx2[key_name] = key_type;
630
- const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, true, compilingNodes);
655
+ const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
631
656
  const label = ir.value.label.name;
632
657
  if (ir.value.isAsync) {
633
658
  return async (ctx) => {
@@ -693,13 +718,13 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
693
718
  else if (ir.type === "ForDict") {
694
719
  const key_type = expandTypeValue(ir.value.dict.value.type).value.key;
695
720
  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);
721
+ const compiled_dict = compile_internal(ir.value.dict, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
697
722
  const ctx2 = Object.create(ctx);
698
723
  const key_name = ir.value.key.value.name;
699
724
  const value_name = ir.value.value.value.name;
700
725
  ctx2[key_name] = key_type;
701
726
  ctx2[value_name] = value_type;
702
- const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, true, compilingNodes);
727
+ const compiled_body = compile_internal(ir.value.body, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
703
728
  const label = ir.value.label.name;
704
729
  if (ir.value.isAsync) {
705
730
  return async (ctx) => {
@@ -770,7 +795,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
770
795
  if (fresh_ctx) {
771
796
  const compiled_statements = [];
772
797
  for (const statement of ir.value.statements) {
773
- const compiled_statement = compile_internal(statement, ctx, platform, asyncPlatformFns, true, compilingNodes);
798
+ const compiled_statement = compile_internal(statement, ctx, platform, asyncPlatformFns, platformDef, true, compilingNodes);
774
799
  compiled_statements.push(compiled_statement);
775
800
  }
776
801
  if (ir.value.isAsync) {
@@ -796,7 +821,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
796
821
  const ctx2 = Object.create(ctx);
797
822
  const compiled_statements = [];
798
823
  for (const statement of ir.value.statements) {
799
- const compiled_statement = compile_internal(statement, ctx2, platform, asyncPlatformFns, true, compilingNodes);
824
+ const compiled_statement = compile_internal(statement, ctx2, platform, asyncPlatformFns, platformDef, true, compilingNodes);
800
825
  compiled_statements.push(compiled_statement);
801
826
  }
802
827
  if (ir.value.isAsync) {
@@ -822,7 +847,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
822
847
  }
823
848
  }
824
849
  else if (ir.type === "GetField") {
825
- const struct = compile_internal(ir.value.struct, ctx, platform, asyncPlatformFns, false, compilingNodes);
850
+ const struct = compile_internal(ir.value.struct, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
826
851
  const field = ir.value.field;
827
852
  if (ir.value.isAsync) {
828
853
  return async (ctx) => (await struct(ctx))[field];
@@ -833,7 +858,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
833
858
  }
834
859
  else if (ir.type === "Struct") {
835
860
  const fields = ir.value.fields.map(f => {
836
- return compile_internal(f.value, ctx, platform, asyncPlatformFns, false, compilingNodes);
861
+ return compile_internal(f.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
837
862
  });
838
863
  const keys = ir.value.fields.map(f => f.name);
839
864
  if (ir.value.isAsync) {
@@ -851,7 +876,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
851
876
  }
852
877
  else if (ir.type === "Variant") {
853
878
  const k = ir.value.case;
854
- const v = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, false, compilingNodes);
879
+ const v = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
855
880
  if (ir.value.isAsync) {
856
881
  return async (ctx) => variant(k, await v(ctx));
857
882
  }
@@ -860,7 +885,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
860
885
  }
861
886
  }
862
887
  else if (ir.type === "NewRef") {
863
- const value = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, false, compilingNodes);
888
+ const value = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
864
889
  if (ir.value.isAsync) {
865
890
  return async (ctx) => ref(await value(ctx));
866
891
  }
@@ -870,7 +895,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
870
895
  }
871
896
  else if (ir.type === "NewArray") {
872
897
  const values = ir.value.values.map(a => {
873
- return compile_internal(a, ctx, platform, asyncPlatformFns, false, compilingNodes);
898
+ return compile_internal(a, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
874
899
  });
875
900
  if (ir.value.isAsync) {
876
901
  return async (ctx) => {
@@ -887,7 +912,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
887
912
  }
888
913
  else if (ir.type === "NewSet") {
889
914
  const values = ir.value.values.map(a => {
890
- return compile_internal(a, ctx, platform, asyncPlatformFns, false, compilingNodes);
915
+ return compile_internal(a, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
891
916
  });
892
917
  const keyComparer = compareFor(ir.value.type.value);
893
918
  if (ir.value.isAsync) {
@@ -905,7 +930,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
905
930
  }
906
931
  else if (ir.type === "NewDict") {
907
932
  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)];
933
+ return [compile_internal(key, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes), compile_internal(value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes)];
909
934
  });
910
935
  const keyComparer = compareFor(ir.value.type.value.key);
911
936
  if (ir.value.isAsync) {
@@ -922,7 +947,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
922
947
  }
923
948
  }
924
949
  else if (ir.type === "Return") {
925
- const compiled_value = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, false, compilingNodes);
950
+ const compiled_value = compile_internal(ir.value.value, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
926
951
  if (ir.value.isAsync) {
927
952
  return async (ctx) => {
928
953
  throw new ReturnException(await compiled_value(ctx));
@@ -952,7 +977,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
952
977
  if (a.value.isAsync) {
953
978
  argsAsync = true;
954
979
  }
955
- return compile_internal(a, ctx, platform, asyncPlatformFns, false, compilingNodes);
980
+ return compile_internal(a, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
956
981
  });
957
982
  // Special optimization for regex builtins with literal pattern/flags
958
983
  if ((ir.value.builtin === "RegexContains" || ir.value.builtin === "RegexIndexOf" || ir.value.builtin === "RegexReplace") &&
@@ -1127,7 +1152,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
1127
1152
  }
1128
1153
  }
1129
1154
  }
1130
- const evaluator = builtin_evaluators[ir.value.builtin](ir.value.location, ...ir.value.type_parameters);
1155
+ const evaluator = builtin_evaluators[ir.value.builtin](ir.value.location, platformDef, ...ir.value.type_parameters);
1131
1156
  if (argsAsync) {
1132
1157
  return async (ctx) => {
1133
1158
  const args_resolved = [];
@@ -1147,7 +1172,7 @@ export function compile_internal(ir, ctx, platform, asyncPlatformFns, fresh_ctx
1147
1172
  if (a.value.isAsync) {
1148
1173
  argsAsync = true;
1149
1174
  }
1150
- return compile_internal(a, ctx, platform, asyncPlatformFns, false, compilingNodes);
1175
+ return compile_internal(a, ctx, platform, asyncPlatformFns, platformDef, false, compilingNodes);
1151
1176
  });
1152
1177
  const evaluator = platform[ir.value.name];
1153
1178
  if (evaluator === undefined) {
@@ -1196,13 +1221,13 @@ function call_function(location, compiled_f, ...args) {
1196
1221
  }
1197
1222
  /** @internal */
1198
1223
  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),
1224
+ Is: (_location, _platformDef, T) => isFor(T),
1225
+ Equal: (_location, _platformDef, T) => equalFor(T),
1226
+ NotEqual: (_location, _platformDef, T) => notEqualFor(T),
1227
+ Less: (_location, _platformDef, T) => lessFor(T),
1228
+ LessEqual: (_location, _platformDef, T) => lessEqualFor(T),
1229
+ Greater: (_location, _platformDef, T) => greaterFor(T),
1230
+ GreaterEqual: (_location, _platformDef, T) => greaterEqualFor(T),
1206
1231
  BooleanNot: (_location) => (x) => !x,
1207
1232
  BooleanOr: (_location) => (x, y) => x || y,
1208
1233
  BooleanAnd: (_location) => (x, y) => x && y,
@@ -1257,10 +1282,10 @@ const builtin_evaluators = {
1257
1282
  FloatSin: (_location) => (value) => Math.sin(value),
1258
1283
  FloatCos: (_location) => (value) => Math.cos(value),
1259
1284
  FloatTan: (_location) => (value) => Math.tan(value),
1260
- Print: (_location, T) => {
1285
+ Print: (_location, _platformDef, T) => {
1261
1286
  return printFor(T);
1262
1287
  },
1263
- Parse: (location, T) => {
1288
+ Parse: (location, _platformDef, T) => {
1264
1289
  const p = parseFor(T);
1265
1290
  return (x) => {
1266
1291
  const result = p(x);
@@ -1460,7 +1485,7 @@ const builtin_evaluators = {
1460
1485
  return buffer.toUint8Array();
1461
1486
  };
1462
1487
  },
1463
- StringParseJSON: (location, type) => {
1488
+ StringParseJSON: (location, _platformDef, type) => {
1464
1489
  const fromJSON = fromJSONFor(type);
1465
1490
  return (x) => {
1466
1491
  let parsed;
@@ -1478,7 +1503,7 @@ const builtin_evaluators = {
1478
1503
  }
1479
1504
  };
1480
1505
  },
1481
- StringPrintJSON: (_location, type) => {
1506
+ StringPrintJSON: (_location, _platformDef, type) => {
1482
1507
  const toJSON = toJSONFor(type);
1483
1508
  return (x) => JSON.stringify(toJSON(x));
1484
1509
  },
@@ -1555,13 +1580,13 @@ const builtin_evaluators = {
1555
1580
  }
1556
1581
  };
1557
1582
  },
1558
- BlobEncodeBeast: (_location, type) => {
1583
+ BlobEncodeBeast: (_location, _platformDef, type) => {
1559
1584
  const encodeBeast = encodeBeastFor(type);
1560
1585
  return (value) => {
1561
1586
  return encodeBeast(value);
1562
1587
  };
1563
1588
  },
1564
- BlobDecodeBeast: (location, type) => {
1589
+ BlobDecodeBeast: (location, _platformDef, type) => {
1565
1590
  const decodeBeast = decodeBeastFor(type);
1566
1591
  return (data) => {
1567
1592
  try {
@@ -1572,14 +1597,14 @@ const builtin_evaluators = {
1572
1597
  }
1573
1598
  };
1574
1599
  },
1575
- BlobEncodeBeast2: (_location, type) => {
1600
+ BlobEncodeBeast2: (_location, _platformDef, type) => {
1576
1601
  const encodeBeast2 = encodeBeast2For(type);
1577
1602
  return (value) => {
1578
1603
  return encodeBeast2(value);
1579
1604
  };
1580
1605
  },
1581
- BlobDecodeBeast2: (location, type) => {
1582
- const decodeBeast2 = decodeBeast2For(type);
1606
+ BlobDecodeBeast2: (location, platformDef, type) => {
1607
+ const decodeBeast2 = decodeBeast2For(type, { platform: platformDef });
1583
1608
  return (data) => {
1584
1609
  try {
1585
1610
  return decodeBeast2(data);
@@ -1589,7 +1614,7 @@ const builtin_evaluators = {
1589
1614
  }
1590
1615
  };
1591
1616
  },
1592
- BlobDecodeCsv: (location, structType, _configType) => {
1617
+ BlobDecodeCsv: (location, _platformDef, structType, _configType) => {
1593
1618
  return (data, config) => {
1594
1619
  try {
1595
1620
  const decoder = decodeCsvFor(structType, config);
@@ -1600,7 +1625,7 @@ const builtin_evaluators = {
1600
1625
  }
1601
1626
  };
1602
1627
  },
1603
- ArrayEncodeCsv: (location, structType, _configType) => {
1628
+ ArrayEncodeCsv: (location, _platformDef, structType, _configType) => {
1604
1629
  return (data, config) => {
1605
1630
  try {
1606
1631
  const encoder = encodeCsvFor(structType, config);
@@ -1611,17 +1636,17 @@ const builtin_evaluators = {
1611
1636
  }
1612
1637
  };
1613
1638
  },
1614
- RefGet: (_location, _T) => (ref) => {
1639
+ RefGet: (_location, _platformDef, _T) => (ref) => {
1615
1640
  return ref.value;
1616
1641
  },
1617
- RefUpdate: (location, _T) => (ref, value) => {
1642
+ RefUpdate: (location, _platformDef, _T) => (ref, value) => {
1618
1643
  if (Object.isFrozen(ref)) {
1619
1644
  throw new EastError("Cannot modify frozen Ref", { location });
1620
1645
  }
1621
1646
  ref.value = value;
1622
1647
  return null;
1623
1648
  },
1624
- RefMerge: (location, _T) => (ref, value, merger) => {
1649
+ RefMerge: (location, _platformDef, _T) => (ref, value, merger) => {
1625
1650
  if (Object.isFrozen(ref)) {
1626
1651
  throw new EastError("Cannot modify frozen Ref", { location });
1627
1652
  }
@@ -1629,7 +1654,7 @@ const builtin_evaluators = {
1629
1654
  ref.value = new_value;
1630
1655
  return null;
1631
1656
  },
1632
- ArrayGenerate: (location, _T) => (size, f) => {
1657
+ ArrayGenerate: (location, _platformDef, _T) => (size, f) => {
1633
1658
  const result = [];
1634
1659
  for (let i = 0n; i < size; i += 1n) {
1635
1660
  const v = call_function(location, f, i);
@@ -1670,12 +1695,12 @@ const builtin_evaluators = {
1670
1695
  }
1671
1696
  return result;
1672
1697
  },
1673
- ArraySize: (_location, _T) => (array) => BigInt(array.length),
1674
- ArrayHas: (_location, _T) => (array, key) => {
1698
+ ArraySize: (_location, _platformDef, _T) => (array) => BigInt(array.length),
1699
+ ArrayHas: (_location, _platformDef, _T) => (array, key) => {
1675
1700
  const i = Number(key);
1676
1701
  return i >= 0 && i < array.length;
1677
1702
  },
1678
- ArrayGet: (location, _T) => (array, key) => {
1703
+ ArrayGet: (location, _platformDef, _T) => (array, key) => {
1679
1704
  const i = Number(key);
1680
1705
  if (i < 0 || i >= array.length) {
1681
1706
  throw new EastError(`Array index ${key} out of bounds`, { location });
@@ -1684,7 +1709,7 @@ const builtin_evaluators = {
1684
1709
  return array[i];
1685
1710
  }
1686
1711
  },
1687
- ArrayGetOrDefault: (location, _T) => (array, key, defaultFn) => {
1712
+ ArrayGetOrDefault: (location, _platformDef, _T) => (array, key, defaultFn) => {
1688
1713
  const i = Number(key);
1689
1714
  if (i < 0 || i >= array.length) {
1690
1715
  return call_function(location, defaultFn, key);
@@ -1693,7 +1718,7 @@ const builtin_evaluators = {
1693
1718
  return array[i];
1694
1719
  }
1695
1720
  },
1696
- ArrayTryGet: (_location, _T) => (array, key) => {
1721
+ ArrayTryGet: (_location, _platformDef, _T) => (array, key) => {
1697
1722
  const i = Number(key);
1698
1723
  if (i < 0 || i >= array.length) {
1699
1724
  return variant("none", null);
@@ -1702,7 +1727,7 @@ const builtin_evaluators = {
1702
1727
  return variant("some", array[i]);
1703
1728
  }
1704
1729
  },
1705
- ArrayUpdate: (location, _T) => (array, key, value) => {
1730
+ ArrayUpdate: (location, _platformDef, _T) => (array, key, value) => {
1706
1731
  if (Object.isFrozen(array)) {
1707
1732
  throw new EastError("Cannot modify frozen Array", { location });
1708
1733
  }
@@ -1715,7 +1740,7 @@ const builtin_evaluators = {
1715
1740
  return null;
1716
1741
  }
1717
1742
  },
1718
- ArrayMerge: (location, _T) => (array, key, value, merger) => {
1743
+ ArrayMerge: (location, _platformDef, _T) => (array, key, value, merger) => {
1719
1744
  if (Object.isFrozen(array)) {
1720
1745
  throw new EastError("Cannot modify frozen Array", { location });
1721
1746
  }
@@ -1729,7 +1754,7 @@ const builtin_evaluators = {
1729
1754
  return null;
1730
1755
  }
1731
1756
  },
1732
- ArrayPushLast: (location, _T) => (array, value) => {
1757
+ ArrayPushLast: (location, _platformDef, _T) => (array, value) => {
1733
1758
  if (Object.isFrozen(array)) {
1734
1759
  throw new EastError("Cannot modify frozen Array", { location });
1735
1760
  }
@@ -1739,7 +1764,7 @@ const builtin_evaluators = {
1739
1764
  array.push(value);
1740
1765
  return null;
1741
1766
  },
1742
- ArrayPopLast: (location, _T) => (array) => {
1767
+ ArrayPopLast: (location, _platformDef, _T) => (array) => {
1743
1768
  if (Object.isFrozen(array)) {
1744
1769
  throw new EastError("Cannot modify frozen Array", { location });
1745
1770
  }
@@ -1753,7 +1778,7 @@ const builtin_evaluators = {
1753
1778
  return array.pop();
1754
1779
  }
1755
1780
  },
1756
- ArrayPushFirst: (location, _T) => (array, value) => {
1781
+ ArrayPushFirst: (location, _platformDef, _T) => (array, value) => {
1757
1782
  if (Object.isFrozen(array)) {
1758
1783
  throw new EastError("Cannot modify frozen Array", { location });
1759
1784
  }
@@ -1763,7 +1788,7 @@ const builtin_evaluators = {
1763
1788
  array.unshift(value);
1764
1789
  return null;
1765
1790
  },
1766
- ArrayPopFirst: (location, _T) => (array) => {
1791
+ ArrayPopFirst: (location, _platformDef, _T) => (array) => {
1767
1792
  if (Object.isFrozen(array)) {
1768
1793
  throw new EastError("Cannot modify frozen Array", { location });
1769
1794
  }
@@ -1777,7 +1802,7 @@ const builtin_evaluators = {
1777
1802
  return array.shift();
1778
1803
  }
1779
1804
  },
1780
- ArrayAppend: (location, _T) => (array, other) => {
1805
+ ArrayAppend: (location, _platformDef, _T) => (array, other) => {
1781
1806
  if (Object.isFrozen(array)) {
1782
1807
  throw new EastError("Cannot modify frozen Array", { location });
1783
1808
  }
@@ -1787,7 +1812,7 @@ const builtin_evaluators = {
1787
1812
  array.push(...other);
1788
1813
  return null;
1789
1814
  },
1790
- ArrayPrepend: (location, _T) => (array, other) => {
1815
+ ArrayPrepend: (location, _platformDef, _T) => (array, other) => {
1791
1816
  if (Object.isFrozen(array)) {
1792
1817
  throw new EastError("Cannot modify frozen Array", { location });
1793
1818
  }
@@ -1797,7 +1822,7 @@ const builtin_evaluators = {
1797
1822
  array.unshift(...other);
1798
1823
  return null;
1799
1824
  },
1800
- ArrayMergeAll: (location, _T, _T2) => (array, other, merger) => {
1825
+ ArrayMergeAll: (location, _platformDef, _T, _T2) => (array, other, merger) => {
1801
1826
  if (Object.isFrozen(array)) {
1802
1827
  throw new EastError("Cannot modify frozen Array", { location });
1803
1828
  }
@@ -1821,7 +1846,7 @@ const builtin_evaluators = {
1821
1846
  }
1822
1847
  return null;
1823
1848
  },
1824
- ArrayClear: (location, _T) => (array) => {
1849
+ ArrayClear: (location, _platformDef, _T) => (array) => {
1825
1850
  if (Object.isFrozen(array)) {
1826
1851
  throw new EastError("Cannot modify frozen Array", { location });
1827
1852
  }
@@ -1831,7 +1856,7 @@ const builtin_evaluators = {
1831
1856
  array.length = 0;
1832
1857
  return null;
1833
1858
  },
1834
- ArraySortInPlace: (location, T, T2) => (array, by) => {
1859
+ ArraySortInPlace: (location, _platformDef, T, T2) => (array, by) => {
1835
1860
  if (Object.isFrozen(array)) {
1836
1861
  throw new EastError("Cannot modify frozen Array", { location });
1837
1862
  }
@@ -1852,7 +1877,7 @@ const builtin_evaluators = {
1852
1877
  }
1853
1878
  return null;
1854
1879
  },
1855
- ArrayReverseInPlace: (location, _T) => (array) => {
1880
+ ArrayReverseInPlace: (location, _platformDef, _T) => (array) => {
1856
1881
  if (Object.isFrozen(array)) {
1857
1882
  throw new EastError("Cannot modify frozen Array", { location });
1858
1883
  }
@@ -1862,7 +1887,7 @@ const builtin_evaluators = {
1862
1887
  array.reverse();
1863
1888
  return null;
1864
1889
  },
1865
- ArraySort: (location, T, T2) => (array, by) => {
1890
+ ArraySort: (location, _platformDef, T, T2) => (array, by) => {
1866
1891
  const cmp = compareFor(T2);
1867
1892
  const newArray = [...array];
1868
1893
  newArray.sort((a, b) => {
@@ -1872,12 +1897,12 @@ const builtin_evaluators = {
1872
1897
  });
1873
1898
  return newArray;
1874
1899
  },
1875
- ArrayReverse: (_location, _T) => (array) => {
1900
+ ArrayReverse: (_location, _platformDef, _T) => (array) => {
1876
1901
  const newArray = [...array];
1877
1902
  newArray.reverse();
1878
1903
  return newArray;
1879
1904
  },
1880
- ArrayIsSorted: (location, T, T2) => {
1905
+ ArrayIsSorted: (location, _platformDef, T, T2) => {
1881
1906
  const cmp = compareFor(T2);
1882
1907
  return (array, by) => {
1883
1908
  if (array.length < 2)
@@ -1899,7 +1924,7 @@ const builtin_evaluators = {
1899
1924
  return true;
1900
1925
  };
1901
1926
  },
1902
- ArrayFindSortedFirst: (location, T, T2) => {
1927
+ ArrayFindSortedFirst: (location, _platformDef, T, T2) => {
1903
1928
  const cmp = compareFor(T2);
1904
1929
  return (array, key, by) => {
1905
1930
  let low = 0;
@@ -1923,7 +1948,7 @@ const builtin_evaluators = {
1923
1948
  return BigInt(low);
1924
1949
  };
1925
1950
  },
1926
- ArrayFindSortedLast: (location, T, T2) => {
1951
+ ArrayFindSortedLast: (location, _platformDef, T, T2) => {
1927
1952
  const cmp = compareFor(T2);
1928
1953
  return (array, key, by) => {
1929
1954
  let low = 0;
@@ -1947,7 +1972,7 @@ const builtin_evaluators = {
1947
1972
  return BigInt(low);
1948
1973
  };
1949
1974
  },
1950
- ArrayFindSortedRange: (location, T, T2) => {
1975
+ ArrayFindSortedRange: (location, _platformDef, T, T2) => {
1951
1976
  const cmp = compareFor(T2);
1952
1977
  return (array, key, by) => {
1953
1978
  let lo = -1;
@@ -2005,7 +2030,7 @@ const builtin_evaluators = {
2005
2030
  return { start: BigInt(lo + 1), end: BigInt(lo + 1) };
2006
2031
  };
2007
2032
  },
2008
- ArrayFindFirst: (location, T, T2) => {
2033
+ ArrayFindFirst: (location, _platformDef, T, T2) => {
2009
2034
  const cmp = compareFor(T2);
2010
2035
  return (array, value, by) => {
2011
2036
  lockForIteration(array);
@@ -2023,15 +2048,15 @@ const builtin_evaluators = {
2023
2048
  }
2024
2049
  };
2025
2050
  },
2026
- ArrayConcat: (_location, _T) => (a1, a2) => {
2051
+ ArrayConcat: (_location, _platformDef, _T) => (a1, a2) => {
2027
2052
  return [...a1, ...a2];
2028
2053
  },
2029
- ArraySlice: (_location, _T) => (array, start, end) => {
2054
+ ArraySlice: (_location, _platformDef, _T) => (array, start, end) => {
2030
2055
  const startNum = Number(start);
2031
2056
  const endNum = Number(end);
2032
2057
  return array.slice(startNum, endNum);
2033
2058
  },
2034
- ArrayGetKeys: (location, _T) => (array, keys, onMissing) => {
2059
+ ArrayGetKeys: (location, _platformDef, _T) => (array, keys, onMissing) => {
2035
2060
  return keys.map(k => {
2036
2061
  const i = Number(k);
2037
2062
  if (i < 0 || i >= array.length) {
@@ -2042,7 +2067,7 @@ const builtin_evaluators = {
2042
2067
  }
2043
2068
  });
2044
2069
  },
2045
- ArrayForEach: (location, _T, _T2) => (array, f) => {
2070
+ ArrayForEach: (location, _platformDef, _T, _T2) => (array, f) => {
2046
2071
  lockForIteration(array);
2047
2072
  try {
2048
2073
  array.forEach((x, i) => {
@@ -2054,10 +2079,10 @@ const builtin_evaluators = {
2054
2079
  unlockForIteration(array);
2055
2080
  }
2056
2081
  },
2057
- ArrayCopy: (_location, _T) => (array) => {
2082
+ ArrayCopy: (_location, _platformDef, _T) => (array) => {
2058
2083
  return [...array];
2059
2084
  },
2060
- ArrayMap: (location, _T, _T2) => (array, f) => {
2085
+ ArrayMap: (location, _platformDef, _T, _T2) => (array, f) => {
2061
2086
  lockForIteration(array);
2062
2087
  try {
2063
2088
  return array.map((x, i) => {
@@ -2068,7 +2093,7 @@ const builtin_evaluators = {
2068
2093
  unlockForIteration(array);
2069
2094
  }
2070
2095
  },
2071
- ArrayFilter: (location, _T, _T2) => (array, f) => {
2096
+ ArrayFilter: (location, _platformDef, _T, _T2) => (array, f) => {
2072
2097
  lockForIteration(array);
2073
2098
  try {
2074
2099
  return array.filter((x, i) => {
@@ -2079,7 +2104,7 @@ const builtin_evaluators = {
2079
2104
  unlockForIteration(array);
2080
2105
  }
2081
2106
  },
2082
- ArrayFilterMap: (location, _T, _T2) => (array, f) => {
2107
+ ArrayFilterMap: (location, _platformDef, _T, _T2) => (array, f) => {
2083
2108
  lockForIteration(array);
2084
2109
  try {
2085
2110
  const result = [];
@@ -2095,7 +2120,7 @@ const builtin_evaluators = {
2095
2120
  unlockForIteration(array);
2096
2121
  }
2097
2122
  },
2098
- ArrayFirstMap: (location, _T, _T2) => (array, f) => {
2123
+ ArrayFirstMap: (location, _platformDef, _T, _T2) => (array, f) => {
2099
2124
  lockForIteration(array);
2100
2125
  try {
2101
2126
  for (let i = 0; i < array.length; i++) {
@@ -2110,7 +2135,7 @@ const builtin_evaluators = {
2110
2135
  unlockForIteration(array);
2111
2136
  }
2112
2137
  },
2113
- ArrayFold: (location, _T, _T2) => (array, init, f) => {
2138
+ ArrayFold: (location, _platformDef, _T, _T2) => (array, init, f) => {
2114
2139
  lockForIteration(array);
2115
2140
  try {
2116
2141
  return array.reduce((acc, x, i) => {
@@ -2121,7 +2146,7 @@ const builtin_evaluators = {
2121
2146
  unlockForIteration(array);
2122
2147
  }
2123
2148
  },
2124
- ArrayMapReduce: (location, _T, _T2) => (array, mapFn, reduceFn) => {
2149
+ ArrayMapReduce: (location, _platformDef, _T, _T2) => (array, mapFn, reduceFn) => {
2125
2150
  if (array.length === 0) {
2126
2151
  throw new EastError("Cannot reduce empty array with no initial value", { location });
2127
2152
  }
@@ -2138,8 +2163,8 @@ const builtin_evaluators = {
2138
2163
  unlockForIteration(array);
2139
2164
  }
2140
2165
  },
2141
- ArrayStringJoin: (_location) => (x, y) => x.join(y),
2142
- ArrayToSet: (location, _T, T2) => {
2166
+ ArrayStringJoin: (_location, _platformDef) => (x, y) => x.join(y),
2167
+ ArrayToSet: (location, _platformDef, _T, T2) => {
2143
2168
  const compare = compareFor(T2);
2144
2169
  return (array, f) => {
2145
2170
  lockForIteration(array);
@@ -2156,7 +2181,7 @@ const builtin_evaluators = {
2156
2181
  }
2157
2182
  };
2158
2183
  },
2159
- ArrayToDict: (location, _T, K2, _T2) => {
2184
+ ArrayToDict: (location, _platformDef, _T, K2, _T2) => {
2160
2185
  const compare = compareFor(K2);
2161
2186
  return (array, keyFn, valueFn, onConflict) => {
2162
2187
  const result = new SortedMap([], compare);
@@ -2182,12 +2207,12 @@ const builtin_evaluators = {
2182
2207
  }
2183
2208
  };
2184
2209
  },
2185
- ArrayFlattenToArray: (location, _T) => (array, fn) => {
2210
+ ArrayFlattenToArray: (location, _platformDef, _T) => (array, fn) => {
2186
2211
  return array.flatMap(v => {
2187
2212
  return call_function(location, fn, v);
2188
2213
  });
2189
2214
  },
2190
- ArrayFlattenToSet: (location, _T, K2) => {
2215
+ ArrayFlattenToSet: (location, _platformDef, _T, K2) => {
2191
2216
  const compare = compareFor(K2);
2192
2217
  return (array, fn) => {
2193
2218
  const result = new SortedSet([], compare);
@@ -2206,7 +2231,7 @@ const builtin_evaluators = {
2206
2231
  }
2207
2232
  };
2208
2233
  },
2209
- ArrayFlattenToDict: (location, _T, K2, _T2) => {
2234
+ ArrayFlattenToDict: (location, _platformDef, _T, K2, _T2) => {
2210
2235
  const compare = compareFor(K2);
2211
2236
  return (array, fn, onConflict) => {
2212
2237
  const result = new SortedMap([], compare);
@@ -2232,7 +2257,7 @@ const builtin_evaluators = {
2232
2257
  }
2233
2258
  };
2234
2259
  },
2235
- ArrayGroupFold: (location, _T, K2, _V2) => {
2260
+ ArrayGroupFold: (location, _platformDef, _T, K2, _V2) => {
2236
2261
  const compare = compareFor(K2);
2237
2262
  return (array, keyFn, init, folder) => {
2238
2263
  const result = new SortedMap([], compare);
@@ -2255,7 +2280,7 @@ const builtin_evaluators = {
2255
2280
  }
2256
2281
  };
2257
2282
  },
2258
- SetGenerate: (location, K) => {
2283
+ SetGenerate: (location, _platformDef, K) => {
2259
2284
  const keyComparer = compareFor(K);
2260
2285
  return (size, keyFn, onConflict) => {
2261
2286
  const result = new SortedSet([], keyComparer);
@@ -2271,9 +2296,9 @@ const builtin_evaluators = {
2271
2296
  return result;
2272
2297
  };
2273
2298
  },
2274
- SetSize: (_location, _K) => (s) => BigInt(s.size),
2275
- SetHas: (_location, _K) => (s, key) => s.has(key),
2276
- SetInsert: (location, K) => {
2299
+ SetSize: (_location, _platformDef, _K) => (s) => BigInt(s.size),
2300
+ SetHas: (_location, _platformDef, _K) => (s, key) => s.has(key),
2301
+ SetInsert: (location, _platformDef, K) => {
2277
2302
  const print = printFor(K);
2278
2303
  return (s, key) => {
2279
2304
  if (Object.isFrozen(s)) {
@@ -2290,7 +2315,7 @@ const builtin_evaluators = {
2290
2315
  return null;
2291
2316
  };
2292
2317
  },
2293
- SetTryInsert: (location, _K) => (s, key) => {
2318
+ SetTryInsert: (location, _platformDef, _K) => (s, key) => {
2294
2319
  if (Object.isFrozen(s)) {
2295
2320
  throw new EastError("Cannot modify frozen Set", { location });
2296
2321
  }
@@ -2301,7 +2326,7 @@ const builtin_evaluators = {
2301
2326
  s.add(key);
2302
2327
  return s.size > size_before;
2303
2328
  },
2304
- SetDelete: (location, K) => {
2329
+ SetDelete: (location, _platformDef, K) => {
2305
2330
  const print = printFor(K);
2306
2331
  return (s, key) => {
2307
2332
  if (Object.isFrozen(s)) {
@@ -2316,7 +2341,7 @@ const builtin_evaluators = {
2316
2341
  return null;
2317
2342
  };
2318
2343
  },
2319
- SetTryDelete: (location, _K) => (s, key) => {
2344
+ SetTryDelete: (location, _platformDef, _K) => (s, key) => {
2320
2345
  if (Object.isFrozen(s)) {
2321
2346
  throw new EastError("Cannot modify frozen Set", { location });
2322
2347
  }
@@ -2325,7 +2350,7 @@ const builtin_evaluators = {
2325
2350
  }
2326
2351
  return s.delete(key);
2327
2352
  },
2328
- SetClear: (location, _K) => (s) => {
2353
+ SetClear: (location, _platformDef, _K) => (s) => {
2329
2354
  if (Object.isFrozen(s)) {
2330
2355
  throw new EastError("Cannot modify frozen Set", { location });
2331
2356
  }
@@ -2335,7 +2360,7 @@ const builtin_evaluators = {
2335
2360
  s.clear();
2336
2361
  return null;
2337
2362
  },
2338
- SetUnionInPlace: (location, _K) => (s1, s2) => {
2363
+ SetUnionInPlace: (location, _platformDef, _K) => (s1, s2) => {
2339
2364
  if (Object.isFrozen(s1)) {
2340
2365
  throw new EastError("Cannot modify frozen Set", { location });
2341
2366
  }
@@ -2345,19 +2370,19 @@ const builtin_evaluators = {
2345
2370
  s2.forEach(v => s1.add(v));
2346
2371
  return null;
2347
2372
  },
2348
- SetUnion: (_location, _K) => (s1, s2) => s1.union(s2),
2349
- SetIntersect: (_location, _K) => (s1, s2) => s1.intersection(s2),
2350
- SetDiff: (_location, _K) => (s1, s2) => s1.difference(s2),
2351
- SetSymDiff: (_location, _K) => (s1, s2) => s1.symmetricDifference(s2),
2352
- SetIsSubset: (_location, _K) => (s1, s2) => s1.isSubsetOf(s2),
2353
- SetIsDisjoint: (_location, _K) => (s1, s2) => s1.isDisjointFrom(s2),
2354
- SetCopy: (_location, K) => {
2373
+ SetUnion: (_location, _platformDef, _K) => (s1, s2) => s1.union(s2),
2374
+ SetIntersect: (_location, _platformDef, _K) => (s1, s2) => s1.intersection(s2),
2375
+ SetDiff: (_location, _platformDef, _K) => (s1, s2) => s1.difference(s2),
2376
+ SetSymDiff: (_location, _platformDef, _K) => (s1, s2) => s1.symmetricDifference(s2),
2377
+ SetIsSubset: (_location, _platformDef, _K) => (s1, s2) => s1.isSubsetOf(s2),
2378
+ SetIsDisjoint: (_location, _platformDef, _K) => (s1, s2) => s1.isDisjointFrom(s2),
2379
+ SetCopy: (_location, _platformDef, K) => {
2355
2380
  const compare = compareFor(K);
2356
2381
  return (s) => {
2357
2382
  return new SortedSet([...s], compare);
2358
2383
  };
2359
2384
  },
2360
- SetForEach: (location, _K, _T2) => (s, f) => {
2385
+ SetForEach: (location, _platformDef, _K, _T2) => (s, f) => {
2361
2386
  lockForIteration(s);
2362
2387
  try {
2363
2388
  s.forEach(x => {
@@ -2369,7 +2394,7 @@ const builtin_evaluators = {
2369
2394
  unlockForIteration(s);
2370
2395
  }
2371
2396
  },
2372
- SetFilter: (location, K) => {
2397
+ SetFilter: (location, _platformDef, K) => {
2373
2398
  const compare = compareFor(K);
2374
2399
  return (s, f) => {
2375
2400
  const result = new SortedSet([], compare);
@@ -2388,7 +2413,7 @@ const builtin_evaluators = {
2388
2413
  }
2389
2414
  };
2390
2415
  },
2391
- SetFilterMap: (location, K, _V2) => {
2416
+ SetFilterMap: (location, _platformDef, K, _V2) => {
2392
2417
  const compare = compareFor(K);
2393
2418
  return (s, f) => {
2394
2419
  const result = new SortedMap([], compare);
@@ -2407,7 +2432,7 @@ const builtin_evaluators = {
2407
2432
  }
2408
2433
  };
2409
2434
  },
2410
- SetFirstMap: (location, _K, _T2) => (s, f) => {
2435
+ SetFirstMap: (location, _platformDef, _K, _T2) => (s, f) => {
2411
2436
  lockForIteration(s);
2412
2437
  try {
2413
2438
  for (const k of s) {
@@ -2422,7 +2447,7 @@ const builtin_evaluators = {
2422
2447
  unlockForIteration(s);
2423
2448
  }
2424
2449
  },
2425
- SetMapReduce: (location, _K, _T2) => (s, mapFn, reduceFn) => {
2450
+ SetMapReduce: (location, _platformDef, _K, _T2) => (s, mapFn, reduceFn) => {
2426
2451
  if (s.size === 0) {
2427
2452
  throw new EastError("Cannot reduce empty set with no initial value", { location });
2428
2453
  }
@@ -2441,7 +2466,7 @@ const builtin_evaluators = {
2441
2466
  unlockForIteration(s);
2442
2467
  }
2443
2468
  },
2444
- SetMap: (location, K, _T2) => {
2469
+ SetMap: (location, _platformDef, K, _T2) => {
2445
2470
  const compare = compareFor(K);
2446
2471
  return (s, f) => {
2447
2472
  const result = new SortedMap([], compare);
@@ -2458,7 +2483,7 @@ const builtin_evaluators = {
2458
2483
  }
2459
2484
  };
2460
2485
  },
2461
- SetReduce: (location, _K, _T2) => (s, f, init) => {
2486
+ SetReduce: (location, _platformDef, _K, _T2) => (s, f, init) => {
2462
2487
  let acc = init;
2463
2488
  lockForIteration(s);
2464
2489
  try {
@@ -2471,7 +2496,7 @@ const builtin_evaluators = {
2471
2496
  unlockForIteration(s);
2472
2497
  }
2473
2498
  },
2474
- SetToArray: (location, _K, _T2) => (s, valueFn) => {
2499
+ SetToArray: (location, _platformDef, _K, _T2) => (s, valueFn) => {
2475
2500
  const ret = [];
2476
2501
  lockForIteration(s);
2477
2502
  try {
@@ -2485,7 +2510,7 @@ const builtin_evaluators = {
2485
2510
  unlockForIteration(s);
2486
2511
  }
2487
2512
  },
2488
- SetToSet: (location, K, K2) => {
2513
+ SetToSet: (location, _platformDef, K, K2) => {
2489
2514
  const compare = compareFor(K2);
2490
2515
  return (s, f) => {
2491
2516
  const result = new SortedSet([], compare);
@@ -2503,7 +2528,7 @@ const builtin_evaluators = {
2503
2528
  }
2504
2529
  };
2505
2530
  },
2506
- SetToDict: (location, K, K2, _V2) => {
2531
+ SetToDict: (location, _platformDef, K, K2, _V2) => {
2507
2532
  const compare = compareFor(K2);
2508
2533
  return (s, keyFn, valueFn, onConflict) => {
2509
2534
  const result = new SortedMap([], compare);
@@ -2528,7 +2553,7 @@ const builtin_evaluators = {
2528
2553
  }
2529
2554
  };
2530
2555
  },
2531
- SetFlattenToArray: (location, _K, _T2) => (s, fn) => {
2556
+ SetFlattenToArray: (location, _platformDef, _K, _T2) => (s, fn) => {
2532
2557
  const ret = [];
2533
2558
  lockForIteration(s);
2534
2559
  try {
@@ -2542,7 +2567,7 @@ const builtin_evaluators = {
2542
2567
  unlockForIteration(s);
2543
2568
  }
2544
2569
  },
2545
- SetFlattenToSet: (location, _K, K2) => {
2570
+ SetFlattenToSet: (location, _platformDef, _K, K2) => {
2546
2571
  const compare = compareFor(K2);
2547
2572
  return (s, fn) => {
2548
2573
  const result = new SortedSet([], compare);
@@ -2561,7 +2586,7 @@ const builtin_evaluators = {
2561
2586
  }
2562
2587
  };
2563
2588
  },
2564
- SetFlattenToDict: (location, _K, K2, _V2) => {
2589
+ SetFlattenToDict: (location, _platformDef, _K, K2, _V2) => {
2565
2590
  const compare = compareFor(K2);
2566
2591
  return (s, fn, onConflict) => {
2567
2592
  const result = new SortedMap([], compare);
@@ -2587,7 +2612,7 @@ const builtin_evaluators = {
2587
2612
  }
2588
2613
  };
2589
2614
  },
2590
- SetGroupFold: (location, _K, K2, _T2) => {
2615
+ SetGroupFold: (location, _platformDef, _K, K2, _T2) => {
2591
2616
  const compare = compareFor(K2);
2592
2617
  return (s, keyFn, init, folder) => {
2593
2618
  const result = new SortedMap([], compare);
@@ -2609,7 +2634,7 @@ const builtin_evaluators = {
2609
2634
  }
2610
2635
  };
2611
2636
  },
2612
- DictGenerate: (location, K, _V) => {
2637
+ DictGenerate: (location, _platformDef, K, _V) => {
2613
2638
  const keyComparer = compareFor(K);
2614
2639
  return (size, keyFn, valueFn, onConflict) => {
2615
2640
  const result = new SortedMap([], keyComparer);
@@ -2628,9 +2653,9 @@ const builtin_evaluators = {
2628
2653
  return result;
2629
2654
  };
2630
2655
  },
2631
- DictSize: (_location, _K, _V) => (d) => BigInt(d.size),
2632
- DictHas: (_location, _K, _V) => (d, key) => d.has(key),
2633
- DictGet: (location, K, _V) => {
2656
+ DictSize: (_location, _platformDef, _K, _V) => (d) => BigInt(d.size),
2657
+ DictHas: (_location, _platformDef, _K, _V) => (d, key) => d.has(key),
2658
+ DictGet: (location, _platformDef, K, _V) => {
2634
2659
  const print = printFor(K);
2635
2660
  return (d, key) => {
2636
2661
  const result = d.get(key);
@@ -2642,7 +2667,7 @@ const builtin_evaluators = {
2642
2667
  }
2643
2668
  };
2644
2669
  },
2645
- DictGetOrDefault: (location, _K, _V) => (d, key, onMissingFn) => {
2670
+ DictGetOrDefault: (location, _platformDef, _K, _V) => (d, key, onMissingFn) => {
2646
2671
  const result = d.get(key);
2647
2672
  if (result === undefined) {
2648
2673
  return call_function(location, onMissingFn, key);
@@ -2651,7 +2676,7 @@ const builtin_evaluators = {
2651
2676
  return result;
2652
2677
  }
2653
2678
  },
2654
- DictTryGet: (_location, _K, _V) => (d, key) => {
2679
+ DictTryGet: (_location, _platformDef, _K, _V) => (d, key) => {
2655
2680
  const result = d.get(key);
2656
2681
  if (result === undefined) {
2657
2682
  return variant("none", null);
@@ -2660,7 +2685,7 @@ const builtin_evaluators = {
2660
2685
  return variant("some", result);
2661
2686
  }
2662
2687
  },
2663
- DictInsert: (location, K, _V) => {
2688
+ DictInsert: (location, _platformDef, K, _V) => {
2664
2689
  const print = printFor(K);
2665
2690
  return (d, key, value) => {
2666
2691
  if (Object.isFrozen(d)) {
@@ -2679,7 +2704,7 @@ const builtin_evaluators = {
2679
2704
  return null;
2680
2705
  };
2681
2706
  },
2682
- DictGetOrInsert: (location, _K, _V) => (d, key, onMissing) => {
2707
+ DictGetOrInsert: (location, _platformDef, _K, _V) => (d, key, onMissing) => {
2683
2708
  if (Object.isFrozen(d)) {
2684
2709
  throw new EastError("Cannot modify frozen Dict", { location });
2685
2710
  }
@@ -2696,7 +2721,7 @@ const builtin_evaluators = {
2696
2721
  return existing;
2697
2722
  }
2698
2723
  },
2699
- DictInsertOrUpdate: (location, _K, _V) => (d, key, value, onConflictFn) => {
2724
+ DictInsertOrUpdate: (location, _platformDef, _K, _V) => (d, key, value, onConflictFn) => {
2700
2725
  if (Object.isFrozen(d)) {
2701
2726
  throw new EastError("Cannot modify frozen Dict", { location });
2702
2727
  }
@@ -2713,7 +2738,7 @@ const builtin_evaluators = {
2713
2738
  }
2714
2739
  return null;
2715
2740
  },
2716
- DictUpdate: (location, K, _V) => {
2741
+ DictUpdate: (location, _platformDef, K, _V) => {
2717
2742
  const print = printFor(K);
2718
2743
  return (d, key, value) => {
2719
2744
  if (Object.isFrozen(d)) {
@@ -2728,7 +2753,7 @@ const builtin_evaluators = {
2728
2753
  }
2729
2754
  };
2730
2755
  },
2731
- DictSwap: (location, K, _V) => {
2756
+ DictSwap: (location, _platformDef, K, _V) => {
2732
2757
  const print = printFor(K);
2733
2758
  return (d, key, value) => {
2734
2759
  if (Object.isFrozen(d)) {
@@ -2742,7 +2767,7 @@ const builtin_evaluators = {
2742
2767
  return existing;
2743
2768
  };
2744
2769
  },
2745
- DictMerge: (location, _K, _V) => (d, key, value, mergeFn, initialFn) => {
2770
+ DictMerge: (location, _platformDef, _K, _V) => (d, key, value, mergeFn, initialFn) => {
2746
2771
  if (Object.isFrozen(d)) {
2747
2772
  throw new EastError("Cannot modify frozen Dict", { location });
2748
2773
  }
@@ -2757,7 +2782,7 @@ const builtin_evaluators = {
2757
2782
  d.set(key, new_value);
2758
2783
  return null;
2759
2784
  },
2760
- DictDelete: (location, K, _V) => {
2785
+ DictDelete: (location, _platformDef, K, _V) => {
2761
2786
  const print = printFor(K);
2762
2787
  return (d, key) => {
2763
2788
  if (Object.isFrozen(d)) {
@@ -2773,7 +2798,7 @@ const builtin_evaluators = {
2773
2798
  return null;
2774
2799
  };
2775
2800
  },
2776
- DictTryDelete: (location, _K, _V) => (d, key) => {
2801
+ DictTryDelete: (location, _platformDef, _K, _V) => (d, key) => {
2777
2802
  if (Object.isFrozen(d)) {
2778
2803
  throw new EastError("Cannot modify frozen Dict", { location });
2779
2804
  }
@@ -2782,7 +2807,7 @@ const builtin_evaluators = {
2782
2807
  }
2783
2808
  return d.delete(key);
2784
2809
  },
2785
- DictPop: (location, K, _V) => {
2810
+ DictPop: (location, _platformDef, K, _V) => {
2786
2811
  const print = printFor(K);
2787
2812
  return (d, key) => {
2788
2813
  if (Object.isFrozen(d)) {
@@ -2801,7 +2826,7 @@ const builtin_evaluators = {
2801
2826
  }
2802
2827
  };
2803
2828
  },
2804
- DictClear: (location, _K, _V) => (d) => {
2829
+ DictClear: (location, _platformDef, _K, _V) => (d) => {
2805
2830
  if (Object.isFrozen(d)) {
2806
2831
  throw new EastError("Cannot modify frozen Dict", { location });
2807
2832
  }
@@ -2811,7 +2836,7 @@ const builtin_evaluators = {
2811
2836
  d.clear();
2812
2837
  return null;
2813
2838
  },
2814
- DictUnionInPlace: (location, _K, _V) => (d1, d2, onConflict) => {
2839
+ DictUnionInPlace: (location, _platformDef, _K, _V) => (d1, d2, onConflict) => {
2815
2840
  if (Object.isFrozen(d1)) {
2816
2841
  throw new EastError("Cannot modify frozen Dict", { location });
2817
2842
  }
@@ -2830,7 +2855,7 @@ const builtin_evaluators = {
2830
2855
  });
2831
2856
  return null;
2832
2857
  },
2833
- DictMergeAll: (location, _K, _V) => (d1, d2, mergeFn, initialFn) => {
2858
+ DictMergeAll: (location, _platformDef, _K, _V) => (d1, d2, mergeFn, initialFn) => {
2834
2859
  if (Object.isFrozen(d1)) {
2835
2860
  throw new EastError("Cannot modify frozen Dict", { location });
2836
2861
  }
@@ -2847,13 +2872,13 @@ const builtin_evaluators = {
2847
2872
  });
2848
2873
  return null;
2849
2874
  },
2850
- DictKeys: (_location, K, _V) => {
2875
+ DictKeys: (_location, _platformDef, K, _V) => {
2851
2876
  const compare = compareFor(K);
2852
2877
  return (d) => {
2853
2878
  return new SortedSet([...d.keys()], compare);
2854
2879
  };
2855
2880
  },
2856
- DictGetKeys: (location, K, _V) => {
2881
+ DictGetKeys: (location, _platformDef, K, _V) => {
2857
2882
  const compare = compareFor(K);
2858
2883
  return (d, keys, onMissing) => {
2859
2884
  const result = new SortedMap([], compare);
@@ -2870,7 +2895,7 @@ const builtin_evaluators = {
2870
2895
  return result;
2871
2896
  };
2872
2897
  },
2873
- DictForEach: (location, _K, _V, _T2) => (d, f) => {
2898
+ DictForEach: (location, _platformDef, _K, _V, _T2) => (d, f) => {
2874
2899
  lockForIteration(d);
2875
2900
  try {
2876
2901
  d.forEach((v, k) => {
@@ -2882,13 +2907,13 @@ const builtin_evaluators = {
2882
2907
  unlockForIteration(d);
2883
2908
  }
2884
2909
  },
2885
- DictCopy: (_location, K, _V) => {
2910
+ DictCopy: (_location, _platformDef, K, _V) => {
2886
2911
  const compare = compareFor(K);
2887
2912
  return (d) => {
2888
2913
  return new SortedMap([...d], compare);
2889
2914
  };
2890
2915
  },
2891
- DictMap: (location, K, _V, _V2) => {
2916
+ DictMap: (location, _platformDef, K, _V, _V2) => {
2892
2917
  const compare = compareFor(K);
2893
2918
  return (d, f) => {
2894
2919
  const result = new SortedMap([], compare);
@@ -2905,7 +2930,7 @@ const builtin_evaluators = {
2905
2930
  }
2906
2931
  };
2907
2932
  },
2908
- DictFilter: (location, K, _V) => {
2933
+ DictFilter: (location, _platformDef, K, _V) => {
2909
2934
  const compare = compareFor(K);
2910
2935
  return (d, f) => {
2911
2936
  const result = new SortedMap([], compare);
@@ -2924,7 +2949,7 @@ const builtin_evaluators = {
2924
2949
  }
2925
2950
  };
2926
2951
  },
2927
- DictFilterMap: (location, K, _V, _V2) => {
2952
+ DictFilterMap: (location, _platformDef, K, _V, _V2) => {
2928
2953
  const compare = compareFor(K);
2929
2954
  return (d, f) => {
2930
2955
  const result = new SortedMap([], compare);
@@ -2943,7 +2968,7 @@ const builtin_evaluators = {
2943
2968
  }
2944
2969
  };
2945
2970
  },
2946
- DictFirstMap: (location, _K, _V, _T2) => (d, f) => {
2971
+ DictFirstMap: (location, _platformDef, _K, _V, _T2) => (d, f) => {
2947
2972
  lockForIteration(d);
2948
2973
  try {
2949
2974
  for (const [k, v] of d) {
@@ -2958,7 +2983,7 @@ const builtin_evaluators = {
2958
2983
  unlockForIteration(d);
2959
2984
  }
2960
2985
  },
2961
- DictMapReduce: (location, _K, _V, _T2) => (d, mapFn, reduceFn) => {
2986
+ DictMapReduce: (location, _platformDef, _K, _V, _T2) => (d, mapFn, reduceFn) => {
2962
2987
  if (d.size === 0) {
2963
2988
  throw new EastError("Cannot reduce empty dictionary with no initial value", { location });
2964
2989
  }
@@ -2977,7 +3002,7 @@ const builtin_evaluators = {
2977
3002
  unlockForIteration(d);
2978
3003
  }
2979
3004
  },
2980
- DictReduce: (location, _K, _V, _T2) => (d, f, init) => {
3005
+ DictReduce: (location, _platformDef, _K, _V, _T2) => (d, f, init) => {
2981
3006
  let acc = init;
2982
3007
  lockForIteration(d);
2983
3008
  try {
@@ -2990,7 +3015,7 @@ const builtin_evaluators = {
2990
3015
  unlockForIteration(d);
2991
3016
  }
2992
3017
  },
2993
- DictToArray: (location, _K, _V, _T2) => (d, valueFn) => {
3018
+ DictToArray: (location, _platformDef, _K, _V, _T2) => (d, valueFn) => {
2994
3019
  const ret = [];
2995
3020
  lockForIteration(d);
2996
3021
  try {
@@ -3004,7 +3029,7 @@ const builtin_evaluators = {
3004
3029
  unlockForIteration(d);
3005
3030
  }
3006
3031
  },
3007
- DictToSet: (location, _K, _V, K2) => {
3032
+ DictToSet: (location, _platformDef, _K, _V, K2) => {
3008
3033
  const compare = compareFor(K2);
3009
3034
  return (d, fn) => {
3010
3035
  const result = new SortedSet([], compare);
@@ -3021,7 +3046,7 @@ const builtin_evaluators = {
3021
3046
  }
3022
3047
  };
3023
3048
  },
3024
- DictToDict: (location, K, _V, K2, _V2) => {
3049
+ DictToDict: (location, _platformDef, K, _V, K2, _V2) => {
3025
3050
  const compare = compareFor(K2);
3026
3051
  return (d, keyFn, valueFn, onConflict) => {
3027
3052
  const result = new SortedMap([], compare);
@@ -3046,7 +3071,7 @@ const builtin_evaluators = {
3046
3071
  }
3047
3072
  };
3048
3073
  },
3049
- DictFlattenToArray: (location, _K, _V, _T2) => (d, fn) => {
3074
+ DictFlattenToArray: (location, _platformDef, _K, _V, _T2) => (d, fn) => {
3050
3075
  const ret = [];
3051
3076
  lockForIteration(d);
3052
3077
  try {
@@ -3062,7 +3087,7 @@ const builtin_evaluators = {
3062
3087
  unlockForIteration(d);
3063
3088
  }
3064
3089
  },
3065
- DictFlattenToSet: (location, _K, _V, K2) => {
3090
+ DictFlattenToSet: (location, _platformDef, _K, _V, K2) => {
3066
3091
  const compare = compareFor(K2);
3067
3092
  return (d, fn) => {
3068
3093
  const result = new SortedSet([], compare);
@@ -3081,7 +3106,7 @@ const builtin_evaluators = {
3081
3106
  }
3082
3107
  };
3083
3108
  },
3084
- DictFlattenToDict: (location, _K, _V, K2, _V2) => {
3109
+ DictFlattenToDict: (location, _platformDef, _K, _V, K2, _V2) => {
3085
3110
  const compare = compareFor(K2);
3086
3111
  return (d, fn, onConflict) => {
3087
3112
  const result = new SortedMap([], compare);
@@ -3107,7 +3132,7 @@ const builtin_evaluators = {
3107
3132
  }
3108
3133
  };
3109
3134
  },
3110
- DictGroupFold: (location, _K, _V, K2, _T2) => {
3135
+ DictGroupFold: (location, _platformDef, _K, _V, K2, _T2) => {
3111
3136
  const compare = compareFor(K2);
3112
3137
  return (d, keyFn, init, folder) => {
3113
3138
  const result = new SortedMap([], compare);