Skip to content

findAllReferences: In export default foo, symbol name is foo #15846

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
1 commit merged into from
May 15, 2017

Conversation

ghost
Copy link

@ghost ghost commented May 15, 2017

Fixes #15814

Also, should be OK to return undefined from symbolName, since the result is just compared to the current search name to determine whether we should recursively search.

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented May 15, 2017

Does this also cover cases like the following?

export default Foo.Bar;

or

export default (Foo);

@ghost
Copy link
Author

ghost commented May 15, 2017

The purpose of this function is that if you have import X, we will recursively search through the original export if it is export default X but not if it is export default Y. We can't always infer a name for every expression since you could write export default 1 + 1;.
For a property access export default x.y, find-all-refs on y won't currently get references to imports of that default export even if I update symbolName, because the property symbol and exported symbol are different things. You could make an issue if in general you want references to a property access to include references to imports of exports that access that property.
I could add special handling for the case (foo) but I don't think that would really be worth it, since that doesn't seem likely to happen.

@ghost ghost merged commit 687ab54 into master May 15, 2017
@ghost ghost deleted the findAllRefs_symbolNoName branch May 15, 2017 17:38
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This pull request was closed.
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.

3 participants