refactor(ivy): define new AttributeMarker.Template
marker (#29041)
This commit adds a new `AttributeMarker` type that will be used, in a future commit, to mark attributes as coming from an inline-template expansion, rather than the element that is being contained in the template. PR Close #29041
This commit is contained in:

committed by
Kara Erickson

parent
423ac01dcf
commit
e3a401d20c
@ -450,4 +450,29 @@ export const enum AttributeMarker {
|
||||
* ```
|
||||
*/
|
||||
Bindings = 3,
|
||||
|
||||
/**
|
||||
* Signals that the following attribute names were hoisted from an inline-template declaration.
|
||||
*
|
||||
* For example, given the following HTML:
|
||||
*
|
||||
* ```
|
||||
* <div *ngFor="let value of values; trackBy:trackBy" dirA [dirB]="value">
|
||||
* ```
|
||||
*
|
||||
* the generated code for the `template()` instruction would include:
|
||||
*
|
||||
* ```
|
||||
* ['dirA', '', AttributeMarker.Bindings, 'dirB', AttributeMarker.Template, 'ngFor', 'ngForOf',
|
||||
* 'ngForTrackBy', 'let-value']
|
||||
* ```
|
||||
*
|
||||
* while the generated code for the `element()` instruction inside the template function would
|
||||
* include:
|
||||
*
|
||||
* ```
|
||||
* ['dirA', '', AttributeMarker.Bindings, 'dirB']
|
||||
* ```
|
||||
*/
|
||||
Template = 4,
|
||||
}
|
||||
|
@ -1044,7 +1044,8 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
|
||||
* attrs = [prop, value, prop2, value2,
|
||||
* CLASSES, class1, class2,
|
||||
* STYLES, style1, value1, style2, value2,
|
||||
* BINDINGS, name1, name2, name3, ...]
|
||||
* BINDINGS, name1, name2, name3,
|
||||
* TEMPLATE, name4, name5, ...]
|
||||
* ```
|
||||
*
|
||||
* Note that this function will fully ignore all synthetic (@foo) attribute values
|
||||
@ -1068,8 +1069,8 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
|
||||
}
|
||||
}
|
||||
|
||||
// it's important that this occurs before BINDINGS because once `elementStart`
|
||||
// comes across the BINDINGS marker then it will continue reading each value as
|
||||
// it's important that this occurs before BINDINGS and TEMPLATE because once `elementStart`
|
||||
// comes across the BINDINGS or TEMPLATE markers then it will continue reading each value as
|
||||
// as single property value cell by cell.
|
||||
if (styles) {
|
||||
styles.populateInitialStylingAttrs(attrExprs);
|
||||
|
Reference in New Issue
Block a user