mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-12 20:25:48 -06:00
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:
commit
5b23dbc999
@ -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) {
|
||||
|
||||
13
tests/cases/fourslash/renameJsSpecialAssignmentRhs1.ts
Normal file
13
tests/cases/fourslash/renameJsSpecialAssignmentRhs1.ts
Normal 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);
|
||||
13
tests/cases/fourslash/renameJsSpecialAssignmentRhs2.ts
Normal file
13
tests/cases/fourslash/renameJsSpecialAssignmentRhs2.ts
Normal 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);
|
||||
Loading…
x
Reference in New Issue
Block a user