Skip to content
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

Merged
merged 3 commits into from
Jun 2, 2016

Conversation

zhengbli
Copy link
Contributor

@zhengbli zhengbli commented Jun 2, 2016

Fix #8676

forEachChild(result.jsDocComment, visitNode);

function visitNode(n: Node): void {
if (n.parent !== parentNode) {
Copy link
Member

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.

Copy link
Contributor Author

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.

@RyanCavanaugh
Copy link
Member

👍

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;
Copy link
Contributor

@vladima vladima Jun 2, 2016

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?

Copy link
Contributor Author

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.

@vladima
Copy link
Contributor

vladima commented Jun 2, 2016

👍

@zhengbli zhengbli merged commit 131f759 into microsoft:master Jun 2, 2016
@zhengbli zhengbli deleted the i8676 branch June 2, 2016 21:15
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
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.

5 participants