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

@ -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>');