@zvenigora/ng-eval-core 0.14.0 → 0.14.1
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/CHANGELOG.md
CHANGED
|
@@ -14,7 +14,47 @@ Versions 0.1.104–0.1.107 are on npm without entries here.
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
## [0.14.
|
|
17
|
+
## [0.14.1] - 2026-10-30
|
|
18
|
+
|
|
19
|
+
**A patch that fixes [A47](../../docs/backlog-retired.md#a47)**, an arrow's parameter scope under
|
|
20
|
+
`caseInsensitive`, with three changes that are documentation only; the `.d.ts` differs from
|
|
21
|
+
0.14.0's only in the JSDoc of `ParserService.parserOptions`
|
|
22
|
+
([A30](../../docs/backlog-retired.md#a30)).
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- The internal `contextPush`'s JSDoc says what every scope push site does since
|
|
26
|
+
[A42](../../docs/backlog-retired.md#a42): it calls `contextPush(st.context, …)`, its pop runs in
|
|
27
|
+
a `finally`, and both no-op on an absent context. It said each site wrote `st.context?.push(...)`
|
|
28
|
+
([F27](../../docs/backlog-retired.md#f27)). Documentation only: the comment reaches the bundle,
|
|
29
|
+
not the `.d.ts`.
|
|
30
|
+
- The disabled visitor result cache is deleted ([A32](../../docs/backlog-retired.md#a32)). Nothing
|
|
31
|
+
called it or exported it. Documentation only: the bundle loses the commented-out import and call
|
|
32
|
+
sites in the binary and member visitors, and no code; the `.d.ts` is unchanged.
|
|
33
|
+
- `ParserService.parserOptions`' JSDoc says what the setter configures
|
|
34
|
+
([A30](../../docs/backlog-retired.md#a30)): direct `ParserService.parse` calls, whose own options'
|
|
35
|
+
keys win, but for `cacheSize`. `EvalService`, `CompilerService` and `DiscoveryService` pass their
|
|
36
|
+
own options on every parse, which carry every key of `defaultParserOptions`, so only `cacheSize`
|
|
37
|
+
and a key it does not carry, such as `colonIdentifiers`, reach them through the setter.
|
|
38
|
+
`cacheSize` is read from the setter's value alone: it sizes the parse cache once, at
|
|
39
|
+
construction, and a later falsy one stops every parse using the cache, the services' included,
|
|
40
|
+
while a call's or a service's own `cacheSize` changes nothing. No behaviour changes.
|
|
41
|
+
Documentation only: the JSDoc reaches the `.d.ts` and the bundle.
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
- **Under `caseInsensitive`, an arrow's parameters are matched case-insensitively**, as a `let`
|
|
45
|
+
or `const` already was: `(x => X)(1)` gives `1` and `(({ a }) => A)({ a: 4 })` gives `4`, where
|
|
46
|
+
each gave `undefined`, or the context's own value when the context held the name in any
|
|
47
|
+
spelling: over `{ x: 10 }`, `(x => X)(1)` gave `10`. Such a read is now a scope read, so a
|
|
48
|
+
dependency tracker no longer records it as a dependency, where it recorded `X`. A case-variant
|
|
49
|
+
write reaches the parameter, not the caller's context:
|
|
50
|
+
`(x => (X = 5, x))(1)` over `{}` gives `5` and leaves the context empty, where it gave `1` and
|
|
51
|
+
wrote a key `X` there. A case-variant write to a parameter named like a literal,
|
|
52
|
+
`(TRUE => (True = 2))(1)`, writes the parameter, where since 0.13.2 it threw
|
|
53
|
+
`Assignment to read-only name` ([A47](../../docs/backlog-retired.md#a47)).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## [0.14.0] - 2026-10-26
|
|
18
58
|
|
|
19
59
|
**An assignment evaluates its target as JavaScript does.** A minor carrying breaking changes
|
|
20
60
|
([A45](../../docs/backlog-retired.md#a45) part 2, [A44](../../docs/backlog-retired.md#a44),
|
|
@@ -1279,7 +1279,6 @@ const refuseThisValue = (node) => {
|
|
|
1279
1279
|
}
|
|
1280
1280
|
};
|
|
1281
1281
|
|
|
1282
|
-
// import { getCachedVisitorResult, setCachedVisitorResult } from './visitor-result-cache';
|
|
1283
1282
|
/**
|
|
1284
1283
|
* Reconstructs the dotted source path of a member chain (`a.b.c`).
|
|
1285
1284
|
*
|
|
@@ -1328,16 +1327,7 @@ const readPath = (node) => {
|
|
|
1328
1327
|
*/
|
|
1329
1328
|
const memberExpressionVisitor = (node, st, callback) => {
|
|
1330
1329
|
beforeVisitor(node, st);
|
|
1331
|
-
// Disable visitor result caching for now due to context sensitivity issues
|
|
1332
|
-
// const cachedResult = getCachedVisitorResult(node, st.context);
|
|
1333
|
-
// if (cachedResult !== undefined) {
|
|
1334
|
-
// pushVisitorResult(node, st, cachedResult);
|
|
1335
|
-
// afterVisitor(node, st);
|
|
1336
|
-
// return;
|
|
1337
|
-
// }
|
|
1338
1330
|
const [, , value] = evaluateMember(node, st, callback);
|
|
1339
|
-
// Disable visitor result caching for now
|
|
1340
|
-
// setCachedVisitorResult(node, st.context, value);
|
|
1341
1331
|
pushVisitorResult(node, st, value);
|
|
1342
1332
|
afterVisitor(node, st);
|
|
1343
1333
|
};
|
|
@@ -1767,10 +1757,11 @@ const contextSetInScope = (context, key, value) => methodOf(context, 'setInScope
|
|
|
1767
1757
|
* `EvalContext.push` as the class defines it, for a context that may be
|
|
1768
1758
|
* undefined.
|
|
1769
1759
|
*
|
|
1770
|
-
* The optional receiver is deliberate: every scope push in the evaluator
|
|
1771
|
-
*
|
|
1772
|
-
* `finally
|
|
1773
|
-
* context pushes nothing and pops nothing,
|
|
1760
|
+
* The optional receiver is deliberate: every scope push in the evaluator
|
|
1761
|
+
* calls `contextPush(st.context, ...)`, and its pop, `contextPop`, runs in the
|
|
1762
|
+
* `finally` of a `try` opened on the next line. Both wrappers no-op on an
|
|
1763
|
+
* absent context, so a walk with no context pushes nothing and pops nothing,
|
|
1764
|
+
* exactly as the `st.context?.push(...)` optional chain they replaced did.
|
|
1774
1765
|
*/
|
|
1775
1766
|
const contextPush = (context, scope, options) => {
|
|
1776
1767
|
if (!context) {
|
|
@@ -3113,7 +3104,6 @@ const literalVisitor = (node, st) => {
|
|
|
3113
3104
|
afterVisitor(node, st);
|
|
3114
3105
|
};
|
|
3115
3106
|
|
|
3116
|
-
// import { getCachedVisitorResult, setCachedVisitorResult } from './visitor-result-cache';
|
|
3117
3107
|
/**
|
|
3118
3108
|
* Converts value to primitive for comparison operations
|
|
3119
3109
|
*/
|
|
@@ -3260,20 +3250,11 @@ const evaluateBinaryOperation = (operator, left, right) => {
|
|
|
3260
3250
|
*/
|
|
3261
3251
|
const binaryExpressionVisitor = (node, st, callback) => {
|
|
3262
3252
|
beforeVisitor(node, st);
|
|
3263
|
-
// Disable visitor result caching for now due to context sensitivity issues
|
|
3264
|
-
// const cachedResult = getCachedVisitorResult(node, st.context);
|
|
3265
|
-
// if (cachedResult !== undefined) {
|
|
3266
|
-
// pushVisitorResult(node, st, cachedResult);
|
|
3267
|
-
// afterVisitor(node, st);
|
|
3268
|
-
// return;
|
|
3269
|
-
// }
|
|
3270
3253
|
callback(node.left, st);
|
|
3271
3254
|
const left = popVisitorResult(node, st);
|
|
3272
3255
|
callback(node.right, st);
|
|
3273
3256
|
const right = popVisitorResult(node, st);
|
|
3274
3257
|
const value = evaluateBinaryOperation(node.operator, left, right);
|
|
3275
|
-
// Disable visitor result caching for now
|
|
3276
|
-
// setCachedVisitorResult(node, st.context, value);
|
|
3277
3258
|
pushVisitorResult(node, st, value);
|
|
3278
3259
|
afterVisitor(node, st);
|
|
3279
3260
|
};
|
|
@@ -4902,7 +4883,7 @@ const arrowFunctionExpressionVisitor = (node, st, callback) => {
|
|
|
4902
4883
|
// and - since this closure's body is a re-entrant `evaluate` that pushes
|
|
4903
4884
|
// again - a plant that evaluates anything recurses until the stack is
|
|
4904
4885
|
// gone, leaving a reused context unusable (`docs/backlog.md` A42).
|
|
4905
|
-
contextPush(st.context, newContext);
|
|
4886
|
+
contextPush(st.context, newContext, st.options);
|
|
4906
4887
|
try {
|
|
4907
4888
|
return evaluate(node.body, st);
|
|
4908
4889
|
}
|
|
@@ -7426,13 +7407,31 @@ function provideColonIdentifiers() {
|
|
|
7426
7407
|
*/
|
|
7427
7408
|
class ParserService {
|
|
7428
7409
|
/**
|
|
7429
|
-
* Gets the parser options
|
|
7410
|
+
* Gets the parser options: the constructor's, or the last value given to
|
|
7411
|
+
* the setter.
|
|
7430
7412
|
*/
|
|
7431
7413
|
get parserOptions() {
|
|
7432
7414
|
return this._parserOptions;
|
|
7433
7415
|
}
|
|
7434
7416
|
/**
|
|
7435
|
-
* Sets the parser options.
|
|
7417
|
+
* Sets the parser options for direct `ParserService.parse` calls, which
|
|
7418
|
+
* merge the options they are given over this value, the call's key winning,
|
|
7419
|
+
* for every key but `cacheSize`.
|
|
7420
|
+
*
|
|
7421
|
+
* `EvalService`, `CompilerService` and `DiscoveryService` pass their own
|
|
7422
|
+
* options on every parse, and those carry every key of
|
|
7423
|
+
* `defaultParserOptions`, so for each of them the service's key wins over
|
|
7424
|
+
* this value, `cacheSize` again aside. Only `cacheSize` and a key
|
|
7425
|
+
* `defaultParserOptions` does not carry reach those services through the
|
|
7426
|
+
* setter: `colonIdentifiers` is the one the README relies on
|
|
7427
|
+
* (`docs/backlog-retired.md` A30).
|
|
7428
|
+
*
|
|
7429
|
+
* `cacheSize` is read from this value alone, never from a call's or a
|
|
7430
|
+
* service's options. It sizes the parse cache once, at construction, and a
|
|
7431
|
+
* later value does not resize it. Whether a parse uses the cache is read
|
|
7432
|
+
* from it on every parse, so a later falsy one stops every parse using the
|
|
7433
|
+
* cache, the services' included.
|
|
7434
|
+
*
|
|
7436
7435
|
* @param value The parser options to set.
|
|
7437
7436
|
*/
|
|
7438
7437
|
set parserOptions(value) {
|