angular-cn/packages/common
Miško Hevery 2961bf06c6 refactor(ivy): move `hostVars`/`hostAttrs` from instruction to `DirectiveDef` (#34683)
This change moves information from instructions to declarative position:
- `ɵɵallocHostVars(vars)` => `DirectiveDef.hostVars`
- `ɵɵelementHostAttrs(attrs)` => `DirectiveDef.hostAttrs`

When merging directives it is necessary to know about `hostVars` and `hostAttrs`. Before this change the information was stored in the `hostBindings` function. This was problematic, because in order to get to the information the `hostBindings` would have to be executed. In order for `hostBindings` to be executed the directives would have to be instantiated. This means that the directive instantiation would happen before we had knowledge about the `hostAttrs` and as a result the directive could observe in the constructor that not all of the `hostAttrs` have been applied. This further complicates the runtime as we have to apply `hostAttrs` in parts over many invocations.

`ɵɵallocHostVars` was unnecessarily complicated because it would have to update the `LView` (and Blueprint) while existing directives are already executing. By moving it out of `hostBindings` function we can access it statically and we can create correct `LView` (and Blueprint) in a single pass.

This change only changes how the instructions are generated, but does not change the runtime much. (We cheat by emulating the old behavior by calling `ɵɵallocHostVars` and `ɵɵelementHostAttrs`) Subsequent change will refactor the runtime to take advantage of the static information.

PR Close #34683
2020-01-24 12:22:10 -08:00
..
http test: setup circular dependency tests for all entry points (#34774) 2020-01-23 11:36:40 -08:00
locales build: upgrade to rules_nodejs 1.0.0 (first stable release) (#34736) 2020-01-15 14:58:07 -05:00
src refactor(ivy): move `hostVars`/`hostAttrs` from instruction to `DirectiveDef` (#34683) 2020-01-24 12:22:10 -08:00
test test: setup circular dependency tests for all entry points (#34774) 2020-01-23 11:36:40 -08:00
testing docs: add api doc to sub-packages (#33801) 2019-11-20 14:48:50 -08:00
upgrade test: setup circular dependency tests for all entry points (#34774) 2020-01-23 11:36:40 -08:00
BUILD.bazel build: upgrade to rules_nodejs 1.0.0 (first stable release) (#34736) 2020-01-15 14:58:07 -05:00
PACKAGE.md docs: add api doc to sub-packages (#33801) 2019-11-20 14:48:50 -08:00
index.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
package.json build: set up all packages to publish via wombot proxy (#33747) 2019-11-13 11:34:33 -08:00
public_api.ts refactor(common): move the low level locale registering to core (#33523) 2019-11-05 17:26:59 +00:00