refactor(ivy): merged containerStart/containerEnd (#21374)

This separation is no longer needed since directives are now passed into the `container` as an array rather than as child functions of the `containerStart`

PR Close #21374
This commit is contained in:
Miško Hevery 2018-01-09 13:32:24 -08:00 committed by Alex Eagle
parent 9f43f5f09e
commit 16232f000f
16 changed files with 15 additions and 91 deletions

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {ɵC as C, ɵE as E, ɵT as T, ɵV as V, ɵb as b, ɵc as c, ɵcR as cR, ɵcr as cr, ɵdefineComponent as defineComponent, ɵdetectChanges as detectChanges, ɵe as e, ɵs as s, ɵt as t, ɵv as v} from '@angular/core';
import {ɵC as C, ɵE as E, ɵT as T, ɵV as V, ɵb as b, ɵcR as cR, ɵcr as cr, ɵdefineComponent as defineComponent, ɵdetectChanges as detectChanges, ɵe as e, ɵs as s, ɵt as t, ɵv as v} from '@angular/core';
import {ComponentDef} from '@angular/core/src/render3/interfaces/definition';
import {TableCell, buildTable, emptyTable} from '../util';
@ -25,7 +25,6 @@ export class LargeTableComponent {
E(1, 'tbody');
{
C(2);
c();
}
e();
}
@ -39,7 +38,6 @@ export class LargeTableComponent {
if (cm1) {
E(0, 'tr');
C(1);
c();
e();
}
cR(1);

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {ɵC as C, ɵD as D, ɵE as E, ɵT as T, ɵV as V, ɵb as b, ɵb1 as b1, ɵc as c, ɵcR as cR, ɵcr as cr, ɵdefineComponent as defineComponent, ɵdetectChanges as _detectChanges, ɵe as e, ɵp as p, ɵs as s, ɵt as t, ɵv as v} from '@angular/core';
import {ɵC as C, ɵD as D, ɵE as E, ɵT as T, ɵV as V, ɵb as b, ɵb1 as b1, ɵcR as cR, ɵcr as cr, ɵdefineComponent as defineComponent, ɵdetectChanges as _detectChanges, ɵe as e, ɵp as p, ɵs as s, ɵt as t, ɵv as v} from '@angular/core';
import {ComponentDef} from '@angular/core/src/render3/interfaces/definition';
import {TreeNode, buildTree, emptyTree} from '../util';
@ -44,9 +44,7 @@ export class TreeComponent {
{ T(1); }
e();
C(2);
c();
C(3);
c();
}
s(0, 'background-color', b(ctx.data.depth % 2 ? '' : 'grey'));
t(1, b1(' ', ctx.data.value, ' '));
@ -112,9 +110,7 @@ export function TreeTpl(ctx: TreeNode, cm: boolean) {
{ T(1); }
e();
C(2);
c();
C(3);
c();
}
s(0, 'background-color', b(ctx.depth % 2 ? '' : 'grey'));
t(1, b1(' ', ctx.value, ' '));

View File

@ -18,7 +18,6 @@ export {
V as ɵV,
b as ɵb,
b1 as ɵb1,
c as ɵc,
cR as ɵcR,
cr as ɵcr,
e as ɵe,

View File

@ -39,8 +39,7 @@ export {
componentRefresh as r,
containerStart as C,
containerEnd as c,
container as C,
containerRefreshStart as cR,
containerRefreshEnd as cr,

View File

@ -1107,7 +1107,7 @@ export function executeViewHooks(): void {
* @param attrs The attrs attached to the container, if applicable
* @param localRefs A set of local reference bindings on the element.
*/
export function containerStart(
export function container(
index: number, directiveTypes?: DirectiveType<any>[], template?: ComponentTemplate<any>,
tagName?: string, attrs?: string[], localRefs?: string[] | null): void {
ngDevMode && assertEqual(currentView.bindingStartIndex, null, 'bindingStartIndex');
@ -1145,15 +1145,8 @@ export function containerStart(
// because views can be removed and re-inserted.
addToViewTree(node.data);
hack_declareDirectives(index, directiveTypes, localRefs);
}
export function containerEnd() {
if (isParent) {
isParent = false;
} else {
ngDevMode && assertHasParent();
previousOrParentNode = previousOrParentNode.parent !;
}
isParent = false;
ngDevMode && assertNodeType(previousOrParentNode, LNodeFlags.Container);
const query = previousOrParentNode.query;
query && query.addNode(previousOrParentNode);

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {C, E, T, V, c, cR, cr, defineComponent, e, v} from '../../src/render3/index';
import {C, E, T, V, cR, cr, defineComponent, e, v} from '../../src/render3/index';
import {document, renderComponent} from './render_util';
@ -37,7 +37,6 @@ describe('iv perf test', () => {
template: function Template(ctx: any, cm: any) {
if (cm) {
C(0);
c();
}
cR(0);
{

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {C, D, E, P, T, V, c, cR, cr, detectChanges, e, m, pD, v} from '../../src/render3/index';
import {C, D, E, P, T, V, cR, cr, detectChanges, e, m, pD, v} from '../../src/render3/index';
import {createComponent, renderComponent, toHtml} from './render_util';
@ -114,7 +114,6 @@ describe('content projection', () => {
{
T(2, '(');
C(3);
c();
T(4, ')');
}
e();
@ -154,7 +153,6 @@ describe('content projection', () => {
E(0, Child);
{
C(2);
c();
}
e();
}
@ -198,7 +196,6 @@ describe('content projection', () => {
{
T(2, '(');
C(3);
c();
T(4, ')');
}
e();
@ -249,7 +246,6 @@ describe('content projection', () => {
E(1, 'div');
{
C(2);
c();
}
e();
}
@ -307,7 +303,6 @@ describe('content projection', () => {
E(1, 'div');
{
C(2);
c();
}
e();
}
@ -405,7 +400,6 @@ describe('content projection', () => {
E(2, 'div');
{
C(3);
c();
}
e();
}
@ -824,7 +818,6 @@ describe('content projection', () => {
E(0, Child);
{
C(2, undefined, undefined, 'div');
c();
}
e();
}

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {C, E, T, V, b, c, cR, cr, e, t, v} from '../../src/render3/index';
import {C, E, T, V, b, cR, cr, e, t, v} from '../../src/render3/index';
import {renderToHtml} from './render_util';
@ -19,7 +19,6 @@ describe('JS control flow', () => {
E(0, 'div');
{
C(1);
c();
}
e();
}
@ -70,7 +69,6 @@ describe('JS control flow', () => {
E(0, 'div');
{
C(1);
c();
}
e();
}
@ -83,7 +81,6 @@ describe('JS control flow', () => {
E(0, 'span');
{
C(1);
c();
}
e();
}
@ -141,7 +138,6 @@ describe('JS control flow', () => {
{ T(1, 'hello'); }
e();
C(2);
c();
}
cR(2);
{
@ -150,7 +146,6 @@ describe('JS control flow', () => {
{
if (cm0) {
C(0);
c();
}
cR(0);
{
@ -187,7 +182,6 @@ describe('JS control flow', () => {
E(0, 'ul');
{
C(1);
c();
}
e();
}
@ -236,7 +230,6 @@ describe('JS control flow', () => {
E(0, 'ul');
{
C(1);
c();
}
e();
}
@ -249,7 +242,6 @@ describe('JS control flow', () => {
E(0, 'li');
{
C(1);
c();
}
e();
}
@ -298,7 +290,6 @@ describe('JS control flow', () => {
{
T(1, 'Before');
C(2);
c();
T(3, 'After');
}
e();
@ -313,7 +304,6 @@ describe('JS control flow', () => {
{ T(1); }
e();
C(2);
c();
T(3, '-');
}
t(1, b(ctx.cafes[i].name));
@ -380,7 +370,6 @@ describe('JS control flow', () => {
{
T(1, 'Before');
C(2);
c();
T(3, 'After');
}
e();
@ -395,7 +384,6 @@ describe('JS control flow', () => {
{ T(1); }
e();
C(2);
c();
T(3, '-');
}
t(1, b(ctx.cafes[i].name));
@ -409,7 +397,6 @@ describe('JS control flow', () => {
{ T(1); }
e();
C(2);
c();
}
t(1, b(ctx.cafes[i].entrees[j].name));
cR(2);
@ -472,7 +459,6 @@ describe('JS control flow', () => {
E(0, 'div');
{
C(1);
c();
}
e();
}
@ -523,7 +509,6 @@ describe('JS for loop', () => {
E(0, 'div');
{
C(1);
c();
}
e();
}
@ -580,9 +565,7 @@ describe('function calls', () => {
{
T(1, 'Before');
C(2);
c();
C(3);
c();
T(4, 'After');
}
e();

View File

@ -144,7 +144,6 @@ describe('di', () => {
function Template(ctx: any, cm: any) {
if (cm) {
C(0, [Directive, DirectiveSameInstance], function() {});
c();
T(3);
}
t(3, b2('', D<Directive>(1).value, '-', D<DirectiveSameInstance>(2).value, ''));
@ -271,7 +270,6 @@ describe('di', () => {
E(0, 'div', null, [ParentDirective]);
{
C(2);
c();
}
e();
}

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {C, D, E, T, V, a, b, c, cR, cr, defineComponent, defineDirective, e, k, p, t, v} from '../../src/render3/index';
import {C, D, E, T, V, a, b, cR, cr, defineComponent, defineDirective, e, k, p, t, v} from '../../src/render3/index';
import {renderToHtml} from './render_util';
@ -256,7 +256,6 @@ describe('exports', () => {
E(0, 'div');
{
C(1);
c();
}
e();
}

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {C, D, E, NC, T, V, a, b, b1, b2, b3, b4, b5, b6, b7, b8, bV, c, cR, cr, defineComponent, e, k, p, r, s, t, v} from '../../src/render3/index';
import {C, D, E, NC, T, V, a, b, b1, b2, b3, b4, b5, b6, b7, b8, bV, cR, cr, defineComponent, e, k, p, r, s, t, v} from '../../src/render3/index';
import {NO_CHANGE} from '../../src/render3/instructions';
import {containerEl, renderToHtml} from './render_util';
@ -356,7 +356,6 @@ describe('render3 integration test', () => {
template: function MyCompTemplate(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -478,7 +477,6 @@ describe('render3 integration test', () => {
if (cm) {
E(0, 'span');
C(1);
c();
e();
}
a(0, 'title', b(ctx.title));
@ -595,7 +593,6 @@ describe('render3 integration test', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {C, ComponentDef, ComponentTemplate, D, E, L, LifecycleHook, T, V, b, c, cR, cr, defineComponent, e, l, p, r, v} from '../../src/render3/index';
import {C, ComponentDef, ComponentTemplate, D, E, L, LifecycleHook, T, V, b, cR, cr, defineComponent, e, l, p, r, v} from '../../src/render3/index';
import {containerEl, renderToHtml} from './render_util';
@ -125,7 +125,6 @@ describe('lifecycles', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -166,7 +165,6 @@ describe('lifecycles', () => {
E(0, Comp);
e();
C(2);
c();
E(3, Comp);
e();
}
@ -213,7 +211,6 @@ describe('lifecycles', () => {
E(0, Parent);
e();
C(2);
c();
E(3, Parent);
e();
}
@ -700,7 +697,6 @@ describe('lifecycles', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -733,7 +729,6 @@ describe('lifecycles', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -773,7 +768,6 @@ describe('lifecycles', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -817,7 +811,6 @@ describe('lifecycles', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -854,7 +847,6 @@ describe('lifecycles', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -863,7 +855,6 @@ describe('lifecycles', () => {
E(0, Comp);
e();
C(2);
c();
E(3, Comp);
e();
}
@ -932,7 +923,6 @@ describe('lifecycles', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -941,7 +931,6 @@ describe('lifecycles', () => {
E(0, Comp);
e();
C(2);
c();
E(3, Comp);
e();
}
@ -1012,7 +1001,6 @@ describe('lifecycles', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {C, D, E, L, T, V, c, cR, cr, defineComponent, e, v} from '../../src/render3/index';
import {C, D, E, L, T, V, cR, cr, defineComponent, e, v} from '../../src/render3/index';
import {containerEl, renderComponent, renderToHtml} from './render_util';
@ -137,7 +137,6 @@ describe('event listeners', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -145,7 +144,6 @@ describe('event listeners', () => {
if (V(0)) {
T(0, 'Hello');
C(1);
c();
}
cR(1);
{
@ -197,7 +195,6 @@ describe('event listeners', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -254,7 +251,6 @@ describe('event listeners', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -262,9 +258,7 @@ describe('event listeners', () => {
if (V(0)) {
T(0, 'Hello');
C(1);
c();
C(2);
c();
}
cR(1);
{

View File

@ -8,7 +8,7 @@
import {EventEmitter} from '@angular/core';
import {C, D, E, L, LifecycleHook, T, V, b, c, cR, cr, defineComponent, defineDirective, e, l, p, v} from '../../src/render3/index';
import {C, D, E, L, LifecycleHook, T, V, b, cR, cr, defineComponent, defineDirective, e, l, p, v} from '../../src/render3/index';
import {containerEl, renderToHtml} from './render_util';
@ -123,7 +123,6 @@ describe('outputs', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -168,14 +167,12 @@ describe('outputs', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
if (ctx.condition) {
if (V(0)) {
C(0);
c();
}
cR(0);
{
@ -240,7 +237,6 @@ describe('outputs', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{
@ -399,7 +395,6 @@ describe('outputs', () => {
}
e();
C(2);
c();
}
cR(2);
{

View File

@ -8,7 +8,7 @@
import {EventEmitter} from '@angular/core';
import {C, D, E, L, T, V, b, b1, c, cR, cr, defineComponent, defineDirective, e, p, t, v} from '../../src/render3/index';
import {C, D, E, L, T, V, b, b1, cR, cr, defineComponent, defineDirective, e, p, t, v} from '../../src/render3/index';
import {NO_CHANGE} from '../../src/render3/instructions';
import {renderToHtml} from './render_util';
@ -252,7 +252,6 @@ describe('elementProperty', () => {
{ T(2, 'Click me'); }
e();
C(3);
c();
}
p(0, 'id', b(ctx.id1));
cR(3);
@ -434,7 +433,6 @@ describe('elementProperty', () => {
E(0, 'div', ['role', 'listbox'], [MyDir]);
e();
C(2);
c();
}
cR(2);
{
@ -495,7 +493,6 @@ describe('elementProperty', () => {
function Template(ctx: any, cm: boolean) {
if (cm) {
C(0);
c();
}
cR(0);
{

View File

@ -5,7 +5,7 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {C, D, E, Q, QueryList, c, e, m, qR} from '../../src/render3/index';
import {C, D, E, Q, QueryList, e, m, qR} from '../../src/render3/index';
import {QueryReadType} from '../../src/render3/interfaces/query';
import {createComponent, createDirective, renderComponent} from './render_util';
@ -285,7 +285,6 @@ describe('query', () => {
if (cm) {
m(0, Q(['foo'], false, QueryReadType.ViewContainerRef));
C(1, undefined, undefined, undefined, undefined, ['foo', '']);
c();
}
qR(tmp = m<QueryList<any>>(0)) && (ctx.query = tmp as QueryList<any>);
});
@ -309,7 +308,6 @@ describe('query', () => {
if (cm) {
m(0, Q(['foo'], false, QueryReadType.ElementRef));
C(1, undefined, undefined, undefined, undefined, ['foo', '']);
c();
}
qR(tmp = m<QueryList<any>>(0)) && (ctx.query = tmp as QueryList<any>);
});
@ -334,7 +332,6 @@ describe('query', () => {
if (cm) {
m(0, Q(['foo']));
C(1, undefined, undefined, undefined, undefined, ['foo', '']);
c();
}
qR(tmp = m<QueryList<any>>(0)) && (ctx.query = tmp as QueryList<any>);
});
@ -358,7 +355,6 @@ describe('query', () => {
if (cm) {
m(0, Q(['foo'], false, QueryReadType.TemplateRef));
C(1, undefined, undefined, undefined, undefined, ['foo', '']);
c();
}
qR(tmp = m<QueryList<any>>(0)) && (ctx.query = tmp as QueryList<any>);
});