@elaraai/east 1.0.60 → 1.0.62
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/dist/src/builtins.d.ts +1 -1
- package/dist/src/builtins.d.ts.map +1 -1
- package/dist/src/builtins.js +15 -0
- package/dist/src/builtins.js.map +1 -1
- package/dist/src/comparison.d.ts +16 -1
- package/dist/src/comparison.d.ts.map +1 -1
- package/dist/src/comparison.js +42 -16
- package/dist/src/comparison.js.map +1 -1
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +114 -64
- package/dist/src/compile.js.map +1 -1
- package/dist/src/expr/array.d.ts +41 -0
- package/dist/src/expr/array.d.ts.map +1 -1
- package/dist/src/expr/array.js +53 -0
- package/dist/src/expr/array.js.map +1 -1
- package/dist/src/expr/blob.d.ts +3 -1
- package/dist/src/expr/blob.d.ts.map +1 -1
- package/dist/src/expr/blob.js +3 -1
- package/dist/src/expr/blob.js.map +1 -1
- package/dist/src/expr/dict.d.ts +123 -15
- package/dist/src/expr/dict.d.ts.map +1 -1
- package/dist/src/expr/dict.js +115 -61
- package/dist/src/expr/dict.js.map +1 -1
- package/dist/src/expr/regex_validation.d.ts +0 -1
- package/dist/src/expr/regex_validation.d.ts.map +1 -1
- package/dist/src/expr/regex_validation.js +0 -40
- package/dist/src/expr/regex_validation.js.map +1 -1
- package/dist/src/expr/set.d.ts +38 -1
- package/dist/src/expr/set.d.ts.map +1 -1
- package/dist/src/expr/set.js +44 -0
- package/dist/src/expr/set.js.map +1 -1
- package/dist/src/frozen.d.ts +41 -0
- package/dist/src/frozen.d.ts.map +1 -0
- package/dist/src/frozen.js +70 -0
- package/dist/src/frozen.js.map +1 -0
- package/dist/src/fuzz.d.ts +9 -0
- package/dist/src/fuzz.d.ts.map +1 -1
- package/dist/src/fuzz.js +63 -40
- 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/patch/diff.js +3 -3
- package/dist/src/patch/diff.js.map +1 -1
- package/dist/src/patch/fuzz.d.ts +5 -0
- package/dist/src/patch/fuzz.d.ts.map +1 -1
- package/dist/src/patch/fuzz.js +5 -1
- package/dist/src/patch/fuzz.js.map +1 -1
- package/dist/src/serialization/beast2/index.d.ts +1 -1
- package/dist/src/serialization/beast2/index.d.ts.map +1 -1
- package/dist/src/serialization/beast2/index.js.map +1 -1
- package/dist/src/serialization/beast2/shared.d.ts +7 -0
- package/dist/src/serialization/beast2/shared.d.ts.map +1 -1
- package/dist/src/serialization/beast2/shared.js.map +1 -1
- package/dist/src/serialization/beast2/v4/container.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v4/container.js +79 -40
- package/dist/src/serialization/beast2/v4/container.js.map +1 -1
- package/dist/src/serialization/beast2/v5/codec.d.ts +5 -0
- package/dist/src/serialization/beast2/v5/codec.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/codec.js +82 -38
- package/dist/src/serialization/beast2/v5/codec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.d.ts +24 -2
- package/dist/src/serialization/beast2/v5/lazy.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.js +107 -14
- package/dist/src/serialization/beast2/v5/lazy.js.map +1 -1
- package/dist/src/serialization/beast2/v5/stream.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/stream.js +9 -3
- package/dist/src/serialization/beast2/v5/stream.js.map +1 -1
- package/dist/src/serialization/csv.d.ts +12 -2
- package/dist/src/serialization/csv.d.ts.map +1 -1
- package/dist/src/serialization/csv.js +31 -1
- package/dist/src/serialization/csv.js.map +1 -1
- package/dist/src/serialization/csv.spec.js +80 -0
- package/dist/src/serialization/csv.spec.js.map +1 -1
- package/dist/src/serialization/east.d.ts +11 -2
- package/dist/src/serialization/east.d.ts.map +1 -1
- package/dist/src/serialization/east.js +15 -6
- package/dist/src/serialization/east.js.map +1 -1
- package/dist/src/serialization/index.d.ts +1 -1
- package/dist/src/serialization/index.d.ts.map +1 -1
- package/dist/src/serialization/json.d.ts.map +1 -1
- package/dist/src/serialization/json.js +13 -4
- package/dist/src/serialization/json.js.map +1 -1
- package/dist/src/serialization/json.spec.js +8 -6
- package/dist/src/serialization/json.spec.js.map +1 -1
- package/package.json +1 -1
package/dist/src/compile.js
CHANGED
|
@@ -12,6 +12,7 @@ import { invertFor } from "./patch/invert.js";
|
|
|
12
12
|
import { ConflictError } from "./patch/index.js";
|
|
13
13
|
import { printFor, parseFor } from "./serialization/east.js";
|
|
14
14
|
import { variant } from "./containers/variant.js";
|
|
15
|
+
import { isFrozenValue } from "./frozen.js";
|
|
15
16
|
import { EastError, InternalError } from "./error.js";
|
|
16
17
|
import { get_current_source_map } from "./location.js";
|
|
17
18
|
import { SortedSet } from "./containers/sortedset.js";
|
|
@@ -53,6 +54,10 @@ function getContextValue(ctx, name) {
|
|
|
53
54
|
return value;
|
|
54
55
|
}
|
|
55
56
|
// =============================================================================
|
|
57
|
+
/** @internal The frozen-mutation error message — identical across the TS, C
|
|
58
|
+
* and Python runtimes (compliance-tested), so a body that mutates a frozen
|
|
59
|
+
* task input fails the same way everywhere. */
|
|
60
|
+
const FROZEN_MESSAGE = "cannot mutate a frozen value (task inputs are immutable) — copy first";
|
|
56
61
|
/** @internal Track iteration locks to prevent concurrent modification */
|
|
57
62
|
const iterationLocks = new WeakMap();
|
|
58
63
|
/** @internal Lock a collection for iteration (prevents size/keyset modifications) */
|
|
@@ -1841,15 +1846,15 @@ const builtin_evaluators = {
|
|
|
1841
1846
|
return ref.value;
|
|
1842
1847
|
},
|
|
1843
1848
|
RefUpdate: (loc_id, source_map, _platformDef, _T) => (ref, value) => {
|
|
1844
|
-
if (
|
|
1845
|
-
throw new EastError(
|
|
1849
|
+
if (isFrozenValue(ref)) {
|
|
1850
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
1846
1851
|
}
|
|
1847
1852
|
ref.value = value;
|
|
1848
1853
|
return null;
|
|
1849
1854
|
},
|
|
1850
1855
|
RefMerge: (loc_id, source_map, _platformDef, _T) => (ref, value, merger) => {
|
|
1851
|
-
if (
|
|
1852
|
-
throw new EastError(
|
|
1856
|
+
if (isFrozenValue(ref)) {
|
|
1857
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
1853
1858
|
}
|
|
1854
1859
|
const new_value = call_function(loc_id, source_map, merger, ref.value, value);
|
|
1855
1860
|
ref.value = new_value;
|
|
@@ -1929,8 +1934,8 @@ const builtin_evaluators = {
|
|
|
1929
1934
|
}
|
|
1930
1935
|
},
|
|
1931
1936
|
ArrayUpdate: (loc_id, source_map, _platformDef, _T) => (array, key, value) => {
|
|
1932
|
-
if (
|
|
1933
|
-
throw new EastError(
|
|
1937
|
+
if (isFrozenValue(array)) {
|
|
1938
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
1934
1939
|
}
|
|
1935
1940
|
const i = Number(key);
|
|
1936
1941
|
if (i < 0 || i >= array.length) {
|
|
@@ -1942,8 +1947,8 @@ const builtin_evaluators = {
|
|
|
1942
1947
|
}
|
|
1943
1948
|
},
|
|
1944
1949
|
ArrayMerge: (loc_id, source_map, _platformDef, _T) => (array, key, value, merger) => {
|
|
1945
|
-
if (
|
|
1946
|
-
throw new EastError(
|
|
1950
|
+
if (isFrozenValue(array)) {
|
|
1951
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
1947
1952
|
}
|
|
1948
1953
|
const i = Number(key);
|
|
1949
1954
|
if (i < 0 || i >= array.length) {
|
|
@@ -1956,8 +1961,8 @@ const builtin_evaluators = {
|
|
|
1956
1961
|
}
|
|
1957
1962
|
},
|
|
1958
1963
|
ArrayPushLast: (loc_id, source_map, _platformDef, _T) => (array, value) => {
|
|
1959
|
-
if (
|
|
1960
|
-
throw new EastError(
|
|
1964
|
+
if (isFrozenValue(array)) {
|
|
1965
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
1961
1966
|
}
|
|
1962
1967
|
if ((iterationLocks.get(array) || 0) > 0) {
|
|
1963
1968
|
throw new EastError("Cannot modify Array during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -1966,8 +1971,8 @@ const builtin_evaluators = {
|
|
|
1966
1971
|
return null;
|
|
1967
1972
|
},
|
|
1968
1973
|
ArrayPopLast: (loc_id, source_map, _platformDef, _T) => (array) => {
|
|
1969
|
-
if (
|
|
1970
|
-
throw new EastError(
|
|
1974
|
+
if (isFrozenValue(array)) {
|
|
1975
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
1971
1976
|
}
|
|
1972
1977
|
if ((iterationLocks.get(array) || 0) > 0) {
|
|
1973
1978
|
throw new EastError("Cannot modify Array during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -1980,8 +1985,8 @@ const builtin_evaluators = {
|
|
|
1980
1985
|
}
|
|
1981
1986
|
},
|
|
1982
1987
|
ArrayPushFirst: (loc_id, source_map, _platformDef, _T) => (array, value) => {
|
|
1983
|
-
if (
|
|
1984
|
-
throw new EastError(
|
|
1988
|
+
if (isFrozenValue(array)) {
|
|
1989
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
1985
1990
|
}
|
|
1986
1991
|
if ((iterationLocks.get(array) || 0) > 0) {
|
|
1987
1992
|
throw new EastError("Cannot modify Array during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -1990,8 +1995,8 @@ const builtin_evaluators = {
|
|
|
1990
1995
|
return null;
|
|
1991
1996
|
},
|
|
1992
1997
|
ArrayPopFirst: (loc_id, source_map, _platformDef, _T) => (array) => {
|
|
1993
|
-
if (
|
|
1994
|
-
throw new EastError(
|
|
1998
|
+
if (isFrozenValue(array)) {
|
|
1999
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
1995
2000
|
}
|
|
1996
2001
|
if ((iterationLocks.get(array) || 0) > 0) {
|
|
1997
2002
|
throw new EastError("Cannot modify Array during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2004,8 +2009,8 @@ const builtin_evaluators = {
|
|
|
2004
2009
|
}
|
|
2005
2010
|
},
|
|
2006
2011
|
ArrayAppend: (loc_id, source_map, _platformDef, _T) => (array, other) => {
|
|
2007
|
-
if (
|
|
2008
|
-
throw new EastError(
|
|
2012
|
+
if (isFrozenValue(array)) {
|
|
2013
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2009
2014
|
}
|
|
2010
2015
|
if ((iterationLocks.get(array) || 0) > 0) {
|
|
2011
2016
|
throw new EastError("Cannot modify Array during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2014,8 +2019,8 @@ const builtin_evaluators = {
|
|
|
2014
2019
|
return null;
|
|
2015
2020
|
},
|
|
2016
2021
|
ArrayPrepend: (loc_id, source_map, _platformDef, _T) => (array, other) => {
|
|
2017
|
-
if (
|
|
2018
|
-
throw new EastError(
|
|
2022
|
+
if (isFrozenValue(array)) {
|
|
2023
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2019
2024
|
}
|
|
2020
2025
|
if ((iterationLocks.get(array) || 0) > 0) {
|
|
2021
2026
|
throw new EastError("Cannot modify Array during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2024,8 +2029,8 @@ const builtin_evaluators = {
|
|
|
2024
2029
|
return null;
|
|
2025
2030
|
},
|
|
2026
2031
|
ArrayMergeAll: (loc_id, source_map, _platformDef, _T, _T2) => (array, other, merger) => {
|
|
2027
|
-
if (
|
|
2028
|
-
throw new EastError(
|
|
2032
|
+
if (isFrozenValue(array)) {
|
|
2033
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2029
2034
|
}
|
|
2030
2035
|
lockForIteration(array);
|
|
2031
2036
|
lockForIteration(other);
|
|
@@ -2048,8 +2053,8 @@ const builtin_evaluators = {
|
|
|
2048
2053
|
return null;
|
|
2049
2054
|
},
|
|
2050
2055
|
ArrayClear: (loc_id, source_map, _platformDef, _T) => (array) => {
|
|
2051
|
-
if (
|
|
2052
|
-
throw new EastError(
|
|
2056
|
+
if (isFrozenValue(array)) {
|
|
2057
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2053
2058
|
}
|
|
2054
2059
|
if ((iterationLocks.get(array) || 0) > 0) {
|
|
2055
2060
|
throw new EastError("Cannot modify Array during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2058,8 +2063,8 @@ const builtin_evaluators = {
|
|
|
2058
2063
|
return null;
|
|
2059
2064
|
},
|
|
2060
2065
|
ArraySortInPlace: (loc_id, source_map, _platformDef, T, T2) => (array, by) => {
|
|
2061
|
-
if (
|
|
2062
|
-
throw new EastError(
|
|
2066
|
+
if (isFrozenValue(array)) {
|
|
2067
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2063
2068
|
}
|
|
2064
2069
|
if ((iterationLocks.get(array) || 0) > 0) {
|
|
2065
2070
|
throw new EastError("Cannot modify Array during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2079,8 +2084,8 @@ const builtin_evaluators = {
|
|
|
2079
2084
|
return null;
|
|
2080
2085
|
},
|
|
2081
2086
|
ArrayReverseInPlace: (loc_id, source_map, _platformDef, _T) => (array) => {
|
|
2082
|
-
if (
|
|
2083
|
-
throw new EastError(
|
|
2087
|
+
if (isFrozenValue(array)) {
|
|
2088
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2084
2089
|
}
|
|
2085
2090
|
if ((iterationLocks.get(array) || 0) > 0) {
|
|
2086
2091
|
throw new EastError("Cannot modify Array during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2347,6 +2352,21 @@ const builtin_evaluators = {
|
|
|
2347
2352
|
unlockForIteration(array);
|
|
2348
2353
|
}
|
|
2349
2354
|
},
|
|
2355
|
+
ArrayScan: (loc_id, source_map, _platformDef, _T, _T2) => (array, init, f) => {
|
|
2356
|
+
lockForIteration(array);
|
|
2357
|
+
try {
|
|
2358
|
+
const result = [];
|
|
2359
|
+
let acc = init;
|
|
2360
|
+
for (let i = 0; i < array.length; i++) {
|
|
2361
|
+
acc = call_function(loc_id, source_map, f, acc, array[i], BigInt(i));
|
|
2362
|
+
result.push(acc);
|
|
2363
|
+
}
|
|
2364
|
+
return result;
|
|
2365
|
+
}
|
|
2366
|
+
finally {
|
|
2367
|
+
unlockForIteration(array);
|
|
2368
|
+
}
|
|
2369
|
+
},
|
|
2350
2370
|
ArrayMapReduce: (loc_id, source_map, _platformDef, _T, _T2) => (array, mapFn, reduceFn) => {
|
|
2351
2371
|
if (array.length === 0) {
|
|
2352
2372
|
throw new EastError("Cannot reduce empty array with no initial value", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2502,8 +2522,8 @@ const builtin_evaluators = {
|
|
|
2502
2522
|
SetInsert: (loc_id, source_map, _platformDef, K) => {
|
|
2503
2523
|
const print = printFor(K);
|
|
2504
2524
|
return (s, key) => {
|
|
2505
|
-
if (
|
|
2506
|
-
throw new EastError(
|
|
2525
|
+
if (isFrozenValue(s)) {
|
|
2526
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2507
2527
|
}
|
|
2508
2528
|
if ((iterationLocks.get(s) || 0) > 0) {
|
|
2509
2529
|
throw new EastError("Cannot modify Set during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2517,8 +2537,8 @@ const builtin_evaluators = {
|
|
|
2517
2537
|
};
|
|
2518
2538
|
},
|
|
2519
2539
|
SetTryInsert: (loc_id, source_map, _platformDef, _K) => (s, key) => {
|
|
2520
|
-
if (
|
|
2521
|
-
throw new EastError(
|
|
2540
|
+
if (isFrozenValue(s)) {
|
|
2541
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2522
2542
|
}
|
|
2523
2543
|
if ((iterationLocks.get(s) || 0) > 0) {
|
|
2524
2544
|
throw new EastError("Cannot modify Set during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2530,8 +2550,8 @@ const builtin_evaluators = {
|
|
|
2530
2550
|
SetDelete: (loc_id, source_map, _platformDef, K) => {
|
|
2531
2551
|
const print = printFor(K);
|
|
2532
2552
|
return (s, key) => {
|
|
2533
|
-
if (
|
|
2534
|
-
throw new EastError(
|
|
2553
|
+
if (isFrozenValue(s)) {
|
|
2554
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2535
2555
|
}
|
|
2536
2556
|
if ((iterationLocks.get(s) || 0) > 0) {
|
|
2537
2557
|
throw new EastError("Cannot modify Set during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2543,8 +2563,8 @@ const builtin_evaluators = {
|
|
|
2543
2563
|
};
|
|
2544
2564
|
},
|
|
2545
2565
|
SetTryDelete: (loc_id, source_map, _platformDef, _K) => (s, key) => {
|
|
2546
|
-
if (
|
|
2547
|
-
throw new EastError(
|
|
2566
|
+
if (isFrozenValue(s)) {
|
|
2567
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2548
2568
|
}
|
|
2549
2569
|
if ((iterationLocks.get(s) || 0) > 0) {
|
|
2550
2570
|
throw new EastError("Cannot modify Set during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2552,8 +2572,8 @@ const builtin_evaluators = {
|
|
|
2552
2572
|
return s.delete(key);
|
|
2553
2573
|
},
|
|
2554
2574
|
SetClear: (loc_id, source_map, _platformDef, _K) => (s) => {
|
|
2555
|
-
if (
|
|
2556
|
-
throw new EastError(
|
|
2575
|
+
if (isFrozenValue(s)) {
|
|
2576
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2557
2577
|
}
|
|
2558
2578
|
if ((iterationLocks.get(s) || 0) > 0) {
|
|
2559
2579
|
throw new EastError("Cannot modify Set during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2562,8 +2582,8 @@ const builtin_evaluators = {
|
|
|
2562
2582
|
return null;
|
|
2563
2583
|
},
|
|
2564
2584
|
SetUnionInPlace: (loc_id, source_map, _platformDef, _K) => (s1, s2) => {
|
|
2565
|
-
if (
|
|
2566
|
-
throw new EastError(
|
|
2585
|
+
if (isFrozenValue(s1)) {
|
|
2586
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2567
2587
|
}
|
|
2568
2588
|
if ((iterationLocks.get(s1) || 0) > 0) {
|
|
2569
2589
|
throw new EastError("Cannot modify Set during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2697,6 +2717,21 @@ const builtin_evaluators = {
|
|
|
2697
2717
|
unlockForIteration(s);
|
|
2698
2718
|
}
|
|
2699
2719
|
},
|
|
2720
|
+
SetScan: (loc_id, source_map, _platformDef, _K, _T2) => (s, f, init) => {
|
|
2721
|
+
const result = [];
|
|
2722
|
+
let acc = init;
|
|
2723
|
+
lockForIteration(s);
|
|
2724
|
+
try {
|
|
2725
|
+
for (const x of s) {
|
|
2726
|
+
acc = call_function(loc_id, source_map, f, acc, x);
|
|
2727
|
+
result.push(acc);
|
|
2728
|
+
}
|
|
2729
|
+
return result;
|
|
2730
|
+
}
|
|
2731
|
+
finally {
|
|
2732
|
+
unlockForIteration(s);
|
|
2733
|
+
}
|
|
2734
|
+
},
|
|
2700
2735
|
SetToArray: (loc_id, source_map, _platformDef, _K, _T2) => (s, valueFn) => {
|
|
2701
2736
|
const ret = [];
|
|
2702
2737
|
lockForIteration(s);
|
|
@@ -2889,8 +2924,8 @@ const builtin_evaluators = {
|
|
|
2889
2924
|
DictInsert: (loc_id, source_map, _platformDef, K, _V) => {
|
|
2890
2925
|
const print = printFor(K);
|
|
2891
2926
|
return (d, key, value) => {
|
|
2892
|
-
if (
|
|
2893
|
-
throw new EastError(
|
|
2927
|
+
if (isFrozenValue(d)) {
|
|
2928
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2894
2929
|
}
|
|
2895
2930
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
2896
2931
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2906,8 +2941,8 @@ const builtin_evaluators = {
|
|
|
2906
2941
|
};
|
|
2907
2942
|
},
|
|
2908
2943
|
DictGetOrInsert: (loc_id, source_map, _platformDef, _K, _V) => (d, key, onMissing) => {
|
|
2909
|
-
if (
|
|
2910
|
-
throw new EastError(
|
|
2944
|
+
if (isFrozenValue(d)) {
|
|
2945
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2911
2946
|
}
|
|
2912
2947
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
2913
2948
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2923,8 +2958,8 @@ const builtin_evaluators = {
|
|
|
2923
2958
|
}
|
|
2924
2959
|
},
|
|
2925
2960
|
DictInsertOrUpdate: (loc_id, source_map, _platformDef, _K, _V) => (d, key, value, onConflictFn) => {
|
|
2926
|
-
if (
|
|
2927
|
-
throw new EastError(
|
|
2961
|
+
if (isFrozenValue(d)) {
|
|
2962
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2928
2963
|
}
|
|
2929
2964
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
2930
2965
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2942,8 +2977,8 @@ const builtin_evaluators = {
|
|
|
2942
2977
|
DictUpdate: (loc_id, source_map, _platformDef, K, _V) => {
|
|
2943
2978
|
const print = printFor(K);
|
|
2944
2979
|
return (d, key, value) => {
|
|
2945
|
-
if (
|
|
2946
|
-
throw new EastError(
|
|
2980
|
+
if (isFrozenValue(d)) {
|
|
2981
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2947
2982
|
}
|
|
2948
2983
|
if (d.has(key)) {
|
|
2949
2984
|
d.set(key, value);
|
|
@@ -2957,8 +2992,8 @@ const builtin_evaluators = {
|
|
|
2957
2992
|
DictSwap: (loc_id, source_map, _platformDef, K, _V) => {
|
|
2958
2993
|
const print = printFor(K);
|
|
2959
2994
|
return (d, key, value) => {
|
|
2960
|
-
if (
|
|
2961
|
-
throw new EastError(
|
|
2995
|
+
if (isFrozenValue(d)) {
|
|
2996
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2962
2997
|
}
|
|
2963
2998
|
let existing = d.get(key);
|
|
2964
2999
|
if (existing === undefined) {
|
|
@@ -2969,8 +3004,8 @@ const builtin_evaluators = {
|
|
|
2969
3004
|
};
|
|
2970
3005
|
},
|
|
2971
3006
|
DictMerge: (loc_id, source_map, _platformDef, _K, _V) => (d, key, value, mergeFn, initialFn) => {
|
|
2972
|
-
if (
|
|
2973
|
-
throw new EastError(
|
|
3007
|
+
if (isFrozenValue(d)) {
|
|
3008
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2974
3009
|
}
|
|
2975
3010
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
2976
3011
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2986,8 +3021,8 @@ const builtin_evaluators = {
|
|
|
2986
3021
|
DictDelete: (loc_id, source_map, _platformDef, K, _V) => {
|
|
2987
3022
|
const print = printFor(K);
|
|
2988
3023
|
return (d, key) => {
|
|
2989
|
-
if (
|
|
2990
|
-
throw new EastError(
|
|
3024
|
+
if (isFrozenValue(d)) {
|
|
3025
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2991
3026
|
}
|
|
2992
3027
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
2993
3028
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -3000,8 +3035,8 @@ const builtin_evaluators = {
|
|
|
3000
3035
|
};
|
|
3001
3036
|
},
|
|
3002
3037
|
DictTryDelete: (loc_id, source_map, _platformDef, _K, _V) => (d, key) => {
|
|
3003
|
-
if (
|
|
3004
|
-
throw new EastError(
|
|
3038
|
+
if (isFrozenValue(d)) {
|
|
3039
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
3005
3040
|
}
|
|
3006
3041
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
3007
3042
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -3011,8 +3046,8 @@ const builtin_evaluators = {
|
|
|
3011
3046
|
DictPop: (loc_id, source_map, _platformDef, K, _V) => {
|
|
3012
3047
|
const print = printFor(K);
|
|
3013
3048
|
return (d, key) => {
|
|
3014
|
-
if (
|
|
3015
|
-
throw new EastError(
|
|
3049
|
+
if (isFrozenValue(d)) {
|
|
3050
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
3016
3051
|
}
|
|
3017
3052
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
3018
3053
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -3028,8 +3063,8 @@ const builtin_evaluators = {
|
|
|
3028
3063
|
};
|
|
3029
3064
|
},
|
|
3030
3065
|
DictClear: (loc_id, source_map, _platformDef, _K, _V) => (d) => {
|
|
3031
|
-
if (
|
|
3032
|
-
throw new EastError(
|
|
3066
|
+
if (isFrozenValue(d)) {
|
|
3067
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
3033
3068
|
}
|
|
3034
3069
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
3035
3070
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -3038,8 +3073,8 @@ const builtin_evaluators = {
|
|
|
3038
3073
|
return null;
|
|
3039
3074
|
},
|
|
3040
3075
|
DictUnionInPlace: (loc_id, source_map, _platformDef, _K, _V) => (d1, d2, onConflict) => {
|
|
3041
|
-
if (
|
|
3042
|
-
throw new EastError(
|
|
3076
|
+
if (isFrozenValue(d1)) {
|
|
3077
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
3043
3078
|
}
|
|
3044
3079
|
if ((iterationLocks.get(d1) || 0) > 0) {
|
|
3045
3080
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -3057,8 +3092,8 @@ const builtin_evaluators = {
|
|
|
3057
3092
|
return null;
|
|
3058
3093
|
},
|
|
3059
3094
|
DictMergeAll: (loc_id, source_map, _platformDef, _K, _V) => (d1, d2, mergeFn, initialFn) => {
|
|
3060
|
-
if (
|
|
3061
|
-
throw new EastError(
|
|
3095
|
+
if (isFrozenValue(d1)) {
|
|
3096
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
3062
3097
|
}
|
|
3063
3098
|
if ((iterationLocks.get(d1) || 0) > 0) {
|
|
3064
3099
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -3216,6 +3251,21 @@ const builtin_evaluators = {
|
|
|
3216
3251
|
unlockForIteration(d);
|
|
3217
3252
|
}
|
|
3218
3253
|
},
|
|
3254
|
+
DictScan: (loc_id, source_map, _platformDef, _K, _V, _T2) => (d, f, init) => {
|
|
3255
|
+
const result = [];
|
|
3256
|
+
let acc = init;
|
|
3257
|
+
lockForIteration(d);
|
|
3258
|
+
try {
|
|
3259
|
+
for (const [k, v] of d) {
|
|
3260
|
+
acc = call_function(loc_id, source_map, f, acc, v, k);
|
|
3261
|
+
result.push(acc);
|
|
3262
|
+
}
|
|
3263
|
+
return result;
|
|
3264
|
+
}
|
|
3265
|
+
finally {
|
|
3266
|
+
unlockForIteration(d);
|
|
3267
|
+
}
|
|
3268
|
+
},
|
|
3219
3269
|
DictToArray: (loc_id, source_map, _platformDef, _K, _V, _T2) => (d, valueFn) => {
|
|
3220
3270
|
const ret = [];
|
|
3221
3271
|
lockForIteration(d);
|