refactor(ivy): inherently call ɵɵselect(0) (#30830)

- Refactors compiler to stop generating `ɵɵselect(0)` instructions
- Alters template execution to always call the equivalent of `ɵɵselect(0)` before running a template in update mode
- Updates tests to not check for or call `ɵɵselect(0)`.

The goal here is to reduce the size of generated templates

PR Close #30830
This commit is contained in:
Ben Lesh
2019-06-03 10:29:14 -07:00
committed by Misko Hevery
parent 5c18f23788
commit c0386757b1
19 changed files with 33 additions and 118 deletions

View File

@ -1072,7 +1072,9 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
nodeIndex: number, span: ParseSourceSpan|null, reference: o.ExternalReference,
paramsOrFn?: o.Expression[]|(() => o.Expression[])) {
if (this._lastNodeIndexWithFlush < nodeIndex) {
this.instructionFn(this._updateCodeFns, span, R3.select, [o.literal(nodeIndex)]);
if (nodeIndex > 0) {
this.instructionFn(this._updateCodeFns, span, R3.select, [o.literal(nodeIndex)]);
}
this._lastNodeIndexWithFlush = nodeIndex;
}
this.instructionFn(this._updateCodeFns, span, reference, paramsOrFn || []);