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

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