Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Sep 5, 2018

Fixes #26890

Previously we would parse number as an Identifier, which lead to an error later. (This affected /** @type number */, not just enums.) This changes things so we use nextToken() after a jsdoc tag name.

Note than during normal scanning we skip whitespace in the scanner instead of in the parser, so scanner.getStartPos() starts at the whitespace before the token. So we now need to use getStartPositionOfRange() to get the true start.

@ghost ghost requested a review from sandersn September 5, 2018 18:19
@ghost ghost force-pushed the numberKeywordInJsDoc branch from a0db193 to 0e23b49 Compare September 5, 2018 20:48
}

function skipWhitespaceOrAsterisk(): void {
function skipWhitespaceOrAsterisk(next: () => void = nextJSDocToken): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better (at least slightly) to make next required.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about for parseJSDocIdentifierName?

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK. Just one optional style suggestion.

@ghost ghost merged commit f71d600 into master Sep 13, 2018
@ghost ghost deleted the numberKeywordInJsDoc branch September 13, 2018 22:49
@ghost ghost mentioned this pull request Sep 17, 2018
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant