Skip to content

Commit

Permalink
refactor(compiler): move variable optimization earlier in pipeline
Browse files Browse the repository at this point in the history
Currently the variable optimization phase of the pipeline happens after var counting and `advance` generation. This is fine at the moment since all the variables are generated at the top of the instruction set.

In some future work we'll have to generate variables further down in the set instead. These changes move the variable optimization down so that unused variables in the future aren't counted and we account for them when generating `advance` calls.
  • Loading branch information
crisbeto committed May 13, 2024
1 parent 85ac2de commit 5acd730
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/compiler/src/template/pipeline/src/emit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ const phases: Phase[] = [
{kind: Kind.Tmpl, fn: collectConstExpressions},
{kind: Kind.Both, fn: collectElementConsts},
{kind: Kind.Tmpl, fn: removeI18nContexts},
{kind: Kind.Both, fn: optimizeVariables},
{kind: Kind.Both, fn: countVariables},
{kind: Kind.Tmpl, fn: generateAdvance},
{kind: Kind.Both, fn: optimizeVariables},
{kind: Kind.Both, fn: nameFunctionsAndVariables},
{kind: Kind.Tmpl, fn: resolveDeferDepsFns},
{kind: Kind.Tmpl, fn: mergeNextContextExpressions},
Expand Down

0 comments on commit 5acd730

Please sign in to comment.