PR feedback

This commit is contained in:
Sheetal Nandi
2016-04-11 14:56:12 -07:00
parent 7a09e2f0e9
commit 529bdd4ea6

View File

@@ -6270,19 +6270,20 @@ namespace ts {
// object literal, lookup the property symbol in the contextual type, and use this symbol to
// compare to our searchSymbol
if (isNameOfPropertyAssignment(referenceLocation)) {
const contexualSymbol = forEach(getPropertySymbolsFromContextualType(referenceLocation), contextualSymbol => {
const contextualSymbol = forEach(getPropertySymbolsFromContextualType(referenceLocation), contextualSymbol => {
return forEach(typeChecker.getRootSymbols(contextualSymbol), s => searchSymbols.indexOf(s) >= 0 ? s : undefined);
});
if (contexualSymbol) {
return contexualSymbol;
if (contextualSymbol) {
return contextualSymbol;
}
// If the reference location is name of property symbol from object literal destructuring pattern
// Compare it to search symbol something similar to 'property' from
// If the reference location is the name of property from object literal destructuring pattern
// Get the property symbol from the object literal's type and look if thats the search symbol
// In below eg. get 'property' from type of elems iterating type
// for ( { property: p2 } of elems) { }
if (isArrayLiteralOrObjectLiteralDestructuringPattern(referenceLocation.parent.parent)) {
// Do work to determine if this is property symbol corresponding to the search symbol
// Do work to determine if this is a property symbol corresponding to the search symbol
const typeOfObjectLiteral = typeChecker.getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(<Expression>referenceLocation.parent.parent);
if (typeOfObjectLiteral) {
const propertySymbol = typeChecker.getPropertyOfType(typeOfObjectLiteral, (<Identifier>referenceLocation).text);