findAllReferences: Fix declarationIsWriteAccess for PropertyAssignment in destructuring (#26949)
This commit is contained in:
parent
a0ebbfb8f0
commit
c401d63c5f
|
@ -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:
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
////let p, b;
|
||||
////
|
||||
////p, [{ [|{| "isWriteAccess": true, "isDefinition": true |}a|]: p, b }] = [{ [|{| "isWriteAccess": true, "isDefinition": true |}a|]: 10, b: true }];
|
||||
////p, [{ [|{| "isDefinition": true |}a|]: p, b }] = [{ [|{| "isWriteAccess": true, "isDefinition": true |}a|]: 10, b: true }];
|
||||
|
||||
verify.singleReferenceGroup("(property) a: any");
|
||||
|
|
Loading…
Reference in a new issue