Skip to content
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

fix(comment): support comment on string concatenation #1124

Merged
merged 1 commit into from
Jan 18, 2017

Conversation

tdurieux
Copy link
Collaborator

fix #1123

assertEquals("\"\" + (\"\"// comment multi line string" + newLine
+ " + \"\")", ctLocalVariableString.getDefaultExpression().toString());

CtReturn ctReturn = m1.getBody().getStatement(13);
assertEquals(createFakeComment(f, "comment return"), ctReturn.getComments().get(0));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure to understand the relation between your changes and the new test: you change the behaviour of comments for conditionnals, if and executables and you test a multiline string?... I think I miss something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is complex...
Now I print comments of CtExpression.

These lines was basically there to handle CtExpressions present in CtConditional (may not work for other expression).

if (!(thenExpression instanceof CtStatement)) {		
 	elementPrinterHelper.writeComment(thenExpression, CommentOffset.BEFORE);		
}

Now I handle the comment of every CtExpression.

More over I added a position for the string concatenation.
This way JDTCommentBuilder is able to handle the comment in string.

@surli surli merged commit dd5ff12 into INRIA:master Jan 18, 2017
@tdurieux tdurieux deleted the fix_comment_string branch June 13, 2017 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ParentNotInitializedException on CtComments
2 participants