Skip to content

Commit 533ec52

Browse files
crisbetoatscott
authored andcommitted
refactor(compiler): move variable optimization earlier in pipeline (angular#55771)
Currently the variable optimization phase happens somewhat late in the process which is okay since the variables are generally static (e.g. `reference()` instruction calls). In some upcoming work we'll have variables that consume slots and require `advance` instructions. To allow for them to be optimized correctly, we need to move the variable optimization phase earlier, at least before we allocate the slots. PR Close angular#55771
1 parent 801e5e1 commit 533ec52

File tree

1 file changed

+1
-1
lines changed
  • packages/compiler/src/template/pipeline/src

1 file changed

+1
-1
lines changed

packages/compiler/src/template/pipeline/src/emit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ const phases: Phase[] = [
136136
{kind: Kind.Both, fn: generateNullishCoalesceExpressions},
137137
{kind: Kind.Both, fn: expandSafeReads},
138138
{kind: Kind.Both, fn: generateTemporaryVariables},
139+
{kind: Kind.Both, fn: optimizeVariables},
139140
{kind: Kind.Tmpl, fn: allocateSlots},
140141
{kind: Kind.Tmpl, fn: resolveI18nElementPlaceholders},
141142
{kind: Kind.Tmpl, fn: resolveI18nExpressionPlaceholders},
@@ -147,7 +148,6 @@ const phases: Phase[] = [
147148
{kind: Kind.Tmpl, fn: removeI18nContexts},
148149
{kind: Kind.Both, fn: countVariables},
149150
{kind: Kind.Tmpl, fn: generateAdvance},
150-
{kind: Kind.Both, fn: optimizeVariables},
151151
{kind: Kind.Both, fn: nameFunctionsAndVariables},
152152
{kind: Kind.Tmpl, fn: resolveDeferDepsFns},
153153
{kind: Kind.Tmpl, fn: mergeNextContextExpressions},

0 commit comments

Comments
 (0)