refactor(ivy): harmonize container and element / elementContainer signatures (#25458)

PR Close #25458
This commit is contained in:
Pawel Kozlowski 2018-08-13 14:50:28 +02:00 committed by Ben Lesh
parent 14ac7ad6b4
commit 0c4209f4b9
4 changed files with 16 additions and 16 deletions

View File

@ -1838,8 +1838,8 @@ export function createLContainer(
* @param localRefs A set of local reference bindings on the element. * @param localRefs A set of local reference bindings on the element.
*/ */
export function container( export function container(
index: number, template?: ComponentTemplate<any>, tagName?: string | null, attrs?: TAttributes, index: number, template?: ComponentTemplate<any>| null, tagName?: string | null,
localRefs?: string[] | null): void { attrs?: TAttributes | null, localRefs?: string[] | null): void {
ngDevMode && ngDevMode &&
assertEqual( assertEqual(
viewData[BINDING_INDEX], -1, 'container nodes should be created before any bindings'); viewData[BINDING_INDEX], -1, 'container nodes should be created before any bindings');

View File

@ -1159,7 +1159,7 @@ describe('di', () => {
/** <div *myIf="showing" dir dirSameInstance #dir="dir"> {{ dir.value }} </div> */ /** <div *myIf="showing" dir dirSameInstance #dir="dir"> {{ dir.value }} </div> */
template: function(rf: RenderFlags, ctx: MyApp) { template: function(rf: RenderFlags, ctx: MyApp) {
if (rf & RenderFlags.Create) { if (rf & RenderFlags.Create) {
container(0, C1, undefined, ['myIf', 'showing']); container(0, C1, null, ['myIf', 'showing']);
} }
if (rf & RenderFlags.Update) { if (rf & RenderFlags.Update) {
containerRefreshStart(0); containerRefreshStart(0);

View File

@ -510,7 +510,7 @@ describe('query', () => {
'cmpt', 'cmpt',
function(rf: RenderFlags, ctx: any) { function(rf: RenderFlags, ctx: any) {
if (rf & RenderFlags.Create) { if (rf & RenderFlags.Create) {
container(1, undefined, undefined, undefined, ['foo', '']); container(1, null, null, null, ['foo', '']);
} }
}, },
[], [], [], [],
@ -542,7 +542,7 @@ describe('query', () => {
'cmpt', 'cmpt',
function(rf: RenderFlags, ctx: any) { function(rf: RenderFlags, ctx: any) {
if (rf & RenderFlags.Create) { if (rf & RenderFlags.Create) {
container(1, undefined, undefined, undefined, ['foo', '']); container(1, null, null, null, ['foo', '']);
} }
}, },
[], [], [], [],
@ -577,7 +577,7 @@ describe('query', () => {
'cmpt', 'cmpt',
function(rf: RenderFlags, ctx: any) { function(rf: RenderFlags, ctx: any) {
if (rf & RenderFlags.Create) { if (rf & RenderFlags.Create) {
container(1, undefined, undefined, undefined, ['foo', '']); container(1, null, null, null, ['foo', '']);
} }
}, },
[], [], [], [],
@ -609,7 +609,7 @@ describe('query', () => {
'cmpt', 'cmpt',
function(rf: RenderFlags, ctx: any) { function(rf: RenderFlags, ctx: any) {
if (rf & RenderFlags.Create) { if (rf & RenderFlags.Create) {
container(1, undefined, undefined, undefined, ['foo', '']); container(1, null, null, null, ['foo', '']);
} }
}, },
[], [], [], [],
@ -1129,7 +1129,7 @@ describe('query', () => {
} }
}, null, []); }, null, []);
container(5, undefined, null, [AttributeMarker.SelectOnly, 'vc']); container(5, null, null, [AttributeMarker.SelectOnly, 'vc']);
} }
if (rf & RenderFlags.Update) { if (rf & RenderFlags.Update) {
@ -1221,8 +1221,8 @@ describe('query', () => {
} }
}, null, []); }, null, []);
container(2, undefined, null, [AttributeMarker.SelectOnly, 'vc']); container(2, null, null, [AttributeMarker.SelectOnly, 'vc']);
container(3, undefined, null, [AttributeMarker.SelectOnly, 'vc']); container(3, null, null, [AttributeMarker.SelectOnly, 'vc']);
} }
if (rf & RenderFlags.Update) { if (rf & RenderFlags.Update) {
@ -1288,7 +1288,7 @@ describe('query', () => {
element(0, 'span', ['id', 'from_tpl'], ['foo', '']); element(0, 'span', ['id', 'from_tpl'], ['foo', '']);
} }
}, undefined, undefined, ['tpl', '']); }, undefined, undefined, ['tpl', '']);
container(3, undefined, null, [AttributeMarker.SelectOnly, 'ngTemplateOutlet']); container(3, null, null, [AttributeMarker.SelectOnly, 'ngTemplateOutlet']);
} }
if (rf & RenderFlags.Update) { if (rf & RenderFlags.Update) {
const tplRef = getOrCreateTemplateRef(getOrCreateNodeInjectorForNode(load(1))); const tplRef = getOrCreateTemplateRef(getOrCreateNodeInjectorForNode(load(1)));

View File

@ -163,7 +163,7 @@ describe('ViewContainerRef', () => {
it('should work on containers', () => { it('should work on containers', () => {
function createTemplate() { function createTemplate() {
container(0, embeddedTemplate, undefined, ['vcref', '']); container(0, embeddedTemplate, null, ['vcref', '']);
element(1, 'footer'); element(1, 'footer');
} }
@ -246,8 +246,8 @@ describe('ViewContainerRef', () => {
template: (rf: RenderFlags, cmp: TestComponent) => { template: (rf: RenderFlags, cmp: TestComponent) => {
if (rf & RenderFlags.Create) { if (rf & RenderFlags.Create) {
text(0, 'before|'); text(0, 'before|');
container(1, EmbeddedTemplateA, undefined, ['testdir', '']); container(1, EmbeddedTemplateA, null, ['testdir', '']);
container(2, EmbeddedTemplateB, undefined, ['testdir', '']); container(2, EmbeddedTemplateB, null, ['testdir', '']);
text(3, '|after'); text(3, '|after');
} }
}, },
@ -315,7 +315,7 @@ describe('ViewContainerRef', () => {
template: (rf: RenderFlags, cmp: TestComponent) => { template: (rf: RenderFlags, cmp: TestComponent) => {
if (rf & RenderFlags.Create) { if (rf & RenderFlags.Create) {
text(0, 'before|'); text(0, 'before|');
container(1, EmbeddedTemplateA, undefined, ['testdir', '']); container(1, EmbeddedTemplateA, null, ['testdir', '']);
container(2); container(2);
text(3, '|after'); text(3, '|after');
} }
@ -1074,7 +1074,7 @@ describe('ViewContainerRef', () => {
it('should work on containers', () => { it('should work on containers', () => {
function createTemplate() { function createTemplate() {
container(0, embeddedTemplate, undefined, ['vcref', '']); container(0, embeddedTemplate, null, ['vcref', '']);
element(1, 'footer'); element(1, 'footer');
} }