@zvenigora/ng-eval-core 0.11.0 → 0.11.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 +40 -2
- package/README.md +3 -1
- package/fesm2022/zvenigora-ng-eval-core.mjs +86 -146
- package/fesm2022/zvenigora-ng-eval-core.mjs.map +1 -1
- package/package.json +1 -1
- package/types/zvenigora-ng-eval-core.d.ts +26 -14
package/package.json
CHANGED
|
@@ -673,8 +673,8 @@ declare class EvalContext {
|
|
|
673
673
|
*/
|
|
674
674
|
get(key: unknown): unknown | undefined;
|
|
675
675
|
/**
|
|
676
|
-
* Step 1 of {@link get}'s resolution order on its own: the
|
|
677
|
-
*
|
|
676
|
+
* Step 1 of {@link get}'s resolution order on its own: the scope stack,
|
|
677
|
+
* innermost first, whoever pushed each scope.
|
|
678
678
|
*
|
|
679
679
|
* {@link get} calls this rather than inlining the loop, so that the read
|
|
680
680
|
* hooks' `scoped` flag and the resolution it describes are the *same*
|
|
@@ -738,8 +738,11 @@ declare class EvalContext {
|
|
|
738
738
|
*/
|
|
739
739
|
scopeHolding(key: unknown): Context | undefined;
|
|
740
740
|
/**
|
|
741
|
-
* Whether any scope
|
|
742
|
-
*
|
|
741
|
+
* Whether any scope on the scope stack *binds* the key - the question the
|
|
742
|
+
* read hooks' `scoped` flag asks. Every scope on the stack counts, whoever
|
|
743
|
+
* pushed it: an arrow call's parameters, the lexical scope of a program, a
|
|
744
|
+
* block or a `for` loop, and a scope a caller pushed with {@link push}
|
|
745
|
+
* before the walk.
|
|
743
746
|
*
|
|
744
747
|
* Deliberately about binding rather than about value. It no longer parts
|
|
745
748
|
* company with {@link getFromScopes} over it: both go through
|
|
@@ -1449,10 +1452,13 @@ interface EvalReadEvent {
|
|
|
1449
1452
|
readonly path?: string;
|
|
1450
1453
|
readonly value: unknown;
|
|
1451
1454
|
/**
|
|
1452
|
-
* True when
|
|
1453
|
-
* `EvalContext.
|
|
1454
|
-
*
|
|
1455
|
-
*
|
|
1455
|
+
* True when a scope on the context's scope stack - `EvalContext.scopes`,
|
|
1456
|
+
* asked through `EvalContext.hasInScopes` - binds the name when it is read,
|
|
1457
|
+
* whoever pushed that scope. That covers an arrow-function parameter, a
|
|
1458
|
+
* declaration in the lexical scope the evaluator pushes for a program, a
|
|
1459
|
+
* block or a `for` loop, and a binding the caller pushed with
|
|
1460
|
+
* `EvalContext.push` before the walk. Such a read is a binding, not a
|
|
1461
|
+
* dependency, and a tracker should skip it.
|
|
1456
1462
|
*
|
|
1457
1463
|
* The definition is **lifetime, not type**: caller-registered `priorScopes`
|
|
1458
1464
|
* are `EvalScope` instances holding long-lived objects and are real
|
|
@@ -2080,9 +2086,11 @@ interface EvalDependencyTracker {
|
|
|
2080
2086
|
* rules do the filtering:
|
|
2081
2087
|
*
|
|
2082
2088
|
* 1. **Scope bindings are not dependencies.** A read flagged `scoped` resolved
|
|
2083
|
-
* from a scope
|
|
2084
|
-
*
|
|
2085
|
-
*
|
|
2089
|
+
* from a scope on the context's scope stack, whoever pushed it - an
|
|
2090
|
+
* arrow-function parameter, a declaration in a program, block or `for`
|
|
2091
|
+
* scope, or a binding the caller pushed before the walk. Only the walker
|
|
2092
|
+
* can tell one from a real context read, which is why the flag exists; a
|
|
2093
|
+
* consumer using this tracker inherits the filtering for free.
|
|
2086
2094
|
* 2. **Nor is anything reached *through* one.** `item` being a binding makes
|
|
2087
2095
|
* `item.name` one too, and that read carries no flag of its own: `scoped` is
|
|
2088
2096
|
* set at identifier resolution, and the member hop resolves against the
|
|
@@ -2403,7 +2411,8 @@ declare class CompilerService extends BaseEval implements OnDestroy {
|
|
|
2403
2411
|
*/
|
|
2404
2412
|
private cleanupCache;
|
|
2405
2413
|
/**
|
|
2406
|
-
* Generate cache key for expression
|
|
2414
|
+
* Generate cache key for expression. Only a string is cached, so only a
|
|
2415
|
+
* string has a key.
|
|
2407
2416
|
*/
|
|
2408
2417
|
private generateCacheKey;
|
|
2409
2418
|
/**
|
|
@@ -2411,7 +2420,8 @@ declare class CompilerService extends BaseEval implements OnDestroy {
|
|
|
2411
2420
|
*/
|
|
2412
2421
|
private updateAccessOrder;
|
|
2413
2422
|
/**
|
|
2414
|
-
* Compiles the given expression into a state callback function
|
|
2423
|
+
* Compiles the given expression into a state callback function. A string is
|
|
2424
|
+
* compiled once and cached; an AST is compiled on every call.
|
|
2415
2425
|
* @param expression - The expression to compile.
|
|
2416
2426
|
* @returns The compiled state callback function.
|
|
2417
2427
|
* @throws Error if there is an error during compilation.
|
|
@@ -2436,7 +2446,9 @@ declare class CompilerService extends BaseEval implements OnDestroy {
|
|
|
2436
2446
|
*/
|
|
2437
2447
|
call(fn: stateCallback | undefined, state: EvalState): unknown;
|
|
2438
2448
|
/**
|
|
2439
|
-
* Compiles the given expression into an asynchronous state callback
|
|
2449
|
+
* Compiles the given expression into an asynchronous state callback
|
|
2450
|
+
* function. A string is compiled once and cached; an AST is compiled on
|
|
2451
|
+
* every call.
|
|
2440
2452
|
* @param expression - The expression to compile.
|
|
2441
2453
|
* @returns The compiled asynchronous state callback function.
|
|
2442
2454
|
* @throws Error if there is an error during compilation.
|