Skip to content

Simplify handling of parameter properties in forEachRelatedSymbol#23213

Merged
3 commits merged into
masterfrom
parameterPropertyRefs
Apr 9, 2018
Merged

Simplify handling of parameter properties in forEachRelatedSymbol#23213
3 commits merged into
masterfrom
parameterPropertyRefs

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Apr 6, 2018

Continuation of #23028 -- we don't need a cbParameterProperties callback because in both cases we just need to call fromRoot again on the other (if parameter then property, if property then parameter) symbol.

@ghost ghost requested a review from sheetalkamat April 6, 2018 17:28
Comment thread src/services/findAllReferences.ts Outdated
if (symbol.valueDeclaration && isParameterPropertyDeclaration(symbol.valueDeclaration)) {
// For a parameter property, now try on the other symbol (property if this was a parameter, parameter if this was a property).
const paramProps = checker.getSymbolsOfParameterPropertyDeclaration(cast(symbol.valueDeclaration, isParameter), symbol.name);
Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & SymbolFlags.FunctionScopedVariable)); // is [parameter, property]
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.

Can you also assert paramProps[1].flags & SymbolFlags.Property ?

@ghost ghost merged commit e858de9 into master Apr 9, 2018
@ghost ghost deleted the parameterPropertyRefs branch April 9, 2018 20:26
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 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.

1 participant