fix(compiler): avoid a `...null` spread in extraction (#16547)

This code only runs in ES5 mode in the test suite, so this is difficult to test.
However `updateFromTemplate` is being called with a spread operator, as
`...updateFromTemplate(...)`. The spread operator should fail on `null` values.
This change avoids the problem by always returning a (possibly empty) array.

PR Close #16547
This commit is contained in:
Martin Probst 2017-05-04 19:36:05 +02:00 committed by Miško Hevery
parent f0f65443c6
commit e0a8376237
1 changed files with 2 additions and 2 deletions

View File

@ -26,7 +26,7 @@ export class MessageBundle {
private _implicitAttrs: {[k: string]: string[]}, private _locale: string|null = null) {}
updateFromTemplate(html: string, url: string, interpolationConfig: InterpolationConfig):
ParseError[]|null {
ParseError[] {
const htmlParserResult = this._htmlParser.parse(html, url, true, interpolationConfig);
if (htmlParserResult.errors.length) {
@ -41,7 +41,7 @@ export class MessageBundle {
}
this._messages.push(...i18nParserResult.messages);
return null;
return [];
}
// Return the message in the internal format