-
-
Notifications
You must be signed in to change notification settings - Fork 353
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
feat: add CtStatement#comment to comment code #3494
Conversation
Add Boilerplate test class statementComment Fixes INRIA#2013
body and as child element of another block. Add test methods. Fixes INRIA#2013
…d of CtStatementImpl Fixes INRIA#2013
Thanks for the proposal. There is a lot of code duplication here. Here is a tentative solution, by putting adding a single method in CtElementImpl#comment if (this instanceof CtStatement && getParent() instanceof CtBlock) {
// do it
} else {
throw new UnsupportedOperationException()
} This would make this feature more understandable and maintainable. WDYT? |
Thanks Benjamin. |
Couldn't the instanceOf be replaced with a visitor? Less usage of instanceOf is always better |
that's also an option. but we like to KISS: the simpler the better.
|
Thank you very much for the kind suggestions. I will make the following changes:
Kindly let me know about your views on these and I will go ahead with the implementation. |
yes, and remove changes in CtClassImpl, CtUnaryOperatorImpl, CtInvocationImpl, CtConstructorCallImpl, etc. thanks! |
Remove #comment from CtClassImpl, CtUnaryOperatorImpl, CtInvocationImpl and CtConstructorCallImpl Based on comments and suggestions at INRIA#3494 Fixes INRIA#2013
…edOperationException Fixes INRIA#2013
Thanks a lot! In Spoon, we have one comment line per test that states the test intention, the contract that is being tested. By convention, it starts with
Could you add this contract line in each test? Thanks! |
I have added the contract statements. |
Thanks a lot. LGTM, will merge. |
Thanks a lot @LakshyAAAgrawal for your contribution! |
Add "comment" method to comment out a statement.
In case of a CtBlock, if the parent is a method(the block defines a method body) then the statements within the block are commented out, otherwise, the statement itself is commented out. In case of multiline statements, a block comment is created, otherwise an inline comment is created.
Currently working on testcases for all the child classes of CtStatement.
Fixes #2013