Skip to content

Commit 38dce09

Browse files
author
Yui T
committed
Address code review
1 parent e6a1ac1 commit 38dce09

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/services/services.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3353,10 +3353,10 @@ module ts {
33533353

33543354
// Because name in short-hand property assignment has two different meanings: property name and property value,
33553355
// using go-to-definition at such position should go to the variable declaration of the property value rather than
3356-
// go to the declaration of the property name (in this case stay at the same position). However, if go-to-defition
3357-
// is performed at the location of property accessing, we would like to go to defition of the property in the short-hand
3358-
// assignment. Such case is handled as normal by below code section.
3359-
if (node.parent.kind === SyntaxKind.ShorthandPropertyAssignment && !(symbol.flags & SymbolFlags.Transient)) {
3356+
// go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition
3357+
// is performed at the location of property access, we would like to go to definition of the property in the short-hand
3358+
// assignment. This case and others are handled by the following code.
3359+
if (node.parent.kind === SyntaxKind.ShorthandPropertyAssignment) {
33603360
var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
33613361
var shorthandDeclarations = shorthandSymbol.getDeclarations();
33623362
var shorthandSymbolKind = getSymbolKind(shorthandSymbol, typeInfoResolver);

tests/cases/fourslash/goToDefinitionShorthandProperty.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
//// var /*valueDeclaration1*/name = "hello";
44
//// var /*valueDeclaration2*/id = 100000;
55
//// declare var /*valueDeclaration3*/id;
6-
//// var obj = {/*valueDefition1*/name, /*valueDefinition2*/id};
6+
//// var obj = {/*valueDefinition1*/name, /*valueDefinition2*/id};
77
//// obj./*valueReference1*/name;
88
//// obj./*valueReference2*/id;
99

10-
goTo.marker("valueDefition1");
10+
goTo.marker("valueDefinition1");
1111
goTo.definition();
1212
verify.caretAtMarker("valueDeclaration1");
1313

0 commit comments

Comments
 (0)