Skip to content

Fix jsdoc typedef symbol scope + avoid bind twice if the type has a namespace prefix #14014

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
merged 3 commits into from
Feb 24, 2017

Conversation

zhengbli
Copy link
Contributor

@zhengbli zhengbli commented Feb 11, 2017

Fixes #12233


function bindJSDocTypedefTag(node: JSDocTypedefTag) {
forEachChild(node, n => {
// if the node has a fullName "A.B.C", that means symbol "C" was already bond
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo:bound

// if the node has a fullName "A.B.C", that means symbol "C" was already bound
// when we visit "fullName"; so when we visit the name "C" as the next child of
// the jsDocTypedefTag, we should skip binding it.
if (n === node.name && node.fullName.kind !== SyntaxKind.Identifier) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this bit implies that fullName can be undefined. Is this case handled?

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 should be an parsing error. If parsed correctly, fullName should always has value. Will update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha I forgot the following case ...

/* @typedef { string | number } */
var NumberLike;

It can be undefined after all.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add this as a testcase?

@zhengbli
Copy link
Contributor Author

@vladima further comments?

@zhengbli zhengbli merged commit 2d4b4c9 into microsoft:master Feb 24, 2017
@zhengbli zhengbli deleted the 12233 branch February 24, 2017 05:26
@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.

4 participants