In parser.ts, there is an identifierCount variable that is incremented every time createIdentifier is called.
Unfortunately, not all createIdentifier calls will result in an identifier in the AST, since some may have happened during speculative parsing. It may be necessary to reset identifierCount after speculative parsing fails.
Just for context, the identifierCount is computed solely for diagnostic reporting purposes. But, you're right, it ought to be saved and restored during speculative parsing.
TypeScript Version: 3.2.0-dev.20181114
In
parser.ts
, there is anidentifierCount
variable that is incremented every timecreateIdentifier
is called. Unfortunately, not allcreateIdentifier
calls will result in an identifier in the AST, since some may have happened during speculative parsing. It may be necessary to resetidentifierCount
after speculative parsing fails.