Skip to content

Recognize object literal method JSDoc comments #6870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 4, 2016

Conversation

RyanCavanaugh
Copy link
Member

Fixes #6825

@@ -1220,6 +1220,11 @@ namespace ts {
if (isSourceOfAssignmentExpressionStatement) {
return node.parent.parent.jsDocComment;
}

const isPropertyAssignmentExpression = node.parent && node.parent.kind === SyntaxKind.PropertyAssignment;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parent gets used quite a lot here and above - consider declaring a parent constant.

@@ -3960,7 +3960,7 @@ namespace ts {
shorthandDeclaration.equalsToken = equalsToken;
shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
return finishNode(shorthandDeclaration);
return addJSDocComment(finishNode(shorthandDeclaration));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice this function returns early if tryParseAccessorDeclaration is successful (or via parseMethodDeclaration@3943). Do we handle those cases, such as getters/setters? (Good tests to add also).

@billti
Copy link
Member

billti commented Feb 3, 2016

Minor comment with additional use case to check (which could be separate issue, as lower pri), else 👍

RyanCavanaugh added a commit that referenced this pull request Feb 4, 2016
Recognize object literal method JSDoc comments
@RyanCavanaugh RyanCavanaugh merged commit 6f261f5 into microsoft:master Feb 4, 2016
@RyanCavanaugh RyanCavanaugh deleted the fix6825 branch February 4, 2016 18:17
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants