mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
4c0dc352fa
Every declaration a template is stored in a data slot in the runtime. The indices of these slots are passed to the declaration instructions in the creation mode. In the update mode, several instructions (like `reference()` for local references) also use the slot indices to reference declared items. This commit introduces `phaseSlotAllocation()` to the template pipeline, which allocates slots for declarations which need them, and propagates those slot indices to other instructions which need to reference declared items via their slot indices. To perform this association, the `XrefId` of the declared items is used to link declarations with usages. Slot allocation is abstracted from operations by the way of a new concept in the pipeline: traits. A trait is a "mixin" on an operation, expression, or both that allows phases to process any operation/expression which implements the trait without needing specific logic for each concrete implementing type. Two traits are introduced to support slot allocation: the `ConsumesSlotOpTrait` for declarations which require a slot to be allocated, and the `UsesSlotIndexExprTrait` for expressions which reference a declaration by its slot index. PR Close #48580
Angular
The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.
Usage information and reference details can be found in Angular documentation.
License: MIT