-
Notifications
You must be signed in to change notification settings - Fork 85
Extend InlineVariable
to support local variable assignments
#647
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
Conversation
public TreeVisitor<?, ExecutionContext> getVisitor() { | ||
return new JavaIsoVisitor<ExecutionContext>() { | ||
@Override | ||
public J.Block visitBlock(J.Block block, ExecutionContext ctx) { | ||
J.Block b = super.visitBlock(block, ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the part that needs review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions could not be made:
- src/main/java/org/openrewrite/staticanalysis/MinimumSwitchCases.java
- lines 260-260
Turns out we already have a recipe that does something similar, but with not exactly overlapping coverage: rewrite-static-analysis/src/main/java/org/openrewrite/staticanalysis/InlineVariable.java Lines 36 to 46 in a779afa
|
For inspiration around possible edge cases, see the |
InlineVariable
to support local variable assignments
Thanks! Added a few similar ones just now in 406c195 ; with that I think we're good to merge this PR. 🙏🏻 |
String result; | ||
return "hello"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should trigger RemoveUnusedLocalVariables
as an after visitor?
What's your motivation?