angular/packages/compiler-cli
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
..
linker refactor(compiler-cli): account for spread elements in translator 2026-01-07 12:37:52 -05:00
private Revert "refactor(compiler-cli): remove deep imports from compiler-cli (#64732)" 2025-11-06 13:09:01 -08:00
src build: initial test of TypeScript 6 2026-01-15 13:41:01 -08:00
test fix(compiler): optimize away unnecessary restore/reset view calls 2026-01-20 10:22:55 -08:00
BUILD.bazel Revert "refactor(compiler-cli): remove deep imports from compiler-cli (#64732)" 2025-11-06 13:09:01 -08:00
esbuild.config.js build: use esbuild from aspect rules (#62568) 2025-07-10 13:45:15 -07:00
index.ts refactor(compiler-cli): Remove deep imports of compiler-cli in angular/core 2025-10-28 15:58:56 +01:00
package.json build: update all non-major dependencies 2026-01-15 10:52:48 -08:00
tsconfig-test.json build: prepare for compiler-cli to be using ts_project (#61181) 2025-05-09 15:59:46 +00:00
tsconfig.json build: prepare for compiler-cli to be using ts_project (#61181) 2025-05-09 15:59:46 +00:00