refactor(ivy): prefix viewStart & viewEnd with embedded (#22055)

PR Close #22055
This commit is contained in:
Victor Berchet 2018-02-06 17:27:16 -08:00 committed by Miško Hevery
parent 8feb8e5408
commit 10a014d89e
14 changed files with 196 additions and 195 deletions

View File

@ -59,8 +59,8 @@ export {
text as T,
textBinding as t,
viewStart as V,
viewEnd as v,
embeddedViewStart as V,
embeddedViewEnd as v,
} from './instructions';
export {

View File

@ -1091,12 +1091,12 @@ function refreshDynamicChildren() {
}
/**
* Creates an LViewNode.
* Marks the start of an embedded view.
*
* @param viewBlockId The ID of this view
* @return Whether or not this view is in creation mode
* @return boolean Whether or not this view is in creation mode
*/
export function viewStart(viewBlockId: number): boolean {
export function embeddedViewStart(viewBlockId: number): boolean {
const container =
(isParent ? previousOrParentNode : previousOrParentNode.parent !) as LContainerNode;
ngDevMode && assertNodeType(container, LNodeFlags.Container);
@ -1148,8 +1148,8 @@ function getOrCreateEmbeddedTView(viewIndex: number, parent: LContainerNode): TV
return tContainer[viewIndex];
}
/** Marks the end of the LViewNode. */
export function viewEnd(): void {
/** Marks the end of an embedded view. */
export function embeddedViewEnd(): void {
isParent = false;
const viewNode = previousOrParentNode = currentView.node as LViewNode;
const container = previousOrParentNode.parent as LContainerNode;

View File

@ -7,7 +7,7 @@
*/
import {defineComponent} from '../../src/render3/index';
import {container, containerRefreshEnd, containerRefreshStart, elementEnd, elementStart, text, viewEnd, viewStart} from '../../src/render3/instructions';
import {container, containerRefreshEnd, containerRefreshStart, elementEnd, elementStart, embeddedViewEnd, embeddedViewStart, text} from '../../src/render3/instructions';
import {document, renderComponent} from './render_util';
@ -42,7 +42,7 @@ describe('iv perf test', () => {
containerRefreshStart(0);
{
for (let i = 0; i < count; i++) {
let cm0 = viewStart(0);
let cm0 = embeddedViewStart(0);
{
if (cm0) {
elementStart(0, 'div');
@ -50,7 +50,7 @@ describe('iv perf test', () => {
elementEnd();
}
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();

View File

@ -8,7 +8,7 @@
import {ViewEncapsulation} from '../../src/core';
import {defineComponent, markDirty} from '../../src/render3/index';
import {bind, componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, text, textBinding, viewEnd, viewStart} from '../../src/render3/instructions';
import {bind, componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, text, textBinding} from '../../src/render3/instructions';
import {createRendererType2} from '../../src/view/index';
import {getRendererFactory2} from './imported_renderer2';
@ -69,14 +69,14 @@ describe('component with a container', () => {
containerRefreshStart(0);
{
for (const item of ctx.items) {
const cm0 = viewStart(0);
const cm0 = embeddedViewStart(0);
{
if (cm0) {
text(0);
}
textBinding(0, bind(item));
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -93,9 +93,9 @@ describe('component with a container', () => {
}
containerRefreshStart(0);
{
const cm0 = viewStart(0);
const cm0 = embeddedViewStart(0);
{ showItems({items: ctx.items}, cm0); }
viewEnd();
embeddedViewEnd();
}
containerRefreshEnd();
},

View File

@ -7,7 +7,7 @@
*/
import {detectChanges} from '../../src/render3/index';
import {componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementStart, memory, projection, projectionDef, text, viewEnd, viewStart} from '../../src/render3/instructions';
import {componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementStart, embeddedViewEnd, embeddedViewStart, memory, projection, projectionDef, text} from '../../src/render3/instructions';
import {createComponent, renderComponent, toHtml} from './render_util';
@ -164,10 +164,10 @@ describe('content projection', () => {
containerRefreshStart(3);
{
if (ctx.value) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
text(0, 'content');
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -200,10 +200,10 @@ describe('content projection', () => {
containerRefreshStart(2);
{
if (ctx.value) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
text(0, 'content');
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -244,15 +244,15 @@ describe('content projection', () => {
containerRefreshStart(3);
{
if (ctx.value) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
text(0, 'content');
}
viewEnd();
embeddedViewEnd();
} else {
if (viewStart(1)) {
if (embeddedViewStart(1)) {
text(0, 'else');
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -291,12 +291,12 @@ describe('content projection', () => {
containerRefreshStart(2);
{
if (!ctx.skipContent) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, 'span');
projection(1, 0);
elementEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -346,10 +346,10 @@ describe('content projection', () => {
containerRefreshStart(2);
{
if (!ctx.skipContent) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
projection(0, 0);
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -399,12 +399,12 @@ describe('content projection', () => {
containerRefreshStart(2);
{
if (!ctx.skipContent) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
text(0, 'before-');
projection(1, 0);
text(2, '-after');
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -496,10 +496,10 @@ describe('content projection', () => {
containerRefreshStart(3);
{
if (ctx.show) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
projection(0, 0);
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -972,12 +972,12 @@ describe('content projection', () => {
containerRefreshStart(2);
{
if (true) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, 'div');
{ text(1, 'content'); }
elementEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {bind, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementStart, text, textBinding, viewEnd, viewStart} from '../../src/render3/instructions';
import {bind, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementStart, embeddedViewEnd, embeddedViewStart, text, textBinding} from '../../src/render3/instructions';
import {renderToHtml} from './render_util';
@ -23,7 +23,7 @@ describe('JS control flow', () => {
containerRefreshStart(1);
{
if (ctx.condition) {
let cm1 = viewStart(1);
let cm1 = embeddedViewStart(1);
{
if (cm1) {
elementStart(0, 'span');
@ -32,7 +32,7 @@ describe('JS control flow', () => {
}
textBinding(1, bind(ctx.message));
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -71,7 +71,7 @@ describe('JS control flow', () => {
containerRefreshStart(1);
{
if (ctx.condition) {
let cm1 = viewStart(1);
let cm1 = embeddedViewStart(1);
{
if (cm1) {
elementStart(0, 'span');
@ -81,18 +81,18 @@ describe('JS control flow', () => {
containerRefreshStart(1);
{
if (ctx.condition2) {
let cm2 = viewStart(2);
let cm2 = embeddedViewStart(2);
{
if (cm2) {
text(0, 'Hello');
}
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -136,7 +136,7 @@ describe('JS control flow', () => {
containerRefreshStart(2);
{
if (ctx.condition1) {
let cm0 = viewStart(0);
let cm0 = embeddedViewStart(0);
{
if (cm0) {
container(0);
@ -144,18 +144,18 @@ describe('JS control flow', () => {
containerRefreshStart(0);
{
if (ctx.condition2) {
let cm0 = viewStart(0);
let cm0 = embeddedViewStart(0);
{
if (cm0) {
text(0, 'world');
}
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -180,7 +180,7 @@ describe('JS control flow', () => {
containerRefreshStart(1);
{
for (let i = 0; i < ctx.data.length; i++) {
let cm1 = viewStart(1);
let cm1 = embeddedViewStart(1);
{
if (cm1) {
elementStart(0, 'li');
@ -189,7 +189,7 @@ describe('JS control flow', () => {
}
textBinding(1, bind(ctx.data[i]));
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -226,7 +226,7 @@ describe('JS control flow', () => {
containerRefreshStart(1);
{
for (let i = 0; i < ctx.data[0].length; i++) {
let cm1 = viewStart(1);
let cm1 = embeddedViewStart(1);
{
if (cm1) {
elementStart(0, 'li');
@ -236,16 +236,16 @@ describe('JS control flow', () => {
containerRefreshStart(1);
{
ctx.data[1].forEach((value: string, ind: number) => {
if (viewStart(2)) {
if (embeddedViewStart(2)) {
text(0);
}
textBinding(0, bind(ctx.data[0][i] + value));
viewEnd();
embeddedViewEnd();
});
}
containerRefreshEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -285,7 +285,7 @@ describe('JS control flow', () => {
containerRefreshStart(2);
{
for (let i = 0; i < ctx.cafes.length; i++) {
let cm1 = viewStart(1);
let cm1 = embeddedViewStart(1);
{
if (cm1) {
elementStart(0, 'h2');
@ -298,16 +298,16 @@ describe('JS control flow', () => {
containerRefreshStart(2);
{
for (let j = 0; j < ctx.cafes[i].entrees.length; j++) {
if (viewStart(1)) {
if (embeddedViewStart(1)) {
text(0);
}
textBinding(0, bind(ctx.cafes[i].entrees[j]));
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -365,7 +365,7 @@ describe('JS control flow', () => {
containerRefreshStart(2);
{
for (let i = 0; i < ctx.cafes.length; i++) {
let cm1 = viewStart(1);
let cm1 = embeddedViewStart(1);
{
if (cm1) {
elementStart(0, 'h2');
@ -378,7 +378,7 @@ describe('JS control flow', () => {
containerRefreshStart(2);
{
for (let j = 0; j < ctx.cafes[i].entrees.length; j++) {
let cm1 = viewStart(1);
let cm1 = embeddedViewStart(1);
{
if (cm1) {
elementStart(0, 'h3');
@ -390,21 +390,21 @@ describe('JS control flow', () => {
containerRefreshStart(2);
{
for (let k = 0; k < ctx.cafes[i].entrees[j].foods.length; k++) {
if (viewStart(1)) {
if (embeddedViewStart(1)) {
text(0);
}
textBinding(0, bind(ctx.cafes[i].entrees[j].foods[k]));
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -451,7 +451,7 @@ describe('JS control flow', () => {
containerRefreshStart(1);
{
if (ctx.condition) {
let cm1 = viewStart(1);
let cm1 = embeddedViewStart(1);
{
if (cm1) {
elementStart(0, 'span');
@ -459,9 +459,9 @@ describe('JS control flow', () => {
elementEnd();
}
}
viewEnd();
embeddedViewEnd();
} else {
let cm2 = viewStart(2);
let cm2 = embeddedViewStart(2);
{
if (cm2) {
elementStart(0, 'div');
@ -469,7 +469,7 @@ describe('JS control flow', () => {
elementEnd();
}
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -499,18 +499,18 @@ describe('JS for loop', () => {
containerRefreshStart(1);
{
for (let i = 0; i < ctx.data1.length; i++) {
if (viewStart(1)) {
if (embeddedViewStart(1)) {
text(0);
}
textBinding(0, bind(ctx.data1[i]));
viewEnd();
embeddedViewEnd();
}
for (let j = 0; j < ctx.data2.length; j++) {
if (viewStart(2)) {
if (embeddedViewStart(2)) {
text(0);
}
textBinding(0, bind(ctx.data2[j]));
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -556,16 +556,16 @@ describe('function calls', () => {
}
containerRefreshStart(2);
{
let cm0 = viewStart(0);
let cm0 = embeddedViewStart(0);
{ spanify({message: ctx.data[0]}, cm0); }
viewEnd();
embeddedViewEnd();
}
containerRefreshEnd();
containerRefreshStart(3);
{
let cm0 = viewStart(0);
let cm0 = embeddedViewStart(0);
{ spanify({message: ctx.data[1]}, cm0); }
viewEnd();
embeddedViewEnd();
}
containerRefreshEnd();
}

View File

@ -11,7 +11,7 @@ import {ElementRef, TemplateRef, ViewContainerRef} from '@angular/core';
import {defineComponent} from '../../src/render3/definition';
import {InjectFlags, bloomAdd, bloomFindPossibleInjector, getOrCreateNodeInjector} from '../../src/render3/di';
import {PublicFeature, defineDirective, inject, injectElementRef, injectTemplateRef, injectViewContainerRef} from '../../src/render3/index';
import {bind, bind2, container, containerRefreshEnd, containerRefreshStart, createLNode, createLView, createTView, elementEnd, elementStart, enterView, leaveView, memory, text, textBinding, viewEnd, viewStart} from '../../src/render3/instructions';
import {bind, bind2, container, containerRefreshEnd, containerRefreshStart, createLNode, createLView, createTView, elementEnd, elementStart, embeddedViewEnd, embeddedViewStart, enterView, leaveView, memory, text, textBinding} from '../../src/render3/instructions';
import {LInjector} from '../../src/render3/interfaces/injector';
import {LNodeFlags} from '../../src/render3/interfaces/node';
@ -297,7 +297,7 @@ describe('di', () => {
}
containerRefreshStart(2);
{
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, 'span', null, [ChildDirective, Child2Directive]);
{ text(3); }
elementEnd();
@ -306,7 +306,7 @@ describe('di', () => {
3,
bind2(
'', memory<ChildDirective>(1).value, '-', memory<Child2Directive>(2).value, ''));
viewEnd();
embeddedViewEnd();
}
containerRefreshEnd();
}

View File

@ -7,7 +7,7 @@
*/
import {defineComponent, defineDirective} from '../../src/render3/index';
import {bind, container, containerRefreshEnd, containerRefreshStart, elementAttribute, elementClass, elementEnd, elementProperty, elementStart, memory, text, textBinding, viewEnd, viewStart} from '../../src/render3/instructions';
import {bind, container, containerRefreshEnd, containerRefreshStart, elementAttribute, elementClass, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, memory, text, textBinding} from '../../src/render3/instructions';
import {renderToHtml} from './render_util';
@ -261,7 +261,7 @@ describe('exports', () => {
containerRefreshStart(1);
{
if (ctx.condition) {
let cm1 = viewStart(1);
let cm1 = embeddedViewStart(1);
{
if (cm1) {
text(0);
@ -271,7 +271,7 @@ describe('exports', () => {
let myInput = elementStart(1);
textBinding(0, bind(myInput && (myInput as any).value));
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();

View File

@ -7,7 +7,7 @@
*/
import {defineComponent} from '../../src/render3/index';
import {NO_CHANGE, bind, bind1, bind2, bind3, bind4, bind5, bind6, bind7, bind8, bindV, componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementAttribute, elementClass, elementEnd, elementProperty, elementStart, elementStyle, memory, projection, projectionDef, text, textBinding, viewEnd, viewStart} from '../../src/render3/instructions';
import {NO_CHANGE, bind, bind1, bind2, bind3, bind4, bind5, bind6, bind7, bind8, bindV, componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementAttribute, elementClass, elementEnd, elementProperty, elementStart, elementStyle, embeddedViewEnd, embeddedViewStart, memory, projection, projectionDef, text, textBinding} from '../../src/render3/instructions';
import {containerEl, renderToHtml} from './render_util';
@ -367,12 +367,12 @@ describe('render3 integration test', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, 'div');
{ text(1, 'text'); }
elementEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -420,11 +420,11 @@ describe('render3 integration test', () => {
containerRefreshStart(0);
{
if (ctx.label != null) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
text(0);
}
textBinding(0, bind(ctx.label));
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -438,25 +438,25 @@ describe('render3 integration test', () => {
}
containerRefreshStart(0);
{
const cm0 = viewStart(0);
const cm0 = embeddedViewStart(0);
{ showLabel({label: ctx.tree.beforeLabel}, cm0); }
viewEnd();
embeddedViewEnd();
}
containerRefreshEnd();
containerRefreshStart(1);
{
for (let subTree of ctx.tree.subTrees || []) {
const cm0 = viewStart(0);
const cm0 = embeddedViewStart(0);
{ showTree({tree: subTree}, cm0); }
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
containerRefreshStart(2);
{
const cm0 = viewStart(0);
const cm0 = embeddedViewStart(0);
{ showLabel({label: ctx.tree.afterLabel}, cm0); }
viewEnd();
embeddedViewEnd();
}
containerRefreshEnd();
}
@ -477,16 +477,16 @@ describe('render3 integration test', () => {
}
containerRefreshStart(1);
{
const cm0 = viewStart(0);
const cm0 = embeddedViewStart(0);
{ showTree({tree: ctx.beforeTree}, cm0); }
viewEnd();
embeddedViewEnd();
}
containerRefreshEnd();
containerRefreshStart(3);
{
const cm0 = viewStart(0);
const cm0 = embeddedViewStart(0);
{ showTree({tree: ctx.afterTree}, cm0); }
viewEnd();
embeddedViewEnd();
}
containerRefreshEnd();
},
@ -505,9 +505,9 @@ describe('render3 integration test', () => {
elementProperty(0, 'afterTree', bind(ctx.afterTree));
containerRefreshStart(2);
{
const cm0 = viewStart(0);
const cm0 = embeddedViewStart(0);
{ showTree({tree: ctx.projectedTree}, cm0); }
viewEnd();
embeddedViewEnd();
}
containerRefreshEnd();
ChildComponent.ngComponentDef.h(1, 0);
@ -633,7 +633,7 @@ describe('render3 integration test', () => {
containerRefreshStart(1);
{
if (true) {
let cm1 = viewStart(1);
let cm1 = embeddedViewStart(1);
{
if (cm1) {
elementStart(0, 'b');
@ -642,7 +642,7 @@ describe('render3 integration test', () => {
}
elementAttribute(0, 'title', bind(ctx.title));
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -747,12 +747,12 @@ describe('render3 integration test', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, 'div');
{}
elementEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();

View File

@ -7,7 +7,7 @@
*/
import {ComponentTemplate, defineComponent, defineDirective} from '../../src/render3/index';
import {bind, componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, listener, memory, projection, projectionDef, text, viewEnd, viewStart} from '../../src/render3/instructions';
import {bind, componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, listener, memory, projection, projectionDef, text} from '../../src/render3/instructions';
import {containerEl, renderToHtml} from './render_util';
@ -140,13 +140,13 @@ describe('lifecycles', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -268,14 +268,14 @@ describe('lifecycles', () => {
containerRefreshStart(2);
{
for (let j = 2; j < 5; j++) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
elementEnd();
}
elementProperty(0, 'val', j);
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -314,14 +314,14 @@ describe('lifecycles', () => {
containerRefreshStart(2);
{
for (let j = 2; j < 5; j++) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Parent);
elementEnd();
}
elementProperty(0, 'val', j);
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -511,14 +511,14 @@ describe('lifecycles', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
{ text(2, 'content'); }
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -711,7 +711,7 @@ describe('lifecycles', () => {
containerRefreshStart(3);
{
for (let i = 2; i < 4; i++) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
{ text(2, 'content'); }
elementEnd();
@ -719,7 +719,7 @@ describe('lifecycles', () => {
elementProperty(0, 'val', i);
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -748,7 +748,7 @@ describe('lifecycles', () => {
containerRefreshStart(3);
{
for (let i = 2; i < 4; i++) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Parent);
{ text(2, 'content'); }
elementEnd();
@ -756,7 +756,7 @@ describe('lifecycles', () => {
elementProperty(0, 'val', i);
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -878,13 +878,13 @@ describe('lifecycles', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -1083,14 +1083,14 @@ describe('lifecycles', () => {
containerRefreshStart(2);
{
for (let i = 2; i < 4; i++) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
elementEnd();
}
elementProperty(0, 'val', i);
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -1126,14 +1126,14 @@ describe('lifecycles', () => {
containerRefreshStart(2);
{
for (let i = 2; i < 4; i++) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Parent);
elementEnd();
}
elementProperty(0, 'val', i);
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -1210,14 +1210,14 @@ describe('lifecycles', () => {
containerRefreshStart(2);
{
for (let i = 2; i < 4; i++) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Parent);
elementEnd();
}
elementProperty(0, 'val', i);
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -1280,13 +1280,13 @@ describe('lifecycles', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -1312,7 +1312,7 @@ describe('lifecycles', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
elementEnd();
elementStart(2, Comp);
@ -1324,7 +1324,7 @@ describe('lifecycles', () => {
Comp.ngComponentDef.h(3, 2);
componentRefresh(1, 0);
componentRefresh(3, 2);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -1351,13 +1351,13 @@ describe('lifecycles', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Parent);
elementEnd();
}
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -1394,13 +1394,13 @@ describe('lifecycles', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Grandparent);
elementEnd();
}
Grandparent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -1431,7 +1431,7 @@ describe('lifecycles', () => {
containerRefreshStart(0);
{
if (ctx.showing) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
{
elementStart(2, ProjectedComp);
@ -1457,7 +1457,7 @@ describe('lifecycles', () => {
componentRefresh(3, 2);
componentRefresh(5, 4);
componentRefresh(7, 6);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -1488,7 +1488,7 @@ describe('lifecycles', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
elementEnd();
container(2);
@ -1502,20 +1502,20 @@ describe('lifecycles', () => {
containerRefreshStart(2);
{
if (ctx.condition2) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
elementEnd();
}
elementProperty(0, 'val', bind('2'));
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
componentRefresh(1, 0);
componentRefresh(4, 3);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -1564,7 +1564,7 @@ describe('lifecycles', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
elementEnd();
container(2);
@ -1578,20 +1578,20 @@ describe('lifecycles', () => {
containerRefreshStart(2);
{
for (let j = 2; j < ctx.len; j++) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
elementEnd();
}
elementProperty(0, 'val', bind(j));
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
componentRefresh(1, 0);
componentRefresh(4, 3);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -1642,7 +1642,7 @@ describe('lifecycles', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, 'button');
{
listener('click', ctx.onClick.bind(ctx));
@ -1660,7 +1660,7 @@ describe('lifecycles', () => {
}
Comp.ngComponentDef.h(3, 2);
componentRefresh(3, 2);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();

View File

@ -7,7 +7,7 @@
*/
import {defineComponent} from '../../src/render3/index';
import {componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementStart, listener, text, viewEnd, viewStart} from '../../src/render3/instructions';
import {componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementStart, embeddedViewEnd, embeddedViewStart, listener, text} from '../../src/render3/instructions';
import {containerEl, renderComponent, renderToHtml} from './render_util';
@ -94,7 +94,7 @@ describe('event listeners', () => {
containerRefreshStart(0);
{
if (ctx.showing) {
if (viewStart(1)) {
if (embeddedViewStart(1)) {
elementStart(0, 'button');
{
listener('click', ctx.onClick.bind(ctx));
@ -102,7 +102,7 @@ describe('event listeners', () => {
}
elementEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -142,14 +142,14 @@ describe('event listeners', () => {
containerRefreshStart(0);
{
if (ctx.showing) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
text(0, 'Hello');
container(1);
}
containerRefreshStart(1);
{
if (ctx.button) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, 'button');
{
listener('click', ctx.onClick.bind(ctx));
@ -157,11 +157,11 @@ describe('event listeners', () => {
}
elementEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -200,7 +200,7 @@ describe('event listeners', () => {
containerRefreshStart(0);
{
if (ctx.showing) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
text(0, 'Hello');
elementStart(1, MyComp);
elementEnd();
@ -211,7 +211,7 @@ describe('event listeners', () => {
MyComp.ngComponentDef.h(4, 3);
componentRefresh(2, 1);
componentRefresh(4, 3);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -256,7 +256,7 @@ describe('event listeners', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
text(0, 'Hello');
container(1);
container(2);
@ -264,7 +264,7 @@ describe('event listeners', () => {
containerRefreshStart(1);
{
if (ctx.sub1) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, 'button');
{
listener('click', () => ctx.counter1++);
@ -272,14 +272,14 @@ describe('event listeners', () => {
}
elementEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
containerRefreshStart(2);
{
if (ctx.sub2) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, 'button');
{
listener('click', () => ctx.counter2++);
@ -287,11 +287,11 @@ describe('event listeners', () => {
}
elementEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();

View File

@ -9,7 +9,7 @@
import {EventEmitter} from '@angular/core';
import {defineComponent, defineDirective} from '../../src/render3/index';
import {bind, componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, listener, text, viewEnd, viewStart} from '../../src/render3/instructions';
import {bind, componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, listener, text} from '../../src/render3/instructions';
import {containerEl, renderToHtml} from './render_util';
@ -128,14 +128,14 @@ describe('outputs', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, ButtonToggle);
{ listener('change', ctx.onChange.bind(ctx)); }
elementEnd();
}
ButtonToggle.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -172,24 +172,24 @@ describe('outputs', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
container(0);
}
containerRefreshStart(0);
{
if (ctx.condition2) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, ButtonToggle);
{ listener('change', ctx.onChange.bind(ctx)); }
elementEnd();
}
ButtonToggle.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -238,7 +238,7 @@ describe('outputs', () => {
containerRefreshStart(0);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, 'button');
{
listener('click', ctx.onClick.bind(ctx));
@ -255,7 +255,7 @@ describe('outputs', () => {
DestroyComp.ngComponentDef.h(5, 4);
componentRefresh(3, 2);
componentRefresh(5, 4);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -396,21 +396,21 @@ describe('outputs', () => {
containerRefreshStart(2);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, ButtonToggle);
{ listener('change', ctx.onChange.bind(ctx)); }
elementEnd();
}
ButtonToggle.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
} else {
if (viewStart(1)) {
if (embeddedViewStart(1)) {
elementStart(0, 'div', null, [OtherDir]);
{ listener('change', ctx.onChange.bind(ctx)); }
elementEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();

View File

@ -9,7 +9,7 @@
import {EventEmitter} from '@angular/core';
import {defineComponent, defineDirective} from '../../src/render3/index';
import {NO_CHANGE, bind, bind1, componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, listener, memory, text, textBinding, viewEnd, viewStart} from '../../src/render3/instructions';
import {NO_CHANGE, bind, bind1, componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, listener, memory, text, textBinding} from '../../src/render3/instructions';
import {renderToHtml} from './render_util';
@ -257,21 +257,21 @@ describe('elementProperty', () => {
containerRefreshStart(3);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, 'button');
{ text(1, 'Click me too'); }
elementEnd();
}
elementProperty(0, 'id', bind(ctx.id2));
viewEnd();
embeddedViewEnd();
} else {
if (viewStart(1)) {
if (embeddedViewStart(1)) {
elementStart(0, 'button', null, [OtherDir]);
{ text(2, 'Click me too'); }
elementEnd();
}
elementProperty(0, 'id', bind(ctx.id3));
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -437,18 +437,18 @@ describe('elementProperty', () => {
containerRefreshStart(2);
{
if (ctx.condition) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, 'div', ['role', 'button'], [MyDirB]);
elementEnd();
}
viewEnd();
embeddedViewEnd();
} else {
if (viewStart(1)) {
if (embeddedViewStart(1)) {
elementStart(0, 'div', ['role', 'menu']);
{}
elementEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -497,13 +497,13 @@ describe('elementProperty', () => {
containerRefreshStart(0);
{
for (let i = 0; i < 2; i++) {
if (viewStart(0)) {
if (embeddedViewStart(0)) {
elementStart(0, Comp);
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();

View File

@ -7,12 +7,13 @@
*/
import {QUERY_READ_CONTAINER_REF, QUERY_READ_ELEMENT_REF, QUERY_READ_FROM_NODE, QUERY_READ_TEMPLATE_REF} from '../../src/render3/di';
import {QueryList, detectChanges} from '../../src/render3/index';
import {container, containerRefreshEnd, containerRefreshStart, elementEnd, elementStart, memory, viewEnd, viewStart} from '../../src/render3/instructions';
import {container, containerRefreshEnd, containerRefreshStart, elementEnd, elementStart, embeddedViewEnd, embeddedViewStart, memory} from '../../src/render3/instructions';
import {query, queryRefresh} from '../../src/render3/query';
import {createComponent, createDirective, renderComponent} from './render_util';
/**
* Helper function to check if a given candidate object resembles ElementRef
* @param candidate
@ -554,14 +555,14 @@ describe('query', () => {
containerRefreshStart(1);
{
if (ctx.exp) {
let cm1 = viewStart(1);
let cm1 = embeddedViewStart(1);
{
if (cm1) {
firstEl = elementStart(0, 'div', null, null, ['foo', '']);
elementEnd();
}
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -608,14 +609,14 @@ describe('query', () => {
containerRefreshStart(2);
{
if (ctx.exp) {
let cm1 = viewStart(1);
let cm1 = embeddedViewStart(1);
{
if (cm1) {
viewEl = elementStart(0, 'div', null, null, ['foo', '']);
elementEnd();
}
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -664,24 +665,24 @@ describe('query', () => {
containerRefreshStart(1);
{
if (ctx.exp1) {
let cm1 = viewStart(0);
let cm1 = embeddedViewStart(0);
{
if (cm1) {
firstEl = elementStart(0, 'div', null, null, ['foo', '']);
elementEnd();
}
}
viewEnd();
embeddedViewEnd();
}
if (ctx.exp2) {
let cm1 = viewStart(1);
let cm1 = embeddedViewStart(1);
{
if (cm1) {
lastEl = elementStart(0, 'span', null, null, ['foo', '']);
elementEnd();
}
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -726,7 +727,7 @@ describe('query', () => {
containerRefreshStart(1);
{
if (ctx.exp1) {
let cm1 = viewStart(0);
let cm1 = embeddedViewStart(0);
{
if (cm1) {
firstEl = elementStart(0, 'div', null, null, ['foo', '']);
@ -736,19 +737,19 @@ describe('query', () => {
containerRefreshStart(1);
{
if (ctx.exp2) {
let cm2 = viewStart(0);
let cm2 = embeddedViewStart(0);
{
if (cm2) {
lastEl = elementStart(0, 'span', null, null, ['foo', '']);
elementEnd();
}
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();
@ -793,14 +794,14 @@ describe('query', () => {
containerRefreshStart(2);
{
if (ctx.exp) {
let cm1 = viewStart(0);
let cm1 = embeddedViewStart(0);
{
if (cm1) {
elementStart(0, 'div', null, null, ['foo', '']);
elementEnd();
}
}
viewEnd();
embeddedViewEnd();
}
}
containerRefreshEnd();