fix(ivy): handle pipes in i18n attributes properly (#30573)

Prior to this change we processed binding expression (including bindings with pipes) in i18n attributes before we generate update instruction. As a result, slot offsets for pipeBind instructions were calculated incorrectly. Now we perform binding expression processing when we generate "update block" instructions, so offsets are calculated correctly.

PR Close #30573
This commit is contained in:
Andrew Kushnir
2019-05-20 14:40:44 -07:00
committed by Jason Aden
parent 70fd4300f4
commit 02523debe5
3 changed files with 16 additions and 7 deletions

View File

@ -643,8 +643,9 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
i18nAttrArgs.push(o.literal(attr.name), this.i18nTranslate(message, params));
converted.expressions.forEach(expression => {
hasBindings = true;
const binding = this.convertExpressionBinding(implicit, expression);
this.updateInstruction(elementIndex, element.sourceSpan, R3.i18nExp, [binding]);
this.updateInstruction(
elementIndex, element.sourceSpan, R3.i18nExp,
() => [this.convertExpressionBinding(implicit, expression)]);
});
}
}