Fix for loop which retains jsdoc behaviors

This commit is contained in:
Wesley Wigham 2017-07-21 17:20:56 -07:00
parent 7cb8ce4346
commit e7bf44e820
No known key found for this signature in database
GPG Key ID: D59F87F60C5400C9

View File

@ -1881,6 +1881,11 @@ namespace ts {
if (considerSemicolonAsDelimiter && token() === SyntaxKind.SemicolonToken && !scanner.hasPrecedingLineBreak()) {
nextToken();
}
else if (isJSDocParameterStart() && parsingContext & (1 << ParsingContext.Parameters)) {
// If the token was a jsdoc parameter start and we're parsing parameter lists,
// we need to consume the (mostly erroneous) parameter token
nextToken();
}
continue;
}
@ -2202,7 +2207,11 @@ namespace ts {
return token() === SyntaxKind.DotDotDotToken ||
isIdentifierOrPattern() ||
isModifierKind(token()) ||
token() === SyntaxKind.AtToken || token() === SyntaxKind.ThisKeyword || token() === SyntaxKind.NewKeyword ||
token() === SyntaxKind.AtToken || token() === SyntaxKind.ThisKeyword || isJSDocParameterStart();
}
function isJSDocParameterStart(): boolean {
return token() === SyntaxKind.NewKeyword ||
token() === SyntaxKind.StringLiteral || token() === SyntaxKind.NumericLiteral;
}