@zvenigora/ng-eval-core 0.13.2 → 0.13.3
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
|
@@ -10,7 +10,16 @@ Versions 0.1.104–0.1.107 are on npm without entries here.
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
## [
|
|
13
|
+
## [0.13.3] - 2026-10-23
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- **A logical assignment that short-circuits no longer evaluates its right side or writes**:
|
|
17
|
+
`a ||= f()` with `a` truthy does not call `f`, and a write policy is not asked about a write that
|
|
18
|
+
does not happen. A refusal on the write path, such as a `const` binding or a read-only name, no
|
|
19
|
+
longer fires when the assignment short-circuits and writes nothing, as in JavaScript. Logical
|
|
20
|
+
assignment is ES2021, and the default parser options, at `ecmaVersion: 2020`, refuse it at the
|
|
21
|
+
parse, so this reaches only a caller whose own parser options set `ecmaVersion` to 2021 or later
|
|
22
|
+
([A45](../../docs/backlog.md#a45), part 1).
|
|
14
23
|
|
|
15
24
|
---
|
|
16
25
|
|
|
@@ -4043,6 +4043,17 @@ const assignmentExpressionVisitor = (node, st, callback) => {
|
|
|
4043
4043
|
}
|
|
4044
4044
|
callback(node.left, st);
|
|
4045
4045
|
const left = popVisitorResult(node, st);
|
|
4046
|
+
// A logical assignment that short-circuits gives `left` and does nothing
|
|
4047
|
+
// more: its right side is not evaluated and nothing is written, so no write
|
|
4048
|
+
// policy is asked (`docs/backlog.md` A45, part 1). The rule is
|
|
4049
|
+
// `logical-expression.ts`'s, for `||`, `&&` and `??`.
|
|
4050
|
+
if ((node.operator === '||=' && left) ||
|
|
4051
|
+
(node.operator === '&&=' && !left) ||
|
|
4052
|
+
(node.operator === '??=' && left !== null && left !== undefined)) {
|
|
4053
|
+
pushVisitorResult(node, st, left);
|
|
4054
|
+
afterVisitor(node, st);
|
|
4055
|
+
return;
|
|
4056
|
+
}
|
|
4046
4057
|
callback(node.right, st);
|
|
4047
4058
|
const right = popVisitorResult(node, st);
|
|
4048
4059
|
const func = assignmentOperators[node.operator];
|