Skip to content

Fix find all refs in shorthand properties for imports and exports #6376

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 6 commits into from
Jan 14, 2016

Conversation

mhegazy
Copy link
Contributor

@mhegazy mhegazy commented Jan 6, 2016

Follow up to the issue reported in #6367. the change include:

  • Fix for the original reported issue regarding find all references in shorthand property declarations not picking up imported aliases. the fix is to add the SymbolFlags.Alias to the search in getShorthandAssignmentValueSymbol to avoid resolving import aliases to their target.
  • Add special handling to locating the symbol of export specifiers to get the "local" symbol (i.e. do not follow aliases) to ensure that find all refs and rename find the correct references
  • Added tests provided by @jkillian in Improve reference finding for imported variables #6367

return declaration.kind === SyntaxKind.ImportSpecifier || declaration.kind === SyntaxKind.ExportSpecifier;
});
function isImportSpecifierSymbol(symbol: Symbol) {
return (symbol.flags & SymbolFlags.Alias) && forEach(symbol.declarations, declaration => declaration.kind === SyntaxKind.ImportSpecifier);
Copy link
Member

Choose a reason for hiding this comment

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

Use getDeclarationOfKind

@mhegazy
Copy link
Contributor Author

mhegazy commented Jan 7, 2016

@DanielRosenwasser any more comments?

@adidahiya
Copy link
Contributor

would this address #3688 as well?

@DanielRosenwasser
Copy link
Member

Nice catch @adidahiya! I think it should.

@mhegazy can you confirm that? Consider adding a document highlights test if you think it would be appropriate.

I'm still not huge on the naming, but if you think it's fine, 👍

@adidahiya
Copy link
Contributor

@mhegazy friendly ping here. would be great to have this fixed in 1.8. thanks

@mhegazy
Copy link
Contributor Author

mhegazy commented Jan 13, 2016

this does not handle #3688. i will need to send a different PR for that one.

mhegazy added a commit that referenced this pull request Jan 14, 2016
Fix find all refs in shorthand properties for imports and exports
@mhegazy mhegazy merged commit c5dd17f into master Jan 14, 2016
@mhegazy mhegazy deleted the fixFindReferencesOnExports branch January 14, 2016 00:00
@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