Run fixupParentReferences when parsing isolated jsDocComment#8930
Run fixupParentReferences when parsing isolated jsDocComment#8930zhengbli merged 3 commits intomicrosoft:masterfrom
Conversation
src/compiler/parser.ts
Outdated
| forEachChild(result.jsDocComment, visitNode); | ||
|
|
||
| function visitNode(n: Node): void { | ||
| if (n.parent !== parentNode) { |
There was a problem hiding this comment.
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.
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.
|
👍 |
src/compiler/parser.ts
Outdated
| 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.
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.
That would be better, as I was thinking the fixupParentReferences was supposed to be called only for sourceFile nodes. Changing that.
|
👍 |
Fix #8676