Merge pull request #14302 from Microsoft/make-special-property-assignment-apply-only-to-lhs

Provide special property assignment symbol only for left-hand side of assignment
This commit is contained in:
Nathan Shively-Sanders 2017-02-24 15:14:30 -08:00 committed by GitHub
commit 5b23dbc999
3 changed files with 29 additions and 1 deletions

View File

@ -20930,7 +20930,9 @@ namespace ts {
return getSymbolOfNode(entityName.parent);
}
if (isInJavaScriptFile(entityName) && entityName.parent.kind === SyntaxKind.PropertyAccessExpression) {
if (isInJavaScriptFile(entityName) &&
entityName.parent.kind === SyntaxKind.PropertyAccessExpression &&
entityName.parent === (entityName.parent.parent as BinaryExpression).left) {
// Check if this is a special property assignment
const specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName);
if (specialPropertyAssignmentSymbol) {

View File

@ -0,0 +1,13 @@
/// <reference path="fourslash.ts"/>
// @allowJs: true
// @Filename: a.js
////const foo = {
//// set: function (x) {
//// this._x = x;
//// },
//// copy: function ([|x|]) {
//// this._x = /**/[|x|].prop;
//// }
////};
goTo.marker();
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);

View File

@ -0,0 +1,13 @@
/// <reference path="fourslash.ts"/>
// @allowJs: true
// @Filename: a.js
////const foo = {
//// set: function (x) {
//// this._x = x;
//// },
//// copy: function (/**/[|x|]) {
//// this._x = [|x|].prop;
//// }
////};
goTo.marker();
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);