mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 11:24:49 -05:00
Merge pull request #16213 from charlespierce/await_yield_literals
Update special cases for await / yield expression parsing
This commit is contained in:
@@ -2972,7 +2972,7 @@ namespace ts {
|
||||
// for now we just check if the next token is an identifier. More heuristics
|
||||
// can be added here later as necessary. We just need to make sure that we
|
||||
// don't accidentally consume something legal.
|
||||
return lookAhead(nextTokenIsIdentifierOrKeywordOrNumberOnSameLine);
|
||||
return lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -3490,7 +3490,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// here we are using similar heuristics as 'isYieldExpression'
|
||||
return lookAhead(nextTokenIsIdentifierOnSameLine);
|
||||
return lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -4699,9 +4699,9 @@ namespace ts {
|
||||
return token() === SyntaxKind.FunctionKeyword && !scanner.hasPrecedingLineBreak();
|
||||
}
|
||||
|
||||
function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() {
|
||||
function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() {
|
||||
nextToken();
|
||||
return (tokenIsIdentifierOrKeyword(token()) || token() === SyntaxKind.NumericLiteral) && !scanner.hasPrecedingLineBreak();
|
||||
return (tokenIsIdentifierOrKeyword(token()) || token() === SyntaxKind.NumericLiteral || token() === SyntaxKind.StringLiteral) && !scanner.hasPrecedingLineBreak();
|
||||
}
|
||||
|
||||
function isDeclaration(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user