perf(ivy): chain multiple i18nExp calls (#31258)

Implement function chaining for `i18nExp` to reduce the output size.

FW-1391 #resolve
PR Close #31258
This commit is contained in:
Olivier Combe
2019-06-25 17:14:07 +02:00
committed by Kara Erickson
parent 3846192bde
commit ef9cb6a034
4 changed files with 54 additions and 76 deletions

View File

@ -464,14 +464,10 @@ describe('i18n support in the view compiler', () => {
$r3$.ɵɵelementEnd();
}
if (rf & 2) {
$r3$.ɵɵi18nExp($r3$.ɵɵpipeBind1(1, 6, ctx.valueA));
$r3$.ɵɵi18nExp(ctx.valueB);
$r3$.ɵɵi18nExp($r3$.ɵɵpipeBind1(1, 6, ctx.valueA))(ctx.valueB);
$r3$.ɵɵi18nApply(2);
$r3$.ɵɵselect(3);
$r3$.ɵɵi18nExp(ctx.valueA);
$r3$.ɵɵi18nExp(ctx.valueB);
$r3$.ɵɵi18nExp(ctx.valueA + ctx.valueB);
$r3$.ɵɵi18nExp(ctx.valueC);
$r3$.ɵɵi18nExp(ctx.valueA)(ctx.valueB)(ctx.valueA + ctx.valueB)(ctx.valueC);
$r3$.ɵɵi18nApply(4);
}
}
@ -690,14 +686,10 @@ describe('i18n support in the view compiler', () => {
$r3$.ɵɵelementEnd();
}
if (rf & 2) {
$r3$.ɵɵi18nExp($r3$.ɵɵpipeBind1(1, 6, ctx.valueA));
$r3$.ɵɵi18nExp(ctx.valueB);
$r3$.ɵɵi18nExp($r3$.ɵɵpipeBind1(1, 6, ctx.valueA))(ctx.valueB);
$r3$.ɵɵi18nApply(2);
$r3$.ɵɵselect(3);
$r3$.ɵɵi18nExp(ctx.valueA);
$r3$.ɵɵi18nExp(ctx.valueB);
$r3$.ɵɵi18nExp(ctx.valueA + ctx.valueB);
$r3$.ɵɵi18nExp(ctx.valueC);
$r3$.ɵɵi18nExp(ctx.valueA)(ctx.valueB)(ctx.valueA + ctx.valueB)(ctx.valueC);
$r3$.ɵɵi18nApply(4);
}
}
@ -1054,8 +1046,7 @@ describe('i18n support in the view compiler', () => {
}
if (rf & 2) {
$r3$.ɵɵselect(1);
$r3$.ɵɵi18nExp($r3$.ɵɵpipeBind1(2, 2, ctx.valueA));
$r3$.ɵɵi18nExp(ctx.valueA == null ? null : ctx.valueA.a == null ? null : ctx.valueA.a.b);
$r3$.ɵɵi18nExp($r3$.ɵɵpipeBind1(2, 2, ctx.valueA))(ctx.valueA == null ? null : ctx.valueA.a == null ? null : ctx.valueA.a.b);
$r3$.ɵɵi18nApply(1);
}
}
@ -1224,8 +1215,7 @@ describe('i18n support in the view compiler', () => {
$r3$.ɵɵi18nExp(ctx.one);
$r3$.ɵɵi18nApply(1);
$r3$.ɵɵselect(4);
$r3$.ɵɵi18nExp($r3$.ɵɵpipeBind1(5, 3, ctx.two));
$r3$.ɵɵi18nExp(ctx.nestedInBlockTwo);
$r3$.ɵɵi18nExp($r3$.ɵɵpipeBind1(5, 3, ctx.two))(ctx.nestedInBlockTwo);
$r3$.ɵɵi18nApply(4);
}
}
@ -1335,8 +1325,7 @@ describe('i18n support in the view compiler', () => {
}
if (rf & 2) {
$r3$.ɵɵselect(2);
$r3$.ɵɵi18nExp(ctx.valueB);
$r3$.ɵɵi18nExp(ctx.valueC);
$r3$.ɵɵi18nExp(ctx.valueB)(ctx.valueC);
$r3$.ɵɵi18nApply(3);
$r3$.ɵɵi18nExp(ctx.valueA);
$r3$.ɵɵi18nApply(1);
@ -1402,8 +1391,7 @@ describe('i18n support in the view compiler', () => {
if (rf & 2) {
const $ctx_r0$ = $r3$.ɵɵnextContext();
$r3$.ɵɵselect(2);
$r3$.ɵɵi18nExp($ctx_r0$.valueA);
$r3$.ɵɵi18nExp($r3$.ɵɵpipeBind1(4, 2, $ctx_r0$.valueB));
$r3$.ɵɵi18nExp($ctx_r0$.valueA)($r3$.ɵɵpipeBind1(4, 2, $ctx_r0$.valueB));
$r3$.ɵɵi18nApply(2);
}
}
@ -1527,8 +1515,7 @@ describe('i18n support in the view compiler', () => {
}
if (rf & 2) {
const $ctx_r2$ = $r3$.ɵɵnextContext(2);
$r3$.ɵɵi18nExp($ctx_r2$.valueC);
$r3$.ɵɵi18nExp($ctx_r2$.valueD);
$r3$.ɵɵi18nExp($ctx_r2$.valueC)($ctx_r2$.valueD);
$r3$.ɵɵi18nApply(0);
}
}
@ -1547,8 +1534,7 @@ describe('i18n support in the view compiler', () => {
const $ctx_r0$ = $r3$.ɵɵnextContext();
$r3$.ɵɵselect(4);
$r3$.ɵɵproperty("ngIf", $ctx_r0$.exists);
$r3$.ɵɵi18nExp($ctx_r0$.valueA);
$r3$.ɵɵi18nExp($r3$.ɵɵpipeBind1(3, 3, $ctx_r0$.valueB));
$r3$.ɵɵi18nExp($ctx_r0$.valueA)($r3$.ɵɵpipeBind1(3, 3, $ctx_r0$.valueB));
$r3$.ɵɵi18nApply(0);
}
}
@ -1596,8 +1582,7 @@ describe('i18n support in the view compiler', () => {
}
if (rf & 2) {
const $ctx_r1$ = $r3$.ɵɵnextContext();
$r3$.ɵɵi18nExp($ctx_r1$.valueE + $ctx_r1$.valueF);
$r3$.ɵɵi18nExp($r3$.ɵɵpipeBind1(3, 2, $ctx_r1$.valueG));
$r3$.ɵɵi18nExp($ctx_r1$.valueE + $ctx_r1$.valueF)($r3$.ɵɵpipeBind1(3, 2, $ctx_r1$.valueG));
$r3$.ɵɵi18nApply(0);
}
}
@ -2554,8 +2539,7 @@ describe('i18n support in the view compiler', () => {
if (rf & 2) {
const $ctx_r1$ = $r3$.ɵɵnextContext();
$r3$.ɵɵselect(2);
$r3$.ɵɵi18nExp($ctx_r1$.count);
$r3$.ɵɵi18nExp($ctx_r1$.count);
$r3$.ɵɵi18nExp($ctx_r1$.count)($ctx_r1$.count);
$r3$.ɵɵi18nApply(2);
}
}
@ -2615,8 +2599,7 @@ describe('i18n support in the view compiler', () => {
}
if (rf & 2) {
$r3$.ɵɵselect(1);
$r3$.ɵɵi18nExp(ctx.age);
$r3$.ɵɵi18nExp(ctx.other);
$r3$.ɵɵi18nExp(ctx.age)(ctx.other);
$r3$.ɵɵi18nApply(1);
}
}
@ -2742,8 +2725,7 @@ describe('i18n support in the view compiler', () => {
}
if (rf & 2) {
$r3$.ɵɵselect(1);
$r3$.ɵɵi18nExp(ctx.gender);
$r3$.ɵɵi18nExp(ctx.ageA + ctx.ageB + ctx.ageC);
$r3$.ɵɵi18nExp(ctx.gender)(ctx.ageA + ctx.ageB + ctx.ageC);
$r3$.ɵɵi18nApply(1);
}
}
@ -2808,8 +2790,7 @@ describe('i18n support in the view compiler', () => {
}
if (rf & 2) {
$r3$.ɵɵselect(1);
$r3$.ɵɵi18nExp(ctx.gender);
$r3$.ɵɵi18nExp(ctx.age);
$r3$.ɵɵi18nExp(ctx.gender)(ctx.age);
$r3$.ɵɵi18nApply(1);
}
}
@ -2914,8 +2895,7 @@ describe('i18n support in the view compiler', () => {
if (rf & 2) {
$r3$.ɵɵselect(3);
$r3$.ɵɵproperty("ngIf", ctx.visible);
$r3$.ɵɵi18nExp(ctx.gender);
$r3$.ɵɵi18nExp(ctx.gender);
$r3$.ɵɵi18nExp(ctx.gender)(ctx.gender);
$r3$.ɵɵi18nApply(1);
}
}
@ -2962,8 +2942,7 @@ describe('i18n support in the view compiler', () => {
}
if (rf & 2) {
$r3$.ɵɵselect(1);
$r3$.ɵɵi18nExp(ctx.age);
$r3$.ɵɵi18nExp(ctx.gender);
$r3$.ɵɵi18nExp(ctx.age)(ctx.gender);
$r3$.ɵɵi18nApply(1);
}
}
@ -3132,8 +3111,7 @@ describe('i18n support in the view compiler', () => {
}
if (rf & 2) {
const $ctx_r0$ = $r3$.ɵɵnextContext();
$r3$.ɵɵi18nExp($ctx_r0$.age);
$r3$.ɵɵi18nExp($ctx_r0$.otherAge);
$r3$.ɵɵi18nExp($ctx_r0$.age)($ctx_r0$.otherAge);
$r3$.ɵɵi18nApply(0);
}
}
@ -3151,9 +3129,7 @@ describe('i18n support in the view compiler', () => {
if (rf & 2) {
$r3$.ɵɵselect(2);
$r3$.ɵɵproperty("ngIf", ctx.ageVisible);
$r3$.ɵɵi18nExp(ctx.gender);
$r3$.ɵɵi18nExp(ctx.weight);
$r3$.ɵɵi18nExp(ctx.height);
$r3$.ɵɵi18nExp(ctx.gender)(ctx.weight)(ctx.height);
$r3$.ɵɵi18nApply(1);
}
}
@ -3204,10 +3180,7 @@ describe('i18n support in the view compiler', () => {
}
if (rf & 2) {
$r3$.ɵɵselect(1);
$r3$.ɵɵi18nExp(ctx.gender);
$r3$.ɵɵi18nExp(ctx.weight);
$r3$.ɵɵi18nExp(ctx.height);
$r3$.ɵɵi18nExp(ctx.age);
$r3$.ɵɵi18nExp(ctx.gender)(ctx.weight)(ctx.height)(ctx.age);
$r3$.ɵɵi18nApply(1);
}
}