Skip to content

Use nextToken() after parsing a tag name so we can parse type keywords #26915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
3 commits merged into from
Sep 13, 2018

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
@@ -6513,7 +6513,7 @@ namespace ts {
}
}

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.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant