Skip to content

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

Merged
zhengbli merged 3 commits into
microsoft:masterfrom
zhengbli:12233
Feb 24, 2017
Merged

Fix jsdoc typedef symbol scope + avoid bind twice if the type has a namespace prefix#14014
zhengbli merged 3 commits into
microsoft:masterfrom
zhengbli:12233

Conversation

@zhengbli

@zhengbli zhengbli commented Feb 11, 2017

Copy link
Copy Markdown

Fixes #12233

Comment thread src/compiler/binder.ts Outdated

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
Copy Markdown
Member

Choose a reason for hiding this comment

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

typo:bound

Comment thread src/compiler/binder.ts Outdated
// 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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