diff --git a/packages/compiler/src/expression_parser/parser.ts b/packages/compiler/src/expression_parser/parser.ts index 958f7e1230..863c860993 100644 --- a/packages/compiler/src/expression_parser/parser.ts +++ b/packages/compiler/src/expression_parser/parser.ts @@ -820,11 +820,14 @@ export class _ParseAST { parseExpressionList(terminator: number): AST[] { const result: AST[] = []; - if (!this.next.isCharacter(terminator)) { - do { + + do { + if (!this.next.isCharacter(terminator)) { result.push(this.parsePipe()); - } while (this.consumeOptionalCharacter(chars.$COMMA)); - } + } else { + break; + } + } while (this.consumeOptionalCharacter(chars.$COMMA)); return result; } diff --git a/packages/compiler/test/expression_parser/parser_spec.ts b/packages/compiler/test/expression_parser/parser_spec.ts index 52db296380..7140f5d9bd 100644 --- a/packages/compiler/test/expression_parser/parser_spec.ts +++ b/packages/compiler/test/expression_parser/parser_spec.ts @@ -106,6 +106,7 @@ describe('parser', () => { checkAction('[]'); checkAction('[].length'); checkAction('[1, 2].length'); + checkAction('[1, 2,]', '[1, 2]'); }); it('should parse map', () => {