refactor(ivy): rename `bindX()` functions to `interpolationX()` (#22229)

rationale: remove the confusion with `bind()` and `bind0()`

PR Close #22229
This commit is contained in:
Victor Berchet 2018-02-14 11:22:14 -08:00
parent 7ac34e42a0
commit 5dd2b5135d
12 changed files with 149 additions and 137 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, ɵr as r, ɵ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, ɵi1 as i1, ɵ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';
@ -47,7 +47,7 @@ export class TreeComponent {
C(3);
}
s(0, 'background-color', b(ctx.data.depth % 2 ? '' : 'grey'));
t(1, b1(' ', ctx.data.value, ' '));
t(1, i1(' ', ctx.data.value, ' '));
cR(2);
{
if (ctx.data.left != null) {
@ -117,7 +117,7 @@ export function TreeTpl(ctx: TreeNode, cm: boolean) {
e();
}
s(1, 'background-color', b(ctx.depth % 2 ? '' : 'grey'));
t(2, b1(' ', ctx.value, ' '));
t(2, i1(' ', ctx.value, ' '));
cR(3);
{
if (ctx.left != null) {

View File

@ -53,15 +53,15 @@ export class Identifiers {
static bind: o.ExternalReference = {name: 'ɵb', moduleName: CORE};
static bind1: o.ExternalReference = {name: 'ɵb1', moduleName: CORE};
static bind2: o.ExternalReference = {name: 'ɵb2', moduleName: CORE};
static bind3: o.ExternalReference = {name: 'ɵb3', moduleName: CORE};
static bind4: o.ExternalReference = {name: 'ɵb4', moduleName: CORE};
static bind5: o.ExternalReference = {name: 'ɵb5', moduleName: CORE};
static bind6: o.ExternalReference = {name: 'ɵb6', moduleName: CORE};
static bind7: o.ExternalReference = {name: 'ɵb7', moduleName: CORE};
static bind8: o.ExternalReference = {name: 'ɵb8', moduleName: CORE};
static bindV: o.ExternalReference = {name: 'ɵbV', moduleName: CORE};
static interpolation1: o.ExternalReference = {name: 'ɵi1', moduleName: CORE};
static interpolation2: o.ExternalReference = {name: 'ɵi2', moduleName: CORE};
static interpolation3: o.ExternalReference = {name: 'ɵi3', moduleName: CORE};
static interpolation4: o.ExternalReference = {name: 'ɵi4', moduleName: CORE};
static interpolation5: o.ExternalReference = {name: 'ɵi5', moduleName: CORE};
static interpolation6: o.ExternalReference = {name: 'ɵi6', moduleName: CORE};
static interpolation7: o.ExternalReference = {name: 'ɵi7', moduleName: CORE};
static interpolation8: o.ExternalReference = {name: 'ɵi8', moduleName: CORE};
static interpolationV: o.ExternalReference = {name: 'ɵiV', moduleName: CORE};
static memory: o.ExternalReference = {name: 'ɵm', moduleName: CORE};

View File

@ -178,25 +178,25 @@ function interpolate(args: o.Expression[]): o.Expression {
args = args.slice(1); // Ignore the length prefix added for render2
switch (args.length) {
case 3:
return o.importExpr(R3.bind1).callFn(args);
return o.importExpr(R3.interpolation1).callFn(args);
case 5:
return o.importExpr(R3.bind2).callFn(args);
return o.importExpr(R3.interpolation2).callFn(args);
case 7:
return o.importExpr(R3.bind3).callFn(args);
return o.importExpr(R3.interpolation3).callFn(args);
case 9:
return o.importExpr(R3.bind4).callFn(args);
return o.importExpr(R3.interpolation4).callFn(args);
case 11:
return o.importExpr(R3.bind5).callFn(args);
return o.importExpr(R3.interpolation5).callFn(args);
case 13:
return o.importExpr(R3.bind6).callFn(args);
return o.importExpr(R3.interpolation6).callFn(args);
case 15:
return o.importExpr(R3.bind7).callFn(args);
return o.importExpr(R3.interpolation7).callFn(args);
case 17:
return o.importExpr(R3.bind8).callFn(args);
return o.importExpr(R3.interpolation8).callFn(args);
}
(args.length >= 19 && args.length % 2 == 1) ||
error(`Invalid interpolation argument length ${args.length}`);
return o.importExpr(R3.bindV).callFn([o.literalArr(args)]);
return o.importExpr(R3.interpolationV).callFn([o.literalArr(args)]);
}
class BindingScope {

View File

@ -114,7 +114,7 @@ describe('r3_view_compiler', () => {
}
};
const bV_call = `$r3$bV([' ',ctx.list[0],' ',ctx.list[1],' ',ctx.list[2],' ',ctx.list[3],
const bV_call = `$r3$iV([' ',ctx.list[0],' ',ctx.list[1],' ',ctx.list[2],' ',ctx.list[3],
' ',ctx.list[4],' ',ctx.list[5],' ',ctx.list[6],' ',ctx.list[7],' ',ctx.list[8],
' '])`;
const result = compile(files, angularFiles);
@ -305,7 +305,7 @@ describe('r3_view_compiler', () => {
$r3$.ɵT(1);
$r3$.ɵe();
}
$r3$.ɵt(1, $r3$.ɵb2('', ctx.salutation, ' ', $foo$, ''));
$r3$.ɵt(1, $r3$.ɵi2('', ctx.salutation, ' ', $foo$, ''));
}
}
});`;
@ -421,7 +421,7 @@ describe('r3_view_compiler', () => {
$r3$.ɵT(2);
}
const $user$ = $r3$.ɵm(1);
$r3$.ɵt(2, $r3$.ɵb1('Hello ', $user$.value, '!'));
$r3$.ɵt(2, $r3$.ɵi1('Hello ', $user$.value, '!'));
}
});
`;
@ -634,7 +634,7 @@ describe('r3_view_compiler', () => {
$r3$.ɵe();
}
const $item$ = ctx0.$implicit;
$r3$.ɵt(1, $r3$.ɵb1('', $item$.name, ''));
$r3$.ɵt(1, $r3$.ɵi1('', $item$.name, ''));
}
}
});
@ -719,7 +719,7 @@ describe('r3_view_compiler', () => {
const $item$ = ctx0.$implicit;
$r3$.ɵp(4, 'forOf', $r3$.ɵb(IDENT.infos));
$c2$.h(5,4);
$r3$.ɵt(2, $r3$.ɵb1('', IDENT.name, ''));
$r3$.ɵt(2, $r3$.ɵi1('', IDENT.name, ''));
$r3$.ɵcR(4);
$r3$.ɵr(5, 4);
$r3$.ɵcr();
@ -732,7 +732,7 @@ describe('r3_view_compiler', () => {
$r3$.ɵe();
}
const $info$ = ctx1.$implicit;
$r3$.ɵt(1, $r3$.ɵb2(' ', $item$.name, ': ', $info$.description, ' '));
$r3$.ɵt(1, $r3$.ɵi2(' ', $item$.name, ': ', $info$.description, ' '));
}
}
}

View File

@ -29,15 +29,15 @@ export {
Q as ɵQ,
P as ɵP,
b as ɵb,
b1 as ɵb1,
b2 as ɵb2,
b3 as ɵb3,
b4 as ɵb4,
b5 as ɵb5,
b6 as ɵb6,
b7 as ɵb7,
b8 as ɵb8,
bV as ɵbV,
i1 as ɵi1,
i2 as ɵi2,
i3 as ɵi3,
i4 as ɵi4,
i5 as ɵi5,
i6 as ɵi6,
i7 as ɵi7,
i8 as ɵi8,
iV as ɵiV,
pb1 as ɵpb1,
pb2 as ɵpb2,
pb3 as ɵpb3,

View File

@ -27,15 +27,15 @@ export {
NO_CHANGE as NC,
bind as b,
bind1 as b1,
bind2 as b2,
bind3 as b3,
bind4 as b4,
bind5 as b5,
bind6 as b6,
bind7 as b7,
bind8 as b8,
bindV as bV,
interpolation1 as i1,
interpolation2 as i2,
interpolation3 as i3,
interpolation4 as i4,
interpolation5 as i5,
interpolation6 as i6,
interpolation7 as i7,
interpolation8 as i8,
interpolationV as iV,
componentRefresh as r,

View File

@ -23,7 +23,6 @@ import {RElement, RText, Renderer3, RendererFactory3, ProceduralRenderer3, Objec
import {isDifferent, stringify} from './util';
import {executeHooks, executeContentHooks, queueLifecycleHooks, queueInitHooks, executeInitHooks} from './hooks';
/**
* Directive (D) sets a property on all component instances using this constant as a key and the
* component's host node (LElement) as the value. This is used in methods like detectChanges to
@ -1356,9 +1355,9 @@ export function addToViewTree<T extends LView|LContainer>(state: T): T {
return state;
}
//////////////////////////
//// Bindings
//////////////////////////
///////////////////////////////
//// Bindings & interpolations
///////////////////////////////
export interface NO_CHANGE {
// This is a brand that ensures that this type can never match anything else
@ -1369,16 +1368,53 @@ export interface NO_CHANGE {
export const NO_CHANGE = {} as NO_CHANGE;
/**
* Create interpolation bindings with variable number of arguments.
* Initializes the binding start index. Will get inlined.
*
* If any of the arguments change, then the interpolation is concatenated
* and causes an update.
* This function must be called before any binding related function is called
* (ie `bind()`, `interpolationX()`, `pureFunctionX()`)
*/
function initBindings() {
// `bindingIndex` is initialized when the view is first entered when not in creation mode
ngDevMode &&
assertEqual(
creationMode, true, 'should only be called in creationMode for performance reasons');
if (currentView.bindingStartIndex == null) {
bindingIndex = currentView.bindingStartIndex = data.length;
}
}
/**
* Creates a single value binding.
*
* @param value Value to diff
*/
export function bind<T>(value: T | NO_CHANGE): T|NO_CHANGE {
if (creationMode) {
initBindings();
return data[bindingIndex++] = value;
}
const changed: boolean = value !== NO_CHANGE && isDifferent(data[bindingIndex], value);
if (changed) {
data[bindingIndex] = value;
}
bindingIndex++;
return changed ? value : NO_CHANGE;
}
/**
* Create interpolation bindings with a variable number of expressions.
*
* If there are 1 to 7 expressions `interpolation1()` to `interpolation7` should be used instead.
* Those are faster because there is no need to create an array of expressions and loop over it.
*
* `values`:
* - has static text at even indexes,
* - has evaluated expressions at odd indexes (could be NO_CHANGE).
*
* Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
*/
export function bindV(values: any[]): string|NO_CHANGE {
export function interpolationV(values: any[]): string|NO_CHANGE {
ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values');
@ -1414,51 +1450,20 @@ export function bindV(values: any[]): string|NO_CHANGE {
return NO_CHANGE;
}
// For bindings that have 0 - 7 dynamic values to watch, we can use a bind function that
// matches the number of interpolations. This is faster than using the bindV function above
// because we know ahead of time how many interpolations we'll have and don't need to
// accept the values as an array that will need to be copied and looped over.
// Initializes the binding start index. Will get inlined.
function initBindings() {
if (currentView.bindingStartIndex == null) {
bindingIndex = currentView.bindingStartIndex = data.length;
}
}
/**
* Creates a single value binding without interpolation.
*
* @param value Value to diff
*/
export function bind<T>(value: T | NO_CHANGE): T|NO_CHANGE {
if (creationMode) {
initBindings();
return data[bindingIndex++] = value;
}
const changed: boolean = value !== NO_CHANGE && isDifferent(data[bindingIndex], value);
if (changed) {
data[bindingIndex] = value;
}
bindingIndex++;
return changed ? value : NO_CHANGE;
}
/**
* Creates an interpolation bindings with 1 argument.
* Creates an interpolation binding with 1 expression.
*
* @param prefix static value used for concatenation only.
* @param value value checked for change.
* @param suffix static value used for concatenation only.
*/
export function bind1(prefix: string, value: any, suffix: string): string|NO_CHANGE {
export function interpolation1(prefix: string, value: any, suffix: string): string|NO_CHANGE {
return bind(value) === NO_CHANGE ? NO_CHANGE : prefix + stringify(value) + suffix;
}
/** Creates an interpolation bindings with 2 arguments. */
export function bind2(prefix: string, v0: any, i0: string, v1: any, suffix: string): string|
NO_CHANGE {
/** Creates an interpolation binding with 2 expressions. */
export function interpolation2(
prefix: string, v0: any, i0: string, v1: any, suffix: string): string|NO_CHANGE {
let different: boolean;
if (different = creationMode) {
initBindings();
@ -1477,8 +1482,8 @@ export function bind2(prefix: string, v0: any, i0: string, v1: any, suffix: stri
return different ? prefix + stringify(v0) + i0 + stringify(v1) + suffix : NO_CHANGE;
}
/** Creates an interpolation bindings with 3 arguments. */
export function bind3(
/** Creates an interpolation bindings with 3 expressions. */
export function interpolation3(
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, suffix: string): string|
NO_CHANGE {
let different: boolean;
@ -1504,8 +1509,8 @@ export function bind3(
NO_CHANGE;
}
/** Create an interpolation binding with 4 arguments. */
export function bind4(
/** Create an interpolation binding with 4 expressions. */
export function interpolation4(
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
suffix: string): string|NO_CHANGE {
let different: boolean;
@ -1539,8 +1544,8 @@ export function bind4(
NO_CHANGE;
}
/** Creates an interpolation binding with 5 arguments. */
export function bind5(
/** Creates an interpolation binding with 5 expressions. */
export function interpolation5(
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
i3: string, v4: any, suffix: string): string|NO_CHANGE {
let different: boolean;
@ -1579,8 +1584,8 @@ export function bind5(
NO_CHANGE;
}
/** Creates an interpolation binding with 6 arguments. */
export function bind6(
/** Creates an interpolation binding with 6 expressions. */
export function interpolation6(
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
i3: string, v4: any, i4: string, v5: any, suffix: string): string|NO_CHANGE {
let different: boolean;
@ -1623,8 +1628,8 @@ export function bind6(
NO_CHANGE;
}
/** Creates an interpolation binding with 7 arguments. */
export function bind7(
/** Creates an interpolation binding with 7 expressions. */
export function interpolation7(
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
i3: string, v4: any, i4: string, v5: any, i5: string, v6: any, suffix: string): string|
NO_CHANGE {
@ -1672,8 +1677,8 @@ export function bind7(
NO_CHANGE;
}
/** Creates an interpolation binding with 8 arguments. */
export function bind8(
/** Creates an interpolation binding with 8 expressions. */
export function interpolation8(
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
i3: string, v4: any, i4: string, v5: any, i5: string, v6: any, i6: string, v7: any,
suffix: string): string|NO_CHANGE {

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {ɵT as T, ɵb1 as b1, ɵdefineComponent as defineComponent, ɵrenderComponent as renderComponent, ɵt as t} from '@angular/core';
import {ɵT as T, ɵdefineComponent as defineComponent, ɵi1 as i1, ɵrenderComponent as renderComponent, ɵt as t} from '@angular/core';
class HelloWorld {
name = 'World';
@ -19,7 +19,7 @@ class HelloWorld {
if (cm) {
T(0);
}
t(0, b1('Hello ', ctx.name, '!'));
t(0, i1('Hello ', ctx.name, '!'));
}
});
}

View File

@ -178,7 +178,7 @@ describe('compiler specification', () => {
$r3$.ɵT(1);
$r3$.ɵe();
}
$r3$.ɵt(1, $r3$.ɵb2('', ctx.salutation, ' ', $foo$, ''));
$r3$.ɵt(1, $r3$.ɵi2('', ctx.salutation, ' ', $foo$, ''));
}
}
});
@ -795,7 +795,7 @@ describe('compiler specification', () => {
$r3$.ɵPp(1, $MyPurePipe_ngPipeDef$, $MyPurePipe_ngPipeDef$.n());
$r3$.ɵPp(2, $MyPipe_ngPipeDef$, $MyPipe_ngPipeDef$.n());
}
$r3$.ɵt(2, $r3$.ɵb1('', $r3$.ɵpb2(1, $r3$.ɵpb2(2, ctx.name, ctx.size), ctx.size), ''));
$r3$.ɵt(2, $r3$.ɵi1('', $r3$.ɵpb2(1, $r3$.ɵpb2(2, ctx.name, ctx.size), ctx.size), ''));
}
});
// /NORMATIVE
@ -825,7 +825,7 @@ describe('compiler specification', () => {
$r3$.ɵT(2);
}
const l1_user = $r3$.ɵm<any>(1);
$r3$.ɵt(2, $r3$.ɵb1('Hello ', l1_user.value, '!'));
$r3$.ɵt(2, $r3$.ɵi1('Hello ', l1_user.value, '!'));
}
});
// NORMATIVE
@ -1029,7 +1029,7 @@ describe('compiler specification', () => {
$r3$.ɵe();
}
const $l0_item$ = ctx1.$implicit;
$r3$.ɵt(1, $r3$.ɵb1('', $l0_item$.name, ''));
$r3$.ɵt(1, $r3$.ɵi1('', $l0_item$.name, ''));
}
}
});
@ -1104,7 +1104,7 @@ describe('compiler specification', () => {
}
const $l0_item$ = ctx1.$implicit;
$r3$.ɵp(4, 'forOf', $r3$.ɵb($l0_item$.infos));
$r3$.ɵt(2, $r3$.ɵb1('', $l0_item$.name, ''));
$r3$.ɵt(2, $r3$.ɵi1('', $l0_item$.name, ''));
$r3$.ɵcR(4);
$r3$.ɵr(5, 4);
$r3$.ɵcr();
@ -1117,7 +1117,7 @@ describe('compiler specification', () => {
$r3$.ɵe();
}
const $l0_info$ = ctx2.$implicit;
$r3$.ɵt(1, $r3$.ɵb2(' ', $l0_item$.name, ': ', $l0_info$.description, ' '));
$r3$.ɵt(1, $r3$.ɵi2(' ', $l0_item$.name, ': ', $l0_info$.description, ' '));
}
}
}

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, embeddedViewEnd, embeddedViewStart, enterView, leaveView, memory, text, textBinding} from '../../src/render3/instructions';
import {bind, container, containerRefreshEnd, containerRefreshStart, createLNode, createLView, createTView, elementEnd, elementStart, embeddedViewEnd, embeddedViewStart, enterView, interpolation2, leaveView, memory, text, textBinding} from '../../src/render3/instructions';
import {LInjector} from '../../src/render3/interfaces/injector';
import {LNodeFlags} from '../../src/render3/interfaces/node';
@ -111,7 +111,8 @@ describe('di', () => {
}
textBinding(
3,
bind2('', memory<Directive>(1).value, '-', memory<DirectiveSameInstance>(2).value, ''));
interpolation2(
'', memory<Directive>(1).value, '-', memory<DirectiveSameInstance>(2).value, ''));
}
expect(renderToHtml(Template, {})).toEqual('<div>ElementRef-true</div>');
@ -151,7 +152,8 @@ describe('di', () => {
}
textBinding(
3,
bind2('', memory<Directive>(1).value, '-', memory<DirectiveSameInstance>(2).value, ''));
interpolation2(
'', memory<Directive>(1).value, '-', memory<DirectiveSameInstance>(2).value, ''));
}
expect(renderToHtml(Template, {})).toEqual('TemplateRef-true');
@ -191,7 +193,8 @@ describe('di', () => {
}
textBinding(
3,
bind2('', memory<Directive>(1).value, '-', memory<DirectiveSameInstance>(2).value, ''));
interpolation2(
'', memory<Directive>(1).value, '-', memory<DirectiveSameInstance>(2).value, ''));
}
expect(renderToHtml(Template, {})).toEqual('<div>ViewContainerRef-true</div>');
@ -304,7 +307,7 @@ describe('di', () => {
}
textBinding(
3,
bind2(
interpolation2(
'', memory<ChildDirective>(1).value, '-', memory<Child2Directive>(2).value, ''));
embeddedViewEnd();
}

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, embeddedViewEnd, embeddedViewStart, memory, projection, projectionDef, text, textBinding} from '../../src/render3/instructions';
import {NO_CHANGE, bind, componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementAttribute, elementClass, elementEnd, elementProperty, elementStart, elementStyle, embeddedViewEnd, embeddedViewStart, interpolation1, interpolation2, interpolation3, interpolation4, interpolation5, interpolation6, interpolation7, interpolation8, interpolationV, memory, projection, projectionDef, text, textBinding} from '../../src/render3/instructions';
import {containerEl, renderToHtml} from './render_util';
@ -37,7 +37,7 @@ describe('render3 integration test', () => {
{ text(1); }
elementEnd();
}
textBinding(1, bind1('Hello, ', name, '!'));
textBinding(1, interpolation1('Hello, ', name, '!'));
}
});
});
@ -91,19 +91,21 @@ describe('render3 integration test', () => {
text(7);
text(8);
}
textBinding(0, bind1('', cm ? v : NO_CHANGE, '|'));
textBinding(1, bind2('', v, '_', cm ? v : NO_CHANGE, '|'));
textBinding(2, bind3('', v, '_', v, '_', cm ? v : NO_CHANGE, '|'));
textBinding(3, bind4('', v, '_', v, '_', v, '_', cm ? v : NO_CHANGE, '|'));
textBinding(4, bind5('', v, '_', v, '_', v, '_', v, '_', cm ? v : NO_CHANGE, '|'));
textBinding(5, bind6('', v, '_', v, '_', v, '_', v, '_', v, '_', cm ? v : NO_CHANGE, '|'));
textBinding(0, interpolation1('', cm ? v : NO_CHANGE, '|'));
textBinding(1, interpolation2('', v, '_', cm ? v : NO_CHANGE, '|'));
textBinding(2, interpolation3('', v, '_', v, '_', cm ? v : NO_CHANGE, '|'));
textBinding(3, interpolation4('', v, '_', v, '_', v, '_', cm ? v : NO_CHANGE, '|'));
textBinding(4, interpolation5('', v, '_', v, '_', v, '_', v, '_', cm ? v : NO_CHANGE, '|'));
textBinding(
6, bind7('', v, '_', v, '_', v, '_', v, '_', v, '_', v, '_', cm ? v : NO_CHANGE, '|'));
5, interpolation6('', v, '_', v, '_', v, '_', v, '_', v, '_', cm ? v : NO_CHANGE, '|'));
textBinding(
7, bind8(
6, interpolation7(
'', v, '_', v, '_', v, '_', v, '_', v, '_', v, '_', cm ? v : NO_CHANGE, '|'));
textBinding(
7, interpolation8(
'', v, '_', v, '_', v, '_', v, '_', v, '_', v, '_', v, '_', cm ? v : NO_CHANGE,
'|'));
textBinding(8, bindV([
textBinding(8, interpolationV([
'', v, '_', v, '_', v, '_', v, '_', v, '_', v, '_', v, '_', v, '_',
cm ? v : NO_CHANGE, ''
]));
@ -168,7 +170,7 @@ describe('render3 integration test', () => {
}
elementEnd();
}
textBinding(4, bind1('Hello ', name, '!'));
textBinding(4, interpolation1('Hello ', name, '!'));
}
expect(renderToHtml(Template, 'world')).toEqual('<b><b><b><b>Hello world!</b></b></b></b>');
expect(renderToHtml(Template, 'mundo')).toEqual('<b><b><b><b>Hello mundo!</b></b></b></b>');
@ -585,24 +587,26 @@ describe('render3 integration test', () => {
elementStart(0, 'b');
elementEnd();
}
elementAttribute(0, 'a', bindV(c));
elementAttribute(0, 'a', interpolationV(c));
elementAttribute(0, 'a0', bind(c[1]));
elementAttribute(0, 'a1', bind1(c[0], c[1], c[16]));
elementAttribute(0, 'a2', bind2(c[0], c[1], c[2], c[3], c[16]));
elementAttribute(0, 'a3', bind3(c[0], c[1], c[2], c[3], c[4], c[5], c[16]));
elementAttribute(0, 'a4', bind4(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[16]));
elementAttribute(0, 'a1', interpolation1(c[0], c[1], c[16]));
elementAttribute(0, 'a2', interpolation2(c[0], c[1], c[2], c[3], c[16]));
elementAttribute(0, 'a3', interpolation3(c[0], c[1], c[2], c[3], c[4], c[5], c[16]));
elementAttribute(
0, 'a5', bind5(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[16]));
0, 'a4', interpolation4(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[16]));
elementAttribute(
0, 'a5',
interpolation5(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[16]));
elementAttribute(
0, 'a6',
bind6(
interpolation6(
c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11], c[16]));
elementAttribute(
0, 'a7', bind7(
0, 'a7', interpolation7(
c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11],
c[12], c[13], c[16]));
elementAttribute(
0, 'a8', bind8(
0, 'a8', interpolation8(
c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11],
c[12], c[13], c[14], c[15], c[16]));
}

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, embeddedViewEnd, embeddedViewStart, listener, memory, text, textBinding} from '../../src/render3/instructions';
import {NO_CHANGE, bind, componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, interpolation1, listener, memory, text, textBinding} from '../../src/render3/instructions';
import {renderToHtml} from './render_util';
@ -55,7 +55,7 @@ describe('elementProperty', () => {
elementStart(0, 'span');
elementEnd();
}
elementProperty(0, 'id', bind1('_', ctx, '_'));
elementProperty(0, 'id', interpolation1('_', ctx, '_'));
}
expect(renderToHtml(Template, 'testId')).toEqual('<span id="_testId_"></span>');