Improve parse error for double comma somewhere inside a call expression (#20399)

This commit is contained in:
Andy
2018-01-08 10:38:55 -08:00
committed by GitHub
parent 7e150a914e
commit f83283c068
20 changed files with 67 additions and 34 deletions

View File

@@ -1429,9 +1429,13 @@ namespace ts {
return token() === SyntaxKind.CommaToken || token() === SyntaxKind.DotDotDotToken || isIdentifierOrPattern();
case ParsingContext.TypeParameters:
return isIdentifier();
case ParsingContext.ArgumentExpressions:
case ParsingContext.ArrayLiteralMembers:
return token() === SyntaxKind.CommaToken || token() === SyntaxKind.DotDotDotToken || isStartOfExpression();
if (token() === SyntaxKind.CommaToken) {
return true;
}
// falls through
case ParsingContext.ArgumentExpressions:
return token() === SyntaxKind.DotDotDotToken || isStartOfExpression();
case ParsingContext.Parameters:
return isStartOfParameter();
case ParsingContext.TypeArguments: