findAllReferences: Fix declarationIsWriteAccess for PropertyAssignment in destructuring (#26949)

This commit is contained in:
Andy
2018-09-06 15:24:07 -07:00
committed by GitHub
parent a0ebbfb8f0
commit c401d63c5f
2 changed files with 5 additions and 2 deletions

View File

@@ -255,12 +255,15 @@ namespace ts.FindAllReferences {
case SyntaxKind.NamespaceExportDeclaration:
case SyntaxKind.NamespaceImport:
case SyntaxKind.Parameter:
case SyntaxKind.PropertyAssignment:
case SyntaxKind.ShorthandPropertyAssignment:
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.TypeParameter:
return true;
case SyntaxKind.PropertyAssignment:
// In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.)
return !isArrayLiteralOrObjectLiteralDestructuringPattern((decl as PropertyAssignment).parent);
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.Constructor: