refactor(ivy): replace pNextOrParent with TNode props (#24752)

PR Close #24752
This commit is contained in:
Kara Erickson
2018-07-03 20:04:36 -07:00
committed by Miško Hevery
parent dc1f1295ee
commit 3a19f70d1c
17 changed files with 618 additions and 495 deletions

View File

@ -62,7 +62,6 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
private _bindingCode: o.Statement[] = [];
private _postfixCode: o.Statement[] = [];
private _temporary = temporaryAllocator(this._prefixCode, TEMPORARY_NAME);
private _projectionDefinitionIndex = -1;
private _valueConverter: ValueConverter;
private _unsupported = unsupported;
private _bindingScope: BindingScope;
@ -121,8 +120,7 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
// Output a `ProjectionDef` instruction when some `<ng-content>` are present
if (hasNgContent) {
this._projectionDefinitionIndex = this.allocateDataSlot();
const parameters: o.Expression[] = [o.literal(this._projectionDefinitionIndex)];
const parameters: o.Expression[] = [];
// Only selectors with a non-default value are generated
if (ngContentSelectors.length > 1) {
@ -217,10 +215,7 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
visitContent(ngContent: t.Content) {
const slot = this.allocateDataSlot();
const selectorIndex = ngContent.selectorIndex;
const parameters: o.Expression[] = [
o.literal(slot),
o.literal(this._projectionDefinitionIndex),
];
const parameters: o.Expression[] = [o.literal(slot)];
const attributeAsList: string[] = [];

View File

@ -871,9 +871,9 @@ describe('compiler compliance', () => {
factory: function SimpleComponent_Factory() { return new SimpleComponent(); },
template: function SimpleComponent_Template(rf: IDENT, ctx: IDENT) {
if (rf & 1) {
$r3$.ɵpD(0);
$r3$.ɵE(1, 'div');
$r3$.ɵP(2, 0);
$r3$.ɵpD();
$r3$.ɵE(0, 'div');
$r3$.ɵP(1);
$r3$.ɵe();
}
}
@ -891,12 +891,12 @@ describe('compiler compliance', () => {
factory: function ComplexComponent_Factory() { return new ComplexComponent(); },
template: function ComplexComponent_Template(rf: IDENT, ctx: IDENT) {
if (rf & 1) {
$r3$.ɵpD(0, $c1$, $c2$);
$r3$.ɵE(1, 'div', $c3$);
$r3$.ɵP(2, 0, 1);
$r3$.ɵpD($c1$, $c2$);
$r3$.ɵE(0, 'div', $c3$);
$r3$.ɵP(1, 1);
$r3$.ɵe();
$r3$.ɵE(3, 'div', $c4$);
$r3$.ɵP(4, 0, 2);
$r3$.ɵE(2, 'div', $c4$);
$r3$.ɵP(3, 2);
$r3$.ɵe();
}
}
@ -1022,9 +1022,9 @@ describe('compiler compliance', () => {
template: function ContentQueryComponent_Template(
rf: $RenderFlags$, ctx: $ContentQueryComponent$) {
if (rf & 1) {
$r3$.ɵpD(0);
$r3$.ɵE(1, 'div');
$r3$.ɵP(2, 0);
$r3$.ɵpD();
$r3$.ɵE(0, 'div');
$r3$.ɵP(1);
$r3$.ɵe();
}
}