Skip to content

Commit 5b23dbc

Browse files
authored
Merge pull request microsoft#14302 from Microsoft/make-special-property-assignment-apply-only-to-lhs
Provide special property assignment symbol only for left-hand side of assignment
2 parents 1a579d1 + 44e1140 commit 5b23dbc

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

src/compiler/checker.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -20930,7 +20930,9 @@ namespace ts {
2093020930
return getSymbolOfNode(entityName.parent);
2093120931
}
2093220932

20933-
if (isInJavaScriptFile(entityName) && entityName.parent.kind === SyntaxKind.PropertyAccessExpression) {
20933+
if (isInJavaScriptFile(entityName) &&
20934+
entityName.parent.kind === SyntaxKind.PropertyAccessExpression &&
20935+
entityName.parent === (entityName.parent.parent as BinaryExpression).left) {
2093420936
// Check if this is a special property assignment
2093520937
const specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName);
2093620938
if (specialPropertyAssignmentSymbol) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/// <reference path="fourslash.ts"/>
2+
// @allowJs: true
3+
// @Filename: a.js
4+
////const foo = {
5+
//// set: function (x) {
6+
//// this._x = x;
7+
//// },
8+
//// copy: function ([|x|]) {
9+
//// this._x = /**/[|x|].prop;
10+
//// }
11+
////};
12+
goTo.marker();
13+
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/// <reference path="fourslash.ts"/>
2+
// @allowJs: true
3+
// @Filename: a.js
4+
////const foo = {
5+
//// set: function (x) {
6+
//// this._x = x;
7+
//// },
8+
//// copy: function (/**/[|x|]) {
9+
//// this._x = [|x|].prop;
10+
//// }
11+
////};
12+
goTo.marker();
13+
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);

0 commit comments

Comments
 (0)