New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(compiler): create a new root BindingScope
for each template
#36362
refactor(compiler): create a new root BindingScope
for each template
#36362
Conversation
Previously we had a singleton `ROOT_SCOPE` object, from which all `BindingScope`s derived. But this caused ngcc to produce non-deterministic output when running multiple workers in parallel, since each process had its own `ROOT_SCOPE`. In reality there is no need for `BindingScope` reference names to be unique across an entire application (or in the case of ngcc across all the libraries). Instead we just need uniqueness within a template. This commit changes the compiler to create a new root `BindingScope` each time it compiles a component's template. Resolves angular#35180
I couldn't find any suitable place to add additional tests of this change; and since it has no real change to the behaviour of the generated code I decided it was really just a refactor (or perhaps a build related change). |
#36362) Previously we had a singleton `ROOT_SCOPE` object, from which all `BindingScope`s derived. But this caused ngcc to produce non-deterministic output when running multiple workers in parallel, since each process had its own `ROOT_SCOPE`. In reality there is no need for `BindingScope` reference names to be unique across an entire application (or in the case of ngcc across all the libraries). Instead we just need uniqueness within a template. This commit changes the compiler to create a new root `BindingScope` each time it compiles a component's template. Resolves #35180 PR Close #36362
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Previously we had a singleton
ROOT_SCOPE
object, fromwhich all
BindingScope
s derived. But this caused ngcc toproduce non-deterministic output when running multiple workers
in parallel, since each process had its own
ROOT_SCOPE
.In reality there is no need for
BindingScope
reference namesto be unique across an entire application (or in the case of ngcc
across all the libraries). Instead we just need uniqueness within
a template.
This commit changes the compiler to create a new root
BindingScope
each time it compiles a component's template.
Resolves #35180