feat(compiler): allow trailing comma in array literal (#22277)
Allows `[1, 2, ]` syntax in angular expressions. closes #20773 PR Close #22277
This commit is contained in:
parent
efd0d33391
commit
8d613c1d42
|
@ -820,11 +820,14 @@ export class _ParseAST {
|
||||||
|
|
||||||
parseExpressionList(terminator: number): AST[] {
|
parseExpressionList(terminator: number): AST[] {
|
||||||
const result: AST[] = [];
|
const result: AST[] = [];
|
||||||
if (!this.next.isCharacter(terminator)) {
|
|
||||||
do {
|
do {
|
||||||
|
if (!this.next.isCharacter(terminator)) {
|
||||||
result.push(this.parsePipe());
|
result.push(this.parsePipe());
|
||||||
} while (this.consumeOptionalCharacter(chars.$COMMA));
|
} else {
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
} while (this.consumeOptionalCharacter(chars.$COMMA));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,7 @@ describe('parser', () => {
|
||||||
checkAction('[]');
|
checkAction('[]');
|
||||||
checkAction('[].length');
|
checkAction('[].length');
|
||||||
checkAction('[1, 2].length');
|
checkAction('[1, 2].length');
|
||||||
|
checkAction('[1, 2,]', '[1, 2]');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse map', () => {
|
it('should parse map', () => {
|
||||||
|
|
Loading…
Reference in New Issue