JS: Fix source locations for JSDoc type annotations#1528
Merged
semmle-qlci merged 12 commits intogithub:rc/1.21from Jul 3, 2019
Merged
JS: Fix source locations for JSDoc type annotations#1528semmle-qlci merged 12 commits intogithub:rc/1.21from
semmle-qlci merged 12 commits intogithub:rc/1.21from
Conversation
xiemaisi
suggested changes
Jul 1, 2019
xiemaisi
left a comment
There was a problem hiding this comment.
Wow, kudos for fixing this, that can't have been fun! I only have one extremely minor niggle, otherwise I trust your testing.
| /** | ||
| * Returns the absolute position of the end of the previous token. | ||
| * | ||
| * This can differ from the start of the current token case the two tokens |
There was a problem hiding this comment.
Suggested change
| * This can differ from the start of the current token case the two tokens | |
| * This can differ from the start of the current token in case the two tokens |
xiemaisi
approved these changes
Jul 3, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In 1.20 we added support for JSDoc source locations, but the locations are relative to the surrounding tag, not absolute within the file.
The fix required some substantial changes to the doctrine-based parser, as the parsed string wasn't always a true substring of the source code. For instance, before parsing a type, all line breaks and indentation and leading
*s were stripped out, which made it impractical to maintain source locations.Fixes ODASA-8011