refactor(ivy): remove unnecessary Comp.r function (#21650)

PR Close #21650
This commit is contained in:
Kara Erickson 2018-01-22 19:52:06 -08:00 committed by Misko Hevery
parent 2c33d17609
commit 811679a583
16 changed files with 179 additions and 209 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, ɵ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 {ɵC as C, ɵ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, ɵr as r, ɵ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';
@ -59,7 +59,7 @@ export class TreeComponent {
}
p(0, 'data', b(ctx.data.left));
TreeComponent.ngComponentDef.h(1, 0);
TreeComponent.ngComponentDef.r(1, 0);
r(1, 0);
}
v();
}
@ -76,7 +76,7 @@ export class TreeComponent {
}
p(0, 'data', b(ctx.data.right));
TreeComponent.ngComponentDef.h(1, 0);
TreeComponent.ngComponentDef.r(1, 0);
r(1, 0);
}
v();
}

View File

@ -205,8 +205,8 @@ describe('r3_view_compiler', () => {
IDENT.ɵe();
IDENT.ɵT(3, '!');
}
ChildComponent.ngComponentDef.r(1, 0);
SomeDirective.ngDirectiveDef.r(2, 0);
r(1, 0);
r(2, 0);
}
});
`;
@ -267,7 +267,7 @@ describe('r3_view_compiler', () => {
}
const IDENT = IDENT.ɵm(1);
IDENT.ɵcR(2);
IfDirective.ngDirectiveDef.r(3,2);
r(3,2);
IDENT.ɵcr();
function MyComponent_IfDirective_Template_2(ctx0: IDENT, cm: IDENT) {

View File

@ -34,5 +34,6 @@ export {
s as ɵs,
t as ɵt,
v as ɵv,
r as ɵr,
} from './render3/index';
// clang-format on

View File

@ -40,11 +40,6 @@ export function defineComponent<T>(componentDefinition: ComponentDefArgs<T>): Co
n: componentDefinition.factory,
tag: (componentDefinition as ComponentDefArgs<T>).tag || null !,
template: (componentDefinition as ComponentDefArgs<T>).template || null !,
r: componentDefinition.refresh || (componentDefinition.template ?
function(d: number, e: number) {
componentRefresh(d, e, componentDefinition.template);
} :
noop),
h: componentDefinition.hostBindings || noop,
inputs: invertObject(componentDefinition.inputs),
outputs: invertObject(componentDefinition.outputs),

View File

@ -337,8 +337,8 @@ export function renderComponentOrTemplate<T>(
template(componentOrContext !, creationMode);
} else {
// Element was stored at 0 and directive was stored at 1 in renderComponent
// so to refresh the component, r() needs to be called with (1, 0)
(componentOrContext.constructor as ComponentType<T>).ngComponentDef.r(1, 0);
// so to refresh the component, refresh() needs to be called with (1, 0)
componentRefresh(1, 0);
}
} finally {
if (rendererFactory.end) {
@ -1161,28 +1161,27 @@ export function viewEnd(): void {
*
* @param directiveIndex
* @param elementIndex
* @param template
*/
export const componentRefresh:
<T>(directiveIndex: number, elementIndex: number, template: ComponentTemplate<T>) =>
void = function<T>(
directiveIndex: number, elementIndex: number, template: ComponentTemplate<T>) {
ngDevMode && assertDataInRange(elementIndex);
const element = data ![elementIndex] as LElementNode;
ngDevMode && assertNodeOfPossibleTypes(element, LNodeFlags.Element, LNodeFlags.Container);
ngDevMode && assertNotEqual(element.data, null, 'isComponent');
ngDevMode && assertDataInRange(directiveIndex);
const hostView = element.data !;
ngDevMode && assertNotEqual(hostView, null, 'hostView');
export function componentRefresh<T>(directiveIndex: number, elementIndex: number): void {
executeInitHooks(currentView);
executeContentHooks(currentView);
const directive = data[directiveIndex];
const oldView = enterView(hostView, element);
try {
template(directive, creationMode);
} finally {
refreshDynamicChildren();
leaveView(oldView);
const template = (tData[directiveIndex] as ComponentDef<T>).template;
if (template != null) {
ngDevMode && assertDataInRange(elementIndex);
const element = data ![elementIndex] as LElementNode;
ngDevMode && assertNodeType(element, LNodeFlags.Element);
ngDevMode && assertNotEqual(element.data, null, 'isComponent');
ngDevMode && assertDataInRange(directiveIndex);
const directive = data[directiveIndex];
const hostView = element.data !;
ngDevMode && assertNotEqual(hostView, null, 'hostView');
const oldView = enterView(hostView, element);
try {
template(directive, creationMode);
} finally {
refreshDynamicChildren();
leaveView(oldView);
}
}
};

View File

@ -67,18 +67,6 @@ export interface DirectiveDef<T> {
*/
n(): T;
/**
* Refreshes the view of the component. Also calls lifecycle hooks like
* ngAfterViewInit, if they are defined on the component.
*
* NOTE: this property is short (1 char) because it is used in component
* templates which is sensitive to size.
*
* @param directiveIndex index of the directive in the containing template
* @param elementIndex index of an host element for a given directive.
*/
r(directiveIndex: number, elementIndex: number): void;
/**
* Refreshes host bindings on the associated directive. Also calls lifecycle hooks
* like ngOnInit and ngDoCheck, if they are defined on the directive.
@ -94,18 +82,6 @@ export interface DirectiveDef<T> {
}
export interface ComponentDef<T> extends DirectiveDef<T> {
/**
* Refreshes the view of the component. Also calls lifecycle hooks like
* ngAfterViewInit, if they are defined on the component.
*
* NOTE: this property is short (1 char) because it is used in
* component templates which is sensitive to size.
*
* @param directiveIndex index of the directive in the containing template
* @param elementIndex index of an host element for a given component.
*/
r(directiveIndex: number, elementIndex: number): void;
/**
* The tag name which should be used by the component.
*
@ -142,19 +118,17 @@ export interface LifecycleHooksMap {
export interface DirectiveDefArgs<T> {
type: Type<T>;
factory: () => T;
refresh?: (directiveIndex: number, elementIndex: number) => void;
inputs?: {[P in keyof T]?: string};
outputs?: {[P in keyof T]?: string};
methods?: {[P in keyof T]?: string};
features?: DirectiveDefFeature[];
hostBindings?: (directiveIndex: number, elementIndex: number) => void;
exportAs?: string;
}
export interface ComponentDefArgs<T> extends DirectiveDefArgs<T> {
tag: string;
template: ComponentTemplate<T>;
refresh?: (directiveIndex: number, elementIndex: number) => void;
hostBindings?: (directiveIndex: number, elementIndex: number) => void;
features?: ComponentDefFeature[];
rendererType?: RendererType2;
}

View File

@ -98,8 +98,8 @@ describe('compiler specification', () => {
r3.e();
r3.T(3, '!');
}
ChildComponent.ngComponentDef.r(1, 0);
SomeDirective.ngDirectiveDef.r(2, 0);
r3.r(1, 0);
r3.r(2, 0);
}
});
// /NORMATIVE
@ -146,7 +146,7 @@ describe('compiler specification', () => {
}
let foo = r3.m<any>(1);
r3.cR(2);
IfDirective.ngDirectiveDef.r(3, 2);
r3.r(3, 2);
r3.cr();
function C1(ctx1: any, cm: boolean) {

View File

@ -7,7 +7,7 @@
*/
import {ViewEncapsulation} from '../../src/core';
import {E, T, b, defineComponent, e, markDirty, t} from '../../src/render3/index';
import {E, T, b, defineComponent, e, markDirty, r, t} from '../../src/render3/index';
import {createRendererType2} from '../../src/view/index';
import {getRendererFactory2} from './imported_renderer2';
@ -72,7 +72,7 @@ describe('encapsulation', () => {
e();
}
EncapsulatedComponent.ngComponentDef.h(1, 0);
EncapsulatedComponent.ngComponentDef.r(1, 0);
r(1, 0);
},
factory: () => new WrapperComponent,
});
@ -89,7 +89,7 @@ describe('encapsulation', () => {
e();
}
LeafComponent.ngComponentDef.h(2, 1);
LeafComponent.ngComponentDef.r(2, 1);
r(2, 1);
},
factory: () => new EncapsulatedComponent,
rendererType:
@ -137,7 +137,7 @@ describe('encapsulation', () => {
e();
}
LeafComponentwith.ngComponentDef.h(1, 0);
LeafComponentwith.ngComponentDef.r(1, 0);
r(1, 0);
},
factory: () => new WrapperComponentWith,
rendererType:

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {C, E, P, T, V, cR, cr, detectChanges, e, m, pD, v} from '../../src/render3/index';
import {C, E, P, T, V, cR, cr, detectChanges, e, m, pD, r, v} from '../../src/render3/index';
import {createComponent, renderComponent, toHtml} from './render_util';
@ -35,7 +35,7 @@ describe('content projection', () => {
e();
}
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><div>content</div></child>');
@ -55,7 +55,7 @@ describe('content projection', () => {
e();
}
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child>content</child>');
@ -77,7 +77,7 @@ describe('content projection', () => {
{ P(3, 0); }
e();
GrandChild.ngComponentDef.h(2, 1);
GrandChild.ngComponentDef.r(2, 1);
r(2, 1);
}
});
const Parent = createComponent('parent', function(ctx: any, cm: boolean) {
@ -92,7 +92,7 @@ describe('content projection', () => {
e();
}
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
expect(toHtml(parent))
@ -133,8 +133,8 @@ describe('content projection', () => {
}
Child.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
ProjectedComp.ngComponentDef.r(3, 2);
Child.ngComponentDef.r(1, 0);
r(3, 2);
r(1, 0);
});
const parent = renderComponent(Parent);
expect(toHtml(parent))
@ -171,7 +171,7 @@ describe('content projection', () => {
}
cr();
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><div>()</div></child>');
@ -207,7 +207,7 @@ describe('content projection', () => {
}
cr();
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child></child>');
@ -256,7 +256,7 @@ describe('content projection', () => {
}
cr();
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><div>(else)</div></child>');
@ -314,7 +314,7 @@ describe('content projection', () => {
e();
}
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><div><span>content</span></div></child>');
@ -367,7 +367,7 @@ describe('content projection', () => {
e();
}
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><div>content</div></child>');
@ -404,7 +404,7 @@ describe('content projection', () => {
e();
}
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><div></div><span>content</span></child>');
@ -462,7 +462,7 @@ describe('content projection', () => {
e();
}
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child>content<div></div></child>');
@ -511,7 +511,7 @@ describe('content projection', () => {
e();
}
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
@ -557,7 +557,7 @@ describe('content projection', () => {
e();
}
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
@ -603,7 +603,7 @@ describe('content projection', () => {
e();
}
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
@ -649,7 +649,7 @@ describe('content projection', () => {
e();
}
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
@ -696,7 +696,7 @@ describe('content projection', () => {
e();
}
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
@ -743,8 +743,8 @@ describe('content projection', () => {
}
e();
}
Child.ngComponentDef.h(0, 0);
Child.ngComponentDef.r(0, 0);
Child.ngComponentDef.h(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
@ -792,7 +792,7 @@ describe('content projection', () => {
}
e();
GrandChild.ngComponentDef.h(2, 1);
GrandChild.ngComponentDef.r(2, 1);
r(2, 1);
}
});
@ -814,7 +814,7 @@ describe('content projection', () => {
e();
}
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
@ -863,7 +863,7 @@ describe('content projection', () => {
}
cr();
Child.ngComponentDef.h(1, 0);
Child.ngComponentDef.r(1, 0);
r(1, 0);
});
const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><span><div>content</div></span></child>');

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {E, b, defineDirective, e, m, p} from '../../src/render3/index';
import {E, b, defineDirective, e, m, p, r} from '../../src/render3/index';
import {renderToHtml} from './render_util';
@ -22,7 +22,7 @@ describe('directive', () => {
static ngDirectiveDef = defineDirective({
type: Directive,
factory: () => directiveInstance = new Directive,
refresh: (directiveIndex: number, elementIndex: number) => {
hostBindings: (directiveIndex: number, elementIndex: number) => {
p(elementIndex, 'className', b(m<Directive>(directiveIndex).klass));
}
});
@ -33,7 +33,8 @@ describe('directive', () => {
E(0, 'span', null, [Directive]);
e();
}
Directive.ngDirectiveDef.r(1, 0);
Directive.ngDirectiveDef.h(1, 0);
r(1, 0);
}
expect(renderToHtml(Template, {})).toEqual('<span class="foo"></span>');

View File

@ -234,7 +234,7 @@ describe('render3 integration test', () => {
e();
}
TodoComponent.ngComponentDef.h(1, 0);
TodoComponent.ngComponentDef.r(1, 0);
r(1, 0);
}
expect(renderToHtml(Template, null)).toEqual('<todo><p>Todo one</p></todo>');
@ -248,7 +248,7 @@ describe('render3 integration test', () => {
T(2, 'two');
}
TodoComponent.ngComponentDef.h(1, 0);
TodoComponent.ngComponentDef.r(1, 0);
r(1, 0);
}
expect(renderToHtml(Template, null)).toEqual('<todo><p>Todo one</p></todo>two');
});
@ -267,8 +267,8 @@ describe('render3 integration test', () => {
}
TodoComponent.ngComponentDef.h(1, 0);
TodoComponent.ngComponentDef.h(3, 2);
TodoComponent.ngComponentDef.r(1, 0);
TodoComponent.ngComponentDef.r(3, 2);
r(1, 0);
r(3, 2);
}
expect(renderToHtml(Template, null))
.toEqual('<todo><p>Todo one</p></todo><todo><p>Todo one</p></todo>');
@ -303,7 +303,7 @@ describe('render3 integration test', () => {
e();
}
TodoComponentHostBinding.ngComponentDef.h(1, 0);
TodoComponentHostBinding.ngComponentDef.r(1, 0);
r(1, 0);
}
expect(renderToHtml(Template, {})).toEqual('<todo title="one">one</todo>');
@ -336,7 +336,7 @@ describe('render3 integration test', () => {
e();
}
MyComp.ngComponentDef.h(1, 0);
MyComp.ngComponentDef.r(1, 0);
r(1, 0);
}
expect(renderToHtml(Template, null)).toEqual('<comp><p>Bess</p></comp>');
@ -383,7 +383,7 @@ describe('render3 integration test', () => {
}
p(0, 'condition', b(ctx.condition));
MyComp.ngComponentDef.h(1, 0);
MyComp.ngComponentDef.r(1, 0);
r(1, 0);
}
expect(renderToHtml(Template, {condition: true})).toEqual('<comp><div>text</div></comp>');

View File

@ -20,7 +20,7 @@ describe('lifecycles', () => {
}
p(0, 'val', b(ctx.val));
type.ngComponentDef.h(1, 0);
type.ngComponentDef.r(1, 0);
r(1, 0);
};
}
@ -68,7 +68,7 @@ describe('lifecycles', () => {
}
p(0, 'val', b(ctx.val));
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {val: '1'});
@ -90,7 +90,7 @@ describe('lifecycles', () => {
e();
}
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {});
@ -116,8 +116,8 @@ describe('lifecycles', () => {
p(2, 'val', 2);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2);
Parent.ngComponentDef.r(1, 0);
Parent.ngComponentDef.r(3, 2);
r(1, 0);
r(3, 2);
}
renderToHtml(Template, {});
@ -144,7 +144,7 @@ describe('lifecycles', () => {
e();
}
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
@ -175,8 +175,8 @@ describe('lifecycles', () => {
}
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
ProjectedComp.ngComponentDef.r(3, 2);
Comp.ngComponentDef.r(1, 0);
r(3, 2);
r(1, 0);
}
renderToHtml(Template, {});
@ -209,10 +209,10 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6);
ProjectedComp.ngComponentDef.r(3, 2);
Comp.ngComponentDef.r(1, 0);
ProjectedComp.ngComponentDef.r(7, 6);
Comp.ngComponentDef.r(5, 4);
r(3, 2);
r(1, 0);
r(7, 6);
r(5, 4);
}
renderToHtml(Template, {});
@ -232,7 +232,7 @@ describe('lifecycles', () => {
e();
}
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {});
@ -273,13 +273,13 @@ describe('lifecycles', () => {
}
p(0, 'val', j);
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
cr();
Comp.ngComponentDef.r(1, 0);
Comp.ngComponentDef.r(4, 3);
r(1, 0);
r(4, 3);
}
renderToHtml(Template, {});
@ -319,13 +319,13 @@ describe('lifecycles', () => {
}
p(0, 'val', j);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
cr();
Parent.ngComponentDef.r(1, 0);
Parent.ngComponentDef.r(4, 3);
r(1, 0);
r(4, 3);
}
renderToHtml(Template, {});
@ -375,7 +375,7 @@ describe('lifecycles', () => {
e();
}
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {});
@ -397,7 +397,7 @@ describe('lifecycles', () => {
e();
}
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {});
@ -412,7 +412,7 @@ describe('lifecycles', () => {
e();
}
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {});
@ -449,7 +449,7 @@ describe('lifecycles', () => {
}
p(1, 'val', b(ctx.val));
Comp.ngComponentDef.h(2, 1);
Comp.ngComponentDef.r(2, 1);
r(2, 1);
});
let ProjectedComp = createAfterContentInitComp('projected', (ctx: any, cm: boolean) => {
@ -487,7 +487,7 @@ describe('lifecycles', () => {
e();
}
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {});
@ -516,7 +516,7 @@ describe('lifecycles', () => {
e();
}
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
@ -546,7 +546,7 @@ describe('lifecycles', () => {
e();
}
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {});
@ -570,7 +570,7 @@ describe('lifecycles', () => {
e();
}
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {});
@ -597,8 +597,8 @@ describe('lifecycles', () => {
p(3, 'val', 2);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(4, 3);
Parent.ngComponentDef.r(1, 0);
Parent.ngComponentDef.r(4, 3);
r(1, 0);
r(4, 3);
}
renderToHtml(Template, {});
@ -628,8 +628,8 @@ describe('lifecycles', () => {
}
Parent.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
ProjectedComp.ngComponentDef.r(3, 2);
Parent.ngComponentDef.r(1, 0);
r(3, 2);
r(1, 0);
}
renderToHtml(Template, {});
@ -675,10 +675,10 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2);
Parent.ngComponentDef.h(6, 5);
ProjectedComp.ngComponentDef.h(8, 7);
ProjectedComp.ngComponentDef.r(3, 2);
Parent.ngComponentDef.r(1, 0);
ProjectedComp.ngComponentDef.r(8, 7);
Parent.ngComponentDef.r(6, 5);
r(3, 2);
r(1, 0);
r(8, 7);
r(6, 5);
}
renderToHtml(Template, {});
@ -717,13 +717,13 @@ describe('lifecycles', () => {
}
p(0, 'val', i);
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
cr();
Comp.ngComponentDef.r(1, 0);
Comp.ngComponentDef.r(5, 4);
r(1, 0);
r(5, 4);
}
renderToHtml(Template, {});
@ -754,13 +754,13 @@ describe('lifecycles', () => {
}
p(0, 'val', i);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
cr();
Parent.ngComponentDef.r(1, 0);
Parent.ngComponentDef.r(5, 4);
r(1, 0);
r(5, 4);
}
it('should be called in correct order in a for loop with children', () => {
@ -788,7 +788,7 @@ describe('lifecycles', () => {
e();
}
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {});
@ -854,7 +854,7 @@ describe('lifecycles', () => {
e();
}
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {});
@ -882,7 +882,7 @@ describe('lifecycles', () => {
e();
}
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
@ -912,7 +912,7 @@ describe('lifecycles', () => {
e();
}
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {});
@ -938,8 +938,8 @@ describe('lifecycles', () => {
p(2, 'val', 2);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2);
Parent.ngComponentDef.r(1, 0);
Parent.ngComponentDef.r(3, 2);
r(1, 0);
r(3, 2);
}
renderToHtml(Template, {});
expect(events).toEqual(['comp1', 'comp2', 'parent1', 'parent2']);
@ -963,8 +963,8 @@ describe('lifecycles', () => {
}
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
ProjectedComp.ngComponentDef.r(3, 2);
Comp.ngComponentDef.r(1, 0);
r(3, 2);
r(1, 0);
}
renderToHtml(Template, {});
@ -1003,10 +1003,10 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6);
ProjectedComp.ngComponentDef.r(3, 2);
Comp.ngComponentDef.r(1, 0);
ProjectedComp.ngComponentDef.r(7, 6);
Comp.ngComponentDef.r(5, 4);
r(3, 2);
r(1, 0);
r(7, 6);
r(5, 4);
}
renderToHtml(Template, {});
@ -1032,8 +1032,8 @@ describe('lifecycles', () => {
p(2, 'val', b(ctx.val));
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
ProjectedComp.ngComponentDef.r(3, 2);
Comp.ngComponentDef.r(1, 0);
r(3, 2);
r(1, 0);
});
/**
@ -1051,8 +1051,8 @@ describe('lifecycles', () => {
p(2, 'val', 2);
ParentComp.ngComponentDef.h(1, 0);
ParentComp.ngComponentDef.h(3, 2);
ParentComp.ngComponentDef.r(1, 0);
ParentComp.ngComponentDef.r(3, 2);
r(1, 0);
r(3, 2);
}
renderToHtml(Template, {});
@ -1088,13 +1088,13 @@ describe('lifecycles', () => {
}
p(0, 'val', i);
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
cr();
Comp.ngComponentDef.r(1, 0);
Comp.ngComponentDef.r(4, 3);
r(1, 0);
r(4, 3);
}
renderToHtml(Template, {});
@ -1131,13 +1131,13 @@ describe('lifecycles', () => {
}
p(0, 'val', i);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
cr();
Parent.ngComponentDef.r(1, 0);
Parent.ngComponentDef.r(4, 3);
r(1, 0);
r(4, 3);
}
renderToHtml(Template, {});
@ -1157,7 +1157,7 @@ describe('lifecycles', () => {
e();
}
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {});
@ -1176,7 +1176,7 @@ describe('lifecycles', () => {
}
p(0, 'val', b(ctx.myVal));
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
}
renderToHtml(Template, {myVal: 5});
@ -1215,13 +1215,13 @@ describe('lifecycles', () => {
}
p(0, 'val', i);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
cr();
Parent.ngComponentDef.r(1, 0);
Parent.ngComponentDef.r(4, 3);
r(1, 0);
r(4, 3);
}
renderToHtml(Template, {});
@ -1284,7 +1284,7 @@ describe('lifecycles', () => {
e();
}
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
@ -1321,8 +1321,8 @@ describe('lifecycles', () => {
p(2, 'val', b('2'));
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.r(1, 0);
Comp.ngComponentDef.r(3, 2);
r(1, 0);
r(3, 2);
v();
}
}
@ -1355,7 +1355,7 @@ describe('lifecycles', () => {
e();
}
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
@ -1383,7 +1383,7 @@ describe('lifecycles', () => {
e();
}
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.r(1, 0);
r(1, 0);
});
function Template(ctx: any, cm: boolean) {
@ -1398,7 +1398,7 @@ describe('lifecycles', () => {
e();
}
Grandparent.ngComponentDef.h(1, 0);
Grandparent.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
@ -1452,10 +1452,10 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6);
ProjectedComp.ngComponentDef.r(3, 2);
Comp.ngComponentDef.r(1, 0);
ProjectedComp.ngComponentDef.r(7, 6);
Comp.ngComponentDef.r(5, 4);
r(3, 2);
r(1, 0);
r(7, 6);
r(5, 4);
v();
}
}
@ -1507,13 +1507,13 @@ describe('lifecycles', () => {
}
p(0, 'val', b('2'));
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
cr();
Comp.ngComponentDef.r(1, 0);
Comp.ngComponentDef.r(4, 3);
r(1, 0);
r(4, 3);
v();
}
}
@ -1583,13 +1583,13 @@ describe('lifecycles', () => {
}
p(0, 'val', b(j));
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
cr();
Comp.ngComponentDef.r(1, 0);
Comp.ngComponentDef.r(4, 3);
r(1, 0);
r(4, 3);
v();
}
}
@ -1658,7 +1658,7 @@ describe('lifecycles', () => {
e();
}
Comp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.r(3, 2);
r(3, 2);
v();
}
}
@ -1737,8 +1737,8 @@ describe('lifecycles', () => {
p(2, 'val', 2);
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.r(1, 0);
Comp.ngComponentDef.r(3, 2);
r(1, 0);
r(3, 2);
}
renderToHtml(Template, {});
@ -1767,7 +1767,7 @@ describe('lifecycles', () => {
}
p(0, 'val', b(ctx.val));
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
});
/**
@ -1785,8 +1785,8 @@ describe('lifecycles', () => {
p(2, 'val', 2);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2);
Parent.ngComponentDef.r(1, 0);
Parent.ngComponentDef.r(3, 2);
r(1, 0);
r(3, 2);
}
renderToHtml(Template, {});

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {C, E, L, T, V, cR, cr, defineComponent, e, v} from '../../src/render3/index';
import {C, E, L, T, V, cR, cr, defineComponent, e, r, v} from '../../src/render3/index';
import {containerEl, renderComponent, renderToHtml} from './render_util';
@ -208,8 +208,8 @@ describe('event listeners', () => {
}
MyComp.ngComponentDef.h(2, 1);
MyComp.ngComponentDef.h(4, 3);
MyComp.ngComponentDef.r(2, 1);
MyComp.ngComponentDef.r(4, 3);
r(2, 1);
r(4, 3);
v();
}
}

View File

@ -8,7 +8,7 @@
import {EventEmitter} from '@angular/core';
import {C, E, L, T, V, b, cR, cr, defineComponent, defineDirective, e, p, v} from '../../src/render3/index';
import {C, E, L, T, V, b, cR, cr, defineComponent, defineDirective, e, p, r, v} from '../../src/render3/index';
import {containerEl, renderToHtml} from './render_util';
@ -49,7 +49,7 @@ describe('outputs', () => {
e();
}
ButtonToggle.ngComponentDef.h(1, 0);
ButtonToggle.ngComponentDef.r(1, 0);
r(1, 0);
}
let counter = 0;
@ -75,7 +75,7 @@ describe('outputs', () => {
e();
}
ButtonToggle.ngComponentDef.h(1, 0);
ButtonToggle.ngComponentDef.r(1, 0);
r(1, 0);
}
let counter = 0;
@ -99,7 +99,7 @@ describe('outputs', () => {
e();
}
ButtonToggle.ngComponentDef.h(1, 0);
ButtonToggle.ngComponentDef.r(1, 0);
r(1, 0);
}
const ctx = {counter: 0};
@ -133,7 +133,7 @@ describe('outputs', () => {
e();
}
ButtonToggle.ngComponentDef.h(1, 0);
ButtonToggle.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
@ -183,7 +183,7 @@ describe('outputs', () => {
e();
}
ButtonToggle.ngComponentDef.h(1, 0);
ButtonToggle.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}
@ -252,8 +252,8 @@ describe('outputs', () => {
}
ButtonToggle.ngComponentDef.h(3, 2);
DestroyComp.ngComponentDef.h(5, 4);
ButtonToggle.ngComponentDef.r(3, 2);
DestroyComp.ngComponentDef.r(5, 4);
r(3, 2);
r(5, 4);
v();
}
}
@ -326,7 +326,7 @@ describe('outputs', () => {
e();
}
ButtonToggle.ngComponentDef.h(1, 0);
ButtonToggle.ngComponentDef.r(1, 0);
r(1, 0);
}
let counter = 0;
@ -358,7 +358,7 @@ describe('outputs', () => {
}
p(0, 'change', b(ctx.change));
ButtonToggle.ngComponentDef.h(1, 0);
ButtonToggle.ngComponentDef.r(1, 0);
r(1, 0);
}
let counter = 0;
@ -401,7 +401,7 @@ describe('outputs', () => {
e();
}
ButtonToggle.ngComponentDef.h(1, 0);
ButtonToggle.ngComponentDef.r(1, 0);
r(1, 0);
v();
} else {
if (V(1)) {

View File

@ -8,7 +8,7 @@
import {EventEmitter} from '@angular/core';
import {C, E, L, T, V, b, b1, cR, cr, defineComponent, defineDirective, e, m, p, t, v} from '../../src/render3/index';
import {C, E, L, T, V, b, b1, cR, cr, defineComponent, defineDirective, e, m, p, r, t, v} from '../../src/render3/index';
import {NO_CHANGE} from '../../src/render3/instructions';
import {renderToHtml} from './render_util';
@ -157,7 +157,7 @@ describe('elementProperty', () => {
}
p(0, 'id', b(ctx.id));
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
}
expect(renderToHtml(Template, {id: 1})).toEqual(`<comp></comp>`);
@ -502,7 +502,7 @@ describe('elementProperty', () => {
e();
}
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.r(1, 0);
r(1, 0);
v();
}
}

View File

@ -10,7 +10,7 @@ import {AnimationEvent} from '@angular/animations';
import {MockAnimationDriver, MockAnimationPlayer} from '@angular/animations/browser/testing';
import {RendererType2, ViewEncapsulation} from '../../src/core';
import {E, L, T, b, defineComponent, detectChanges, e, p} from '../../src/render3/index';
import {E, L, T, b, defineComponent, detectChanges, e, p, r} from '../../src/render3/index';
import {createRendererType2} from '../../src/view/index';
import {getAnimationRendererFactory2, getRendererFactory2} from './imported_renderer2';
@ -67,7 +67,7 @@ describe('renderer factory lifecycle', () => {
e();
}
SomeComponent.ngComponentDef.h(2, 1);
SomeComponent.ngComponentDef.r(2, 1);
r(2, 1);
}
beforeEach(() => { logs = []; });