Skip to content

Commit

Permalink
Merge pull request #12691 from Microsoft/displayPartKind
Browse files Browse the repository at this point in the history
Write property name of destructuring pattern explicitly when writing symbol display for binding element
  • Loading branch information
sheetalkamat authored Dec 6, 2016
2 parents 847b42d + 7d049c2 commit 2a65f5b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2673,7 +2673,7 @@ namespace ts {
}
Debug.assert(bindingElement.kind === SyntaxKind.BindingElement);
if (bindingElement.propertyName) {
writer.writeSymbol(getTextOfNode(bindingElement.propertyName), bindingElement.symbol);
writer.writeProperty(getTextOfNode(bindingElement.propertyName));
writePunctuation(writer, SyntaxKind.ColonToken);
writeSpace(writer);
}
Expand Down
1 change: 1 addition & 0 deletions src/compiler/declarationEmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ namespace ts {
writer.writeSpace = writer.write;
writer.writeStringLiteral = writer.writeLiteral;
writer.writeParameter = writer.write;
writer.writeProperty = writer.write;
writer.writeSymbol = writer.write;
setWriter(writer);
}
Expand Down
1 change: 1 addition & 0 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2407,6 +2407,7 @@ namespace ts {
writeSpace(text: string): void;
writeStringLiteral(text: string): void;
writeParameter(text: string): void;
writeProperty(text: string): void;
writeSymbol(text: string, symbol: Symbol): void;
writeLine(): void;
increaseIndent(): void;
Expand Down
1 change: 1 addition & 0 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace ts {
writeSpace: writeText,
writeStringLiteral: writeText,
writeParameter: writeText,
writeProperty: writeText,
writeSymbol: writeText,

// Completely ignore indentation for string writers. And map newlines to
Expand Down
1 change: 1 addition & 0 deletions src/services/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,7 @@ namespace ts {
writeSpace: text => writeKind(text, SymbolDisplayPartKind.space),
writeStringLiteral: text => writeKind(text, SymbolDisplayPartKind.stringLiteral),
writeParameter: text => writeKind(text, SymbolDisplayPartKind.parameterName),
writeProperty: text => writeKind(text, SymbolDisplayPartKind.propertyName),
writeSymbol,
writeLine,
increaseIndent: () => { indent++; },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/// <reference path='fourslash.ts' />

// @filename: a.tsx
////import * as React from 'react';
////interface SomeInterface {
//// someBoolean: boolean,
//// someString: string;
////}
////interface SomeProps {
//// someProp: SomeInterface;
////}
////export const /*1*/SomeStatelessComponent = ({someProp: { someBoolean, someString}}: SomeProps) => (<div>{`${someBoolean}${someString}`});

goTo.marker("1");
verify.quickInfoExists();

0 comments on commit 2a65f5b

Please sign in to comment.