@elaraai/east 1.0.61 → 1.0.63
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/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 +69 -64
- package/dist/src/compile.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/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/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) ?? []) });
|
|
@@ -2517,8 +2522,8 @@ const builtin_evaluators = {
|
|
|
2517
2522
|
SetInsert: (loc_id, source_map, _platformDef, K) => {
|
|
2518
2523
|
const print = printFor(K);
|
|
2519
2524
|
return (s, key) => {
|
|
2520
|
-
if (
|
|
2521
|
-
throw new EastError(
|
|
2525
|
+
if (isFrozenValue(s)) {
|
|
2526
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2522
2527
|
}
|
|
2523
2528
|
if ((iterationLocks.get(s) || 0) > 0) {
|
|
2524
2529
|
throw new EastError("Cannot modify Set during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2532,8 +2537,8 @@ const builtin_evaluators = {
|
|
|
2532
2537
|
};
|
|
2533
2538
|
},
|
|
2534
2539
|
SetTryInsert: (loc_id, source_map, _platformDef, _K) => (s, key) => {
|
|
2535
|
-
if (
|
|
2536
|
-
throw new EastError(
|
|
2540
|
+
if (isFrozenValue(s)) {
|
|
2541
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2537
2542
|
}
|
|
2538
2543
|
if ((iterationLocks.get(s) || 0) > 0) {
|
|
2539
2544
|
throw new EastError("Cannot modify Set during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2545,8 +2550,8 @@ const builtin_evaluators = {
|
|
|
2545
2550
|
SetDelete: (loc_id, source_map, _platformDef, K) => {
|
|
2546
2551
|
const print = printFor(K);
|
|
2547
2552
|
return (s, key) => {
|
|
2548
|
-
if (
|
|
2549
|
-
throw new EastError(
|
|
2553
|
+
if (isFrozenValue(s)) {
|
|
2554
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2550
2555
|
}
|
|
2551
2556
|
if ((iterationLocks.get(s) || 0) > 0) {
|
|
2552
2557
|
throw new EastError("Cannot modify Set during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2558,8 +2563,8 @@ const builtin_evaluators = {
|
|
|
2558
2563
|
};
|
|
2559
2564
|
},
|
|
2560
2565
|
SetTryDelete: (loc_id, source_map, _platformDef, _K) => (s, key) => {
|
|
2561
|
-
if (
|
|
2562
|
-
throw new EastError(
|
|
2566
|
+
if (isFrozenValue(s)) {
|
|
2567
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2563
2568
|
}
|
|
2564
2569
|
if ((iterationLocks.get(s) || 0) > 0) {
|
|
2565
2570
|
throw new EastError("Cannot modify Set during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2567,8 +2572,8 @@ const builtin_evaluators = {
|
|
|
2567
2572
|
return s.delete(key);
|
|
2568
2573
|
},
|
|
2569
2574
|
SetClear: (loc_id, source_map, _platformDef, _K) => (s) => {
|
|
2570
|
-
if (
|
|
2571
|
-
throw new EastError(
|
|
2575
|
+
if (isFrozenValue(s)) {
|
|
2576
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2572
2577
|
}
|
|
2573
2578
|
if ((iterationLocks.get(s) || 0) > 0) {
|
|
2574
2579
|
throw new EastError("Cannot modify Set during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2577,8 +2582,8 @@ const builtin_evaluators = {
|
|
|
2577
2582
|
return null;
|
|
2578
2583
|
},
|
|
2579
2584
|
SetUnionInPlace: (loc_id, source_map, _platformDef, _K) => (s1, s2) => {
|
|
2580
|
-
if (
|
|
2581
|
-
throw new EastError(
|
|
2585
|
+
if (isFrozenValue(s1)) {
|
|
2586
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2582
2587
|
}
|
|
2583
2588
|
if ((iterationLocks.get(s1) || 0) > 0) {
|
|
2584
2589
|
throw new EastError("Cannot modify Set during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2919,8 +2924,8 @@ const builtin_evaluators = {
|
|
|
2919
2924
|
DictInsert: (loc_id, source_map, _platformDef, K, _V) => {
|
|
2920
2925
|
const print = printFor(K);
|
|
2921
2926
|
return (d, key, value) => {
|
|
2922
|
-
if (
|
|
2923
|
-
throw new EastError(
|
|
2927
|
+
if (isFrozenValue(d)) {
|
|
2928
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2924
2929
|
}
|
|
2925
2930
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
2926
2931
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2936,8 +2941,8 @@ const builtin_evaluators = {
|
|
|
2936
2941
|
};
|
|
2937
2942
|
},
|
|
2938
2943
|
DictGetOrInsert: (loc_id, source_map, _platformDef, _K, _V) => (d, key, onMissing) => {
|
|
2939
|
-
if (
|
|
2940
|
-
throw new EastError(
|
|
2944
|
+
if (isFrozenValue(d)) {
|
|
2945
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2941
2946
|
}
|
|
2942
2947
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
2943
2948
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2953,8 +2958,8 @@ const builtin_evaluators = {
|
|
|
2953
2958
|
}
|
|
2954
2959
|
},
|
|
2955
2960
|
DictInsertOrUpdate: (loc_id, source_map, _platformDef, _K, _V) => (d, key, value, onConflictFn) => {
|
|
2956
|
-
if (
|
|
2957
|
-
throw new EastError(
|
|
2961
|
+
if (isFrozenValue(d)) {
|
|
2962
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2958
2963
|
}
|
|
2959
2964
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
2960
2965
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -2972,8 +2977,8 @@ const builtin_evaluators = {
|
|
|
2972
2977
|
DictUpdate: (loc_id, source_map, _platformDef, K, _V) => {
|
|
2973
2978
|
const print = printFor(K);
|
|
2974
2979
|
return (d, key, value) => {
|
|
2975
|
-
if (
|
|
2976
|
-
throw new EastError(
|
|
2980
|
+
if (isFrozenValue(d)) {
|
|
2981
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2977
2982
|
}
|
|
2978
2983
|
if (d.has(key)) {
|
|
2979
2984
|
d.set(key, value);
|
|
@@ -2987,8 +2992,8 @@ const builtin_evaluators = {
|
|
|
2987
2992
|
DictSwap: (loc_id, source_map, _platformDef, K, _V) => {
|
|
2988
2993
|
const print = printFor(K);
|
|
2989
2994
|
return (d, key, value) => {
|
|
2990
|
-
if (
|
|
2991
|
-
throw new EastError(
|
|
2995
|
+
if (isFrozenValue(d)) {
|
|
2996
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
2992
2997
|
}
|
|
2993
2998
|
let existing = d.get(key);
|
|
2994
2999
|
if (existing === undefined) {
|
|
@@ -2999,8 +3004,8 @@ const builtin_evaluators = {
|
|
|
2999
3004
|
};
|
|
3000
3005
|
},
|
|
3001
3006
|
DictMerge: (loc_id, source_map, _platformDef, _K, _V) => (d, key, value, mergeFn, initialFn) => {
|
|
3002
|
-
if (
|
|
3003
|
-
throw new EastError(
|
|
3007
|
+
if (isFrozenValue(d)) {
|
|
3008
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
3004
3009
|
}
|
|
3005
3010
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
3006
3011
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -3016,8 +3021,8 @@ const builtin_evaluators = {
|
|
|
3016
3021
|
DictDelete: (loc_id, source_map, _platformDef, K, _V) => {
|
|
3017
3022
|
const print = printFor(K);
|
|
3018
3023
|
return (d, key) => {
|
|
3019
|
-
if (
|
|
3020
|
-
throw new EastError(
|
|
3024
|
+
if (isFrozenValue(d)) {
|
|
3025
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
3021
3026
|
}
|
|
3022
3027
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
3023
3028
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -3030,8 +3035,8 @@ const builtin_evaluators = {
|
|
|
3030
3035
|
};
|
|
3031
3036
|
},
|
|
3032
3037
|
DictTryDelete: (loc_id, source_map, _platformDef, _K, _V) => (d, key) => {
|
|
3033
|
-
if (
|
|
3034
|
-
throw new EastError(
|
|
3038
|
+
if (isFrozenValue(d)) {
|
|
3039
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
3035
3040
|
}
|
|
3036
3041
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
3037
3042
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -3041,8 +3046,8 @@ const builtin_evaluators = {
|
|
|
3041
3046
|
DictPop: (loc_id, source_map, _platformDef, K, _V) => {
|
|
3042
3047
|
const print = printFor(K);
|
|
3043
3048
|
return (d, key) => {
|
|
3044
|
-
if (
|
|
3045
|
-
throw new EastError(
|
|
3049
|
+
if (isFrozenValue(d)) {
|
|
3050
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
3046
3051
|
}
|
|
3047
3052
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
3048
3053
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -3058,8 +3063,8 @@ const builtin_evaluators = {
|
|
|
3058
3063
|
};
|
|
3059
3064
|
},
|
|
3060
3065
|
DictClear: (loc_id, source_map, _platformDef, _K, _V) => (d) => {
|
|
3061
|
-
if (
|
|
3062
|
-
throw new EastError(
|
|
3066
|
+
if (isFrozenValue(d)) {
|
|
3067
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
3063
3068
|
}
|
|
3064
3069
|
if ((iterationLocks.get(d) || 0) > 0) {
|
|
3065
3070
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -3068,8 +3073,8 @@ const builtin_evaluators = {
|
|
|
3068
3073
|
return null;
|
|
3069
3074
|
},
|
|
3070
3075
|
DictUnionInPlace: (loc_id, source_map, _platformDef, _K, _V) => (d1, d2, onConflict) => {
|
|
3071
|
-
if (
|
|
3072
|
-
throw new EastError(
|
|
3076
|
+
if (isFrozenValue(d1)) {
|
|
3077
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
3073
3078
|
}
|
|
3074
3079
|
if ((iterationLocks.get(d1) || 0) > 0) {
|
|
3075
3080
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|
|
@@ -3087,8 +3092,8 @@ const builtin_evaluators = {
|
|
|
3087
3092
|
return null;
|
|
3088
3093
|
},
|
|
3089
3094
|
DictMergeAll: (loc_id, source_map, _platformDef, _K, _V) => (d1, d2, mergeFn, initialFn) => {
|
|
3090
|
-
if (
|
|
3091
|
-
throw new EastError(
|
|
3095
|
+
if (isFrozenValue(d1)) {
|
|
3096
|
+
throw new EastError(FROZEN_MESSAGE, { location: (source_map?.resolve(loc_id) ?? []) });
|
|
3092
3097
|
}
|
|
3093
3098
|
if ((iterationLocks.get(d1) || 0) > 0) {
|
|
3094
3099
|
throw new EastError("Cannot modify Dict during iteration", { location: (source_map?.resolve(loc_id) ?? []) });
|