Skip to content

Fix find-all-references for destructured getter#17483

Merged
3 commits merged into
masterfrom
findAllRefsDestructureGetter
Aug 2, 2017
Merged

Fix find-all-references for destructured getter#17483
3 commits merged into
masterfrom
findAllRefsDestructureGetter

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Jul 28, 2017

Fixes #16922

@ghost ghost force-pushed the findAllRefsDestructureGetter branch from 6541d04 to 5d8cea4 Compare July 28, 2017 21:50
Comment thread src/services/findAllReferences.ts Outdated

const typeOfPattern = checker.getTypeAtLocation(bindingElement.parent);
const propSymbol = typeOfPattern && checker.getPropertyOfType(typeOfPattern, (<Identifier>bindingElement.name).text);
if (propSymbol && propSymbol.flags & SymbolFlags.GetAccessor) {
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.

Should check both Get and Set assessors as the below sample is not error?

class test1 {
    set x(a: number) {
    }
}

const { x } = new test1(); 

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.

Good catch! I didn't realize that was possible.

Comment thread src/services/findAllReferences.ts Outdated

const typeOfPattern = checker.getTypeAtLocation(bindingElement.parent);
const propSymbol = typeOfPattern && checker.getPropertyOfType(typeOfPattern, (<Identifier>bindingElement.name).text);
if (propSymbol && propSymbol.flags & (SymbolFlags.GetAccessor | SymbolFlags.SetAccessor)) {
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.

Nit: just use SymbolFlags.Accessor

@ghost ghost merged commit 4f13bcf into master Aug 2, 2017
@ghost ghost deleted the findAllRefsDestructureGetter branch August 2, 2017 13:51
@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.

2 participants