Support JSDoc on class / obj. literal getters

Fixes #6878
This commit is contained in:
Ryan Cavanaugh
2016-02-29 18:55:32 -08:00
parent 8a72229ce2
commit 50eca44e46
2 changed files with 21 additions and 15 deletions

View File

@@ -3954,7 +3954,7 @@ namespace ts {
function tryParseAccessorDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): AccessorDeclaration {
if (parseContextualModifier(SyntaxKind.GetKeyword)) {
return parseAccessorDeclaration(SyntaxKind.GetAccessor, fullStart, decorators, modifiers);
return addJSDocComment(parseAccessorDeclaration(SyntaxKind.GetAccessor, fullStart, decorators, modifiers));
}
else if (parseContextualModifier(SyntaxKind.SetKeyword)) {
return parseAccessorDeclaration(SyntaxKind.SetAccessor, fullStart, decorators, modifiers);

View File

@@ -2,19 +2,25 @@
// @allowNonTsExtensions: true
// @Filename: file.js
//// /**
//// * This is a very cool function that is very nice.
//// * @returns something
//// * @param p anotherthing
//// */
//// function a1(p) {
//// try {
//// throw new Error('x');
//// } catch (x) { x--; }
//// return 23;
//// let x = {
//// /** This is cool*/
//// get m() {
//// return 0;
//// }
//// }
////
//// x - /**/a1()
//// x.m/*1*/;
////
//// class Foo {
//// /** This is cool too*/
//// get b() {
//// return 0;
//// }
//// }
//// var y = new Foo();
//// y.b/*2*/;
goTo.marker();
verify.quickInfoExists();
goTo.marker('1');
verify.quickInfoIs(undefined, 'This is cool');
goTo.marker('2');
verify.quickInfoIs(undefined, 'This is cool too');