mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Don't parse param init when = is required but missing
Makes another test case pass that was taking exponential time to parse, because now it notices that the = is not present and doesn't even try to parse the initialiser expression.
This commit is contained in:
@@ -3025,9 +3025,8 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
if (inParameter && requireEqualsToken) {
|
||||
// this occurs with speculative parsing of lambdas, so try to consume the initializer,
|
||||
// but signal that the parameter was missing the equals sign so it can abort if it wants
|
||||
parseAssignmentExpressionOrHigher();
|
||||
// = is required when speculatively parsing arrow function parameters,
|
||||
// so return a fake initializer as a signal that the equals token was missing
|
||||
const result = createNode(SyntaxKind.Identifier, scanner.getStartPos()) as Identifier;
|
||||
result.escapedText = "= not found" as __String;
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user