Skip to content

Commit

Permalink
fix(compiler): avoid a ...null spread in extraction (#16547)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mprobst authored and mhevery committed May 8, 2017
1 parent f0f6544 commit e0a8376
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/compiler/src/i18n/message_bundle.ts
Expand Up @@ -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) {
Expand All @@ -41,7 +41,7 @@ export class MessageBundle {
}

this._messages.push(...i18nParserResult.messages);
return null;
return [];
}

// Return the message in the internal format
Expand Down

0 comments on commit e0a8376

Please sign in to comment.