Skip to content

Commit

Permalink
feat(compiler): allow trailing comma in array literal
Browse files Browse the repository at this point in the history
  • Loading branch information
trotyl committed Feb 17, 2018
1 parent f693be3 commit c5f26a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/compiler/src/expression_parser/parser.ts
Expand Up @@ -595,11 +595,15 @@ 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.optionalCharacter(chars.$COMMA));
}
} else {
break;
}
} while (this.optionalCharacter(chars.$COMMA));

return result;
}

Expand Down
1 change: 1 addition & 0 deletions packages/compiler/test/expression_parser/parser_spec.ts
Expand Up @@ -163,6 +163,7 @@ import {validate} from './validator';
checkAction('[]');
checkAction('[].length');
checkAction('[1, 2].length');
checkAction('[1, 2,]', '[1, 2]');
});

it('should parse map', () => {
Expand Down

0 comments on commit c5f26a2

Please sign in to comment.