-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Run fixupParentReferences when parsing isolated jsDocComment #8930
Conversation
forEachChild(result.jsDocComment, visitNode); | ||
|
||
function visitNode(n: Node): void { | ||
if (n.parent !== parentNode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd expect the check here to be n.parent === undefined
. Is there ever a case where the node has a parent but it's not the current parent? That seems like it should never happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might happen during incremental parsing; however as the jsDocComment is parsed in isolation, it is always parsed from scratch, so you are right that it should never happen. Will update.
👍 |
if (result && result.jsDocComment) { | ||
// because the jsDocComment was parsed out of the source file, it might | ||
// not be covered by the fixupParentReferences. | ||
let parentNode: Node = result.jsDocComment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you just call fixupParentReferences
here and pass result.jsDocComment
as a parameter instead of copying the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be better, as I was thinking the fixupParentReferences
was supposed to be called only for sourceFile
nodes. Changing that.
👍 |
Fix #8676