angular/packages/compiler
Kristiyan Kostadinov ce80136e7b fix(compiler): optimize away unnecessary restore/reset view calls
When producing a listener, the template pipeline does the following in separate phases:
1. Generates all the variables available within its scope.
2. Adds `restoreView` and `resetView` calls if there are any referenced to local variables (e.g. `@let` or local refs).
3. Optimizes away the variables that aren't used.

This means that we can end up in a situation where the references to the variables in the scope no longer exist, but we still enter and leave the view as if they're there which is unnecessary.

These changes add a simple optimization pass that looks specifically for the pattern of a `restoreView` followed by a `return resetView(expr)`. Furthermore, by changing the order of some optimizations, we're able to drop the `getCurrentView` variable as well.

Fixes #66286.
2026-01-20 10:22:55 -08:00
..
design ci: reformat files 2025-12-16 14:44:19 -08:00
src fix(compiler): optimize away unnecessary restore/reset view calls 2026-01-20 10:22:55 -08:00
test build: initial test of TypeScript 6 2026-01-15 13:41:01 -08:00
BUILD.bazel build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
compiler.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
index.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
package.json fix(core): update min Node.js support to 20.19, 22.12, and 24.0 (#61499) 2025-05-20 14:15:13 +00:00
public_api.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00