Skip to content

Commit

Permalink
Add withSideEffects:null to RemoveUnusedLocalVariables
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Oct 23, 2024
1 parent b030670 commit 91d1862
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public J visitMethodInvocation(J.MethodInvocation method, ExecutionContext ctx)
J.MethodInvocation mi = (J.MethodInvocation) super.visitMethodInvocation(method, ctx);
if (methodMatcher.matches(mi) && isFeatureKey(mi.getArguments().get(0))) {
doAfterVisit(new SimplifyConstantIfBranchExecution().getVisitor());
doAfterVisit(new RemoveUnusedLocalVariables(null).getVisitor());
doAfterVisit(new RemoveUnusedLocalVariables(null, null).getVisitor());
doAfterVisit(new RemoveUnusedPrivateFields().getVisitor());
J.Literal literal = new J.Literal(Tree.randomId(), Space.SINGLE_SPACE, Markers.EMPTY, replacementValue, String.valueOf(replacementValue), null, JavaType.Primitive.Boolean);
return literal.withPrefix(mi.getPrefix());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public J visitMethodInvocation(J.MethodInvocation method, ExecutionContext ctx)
J.MethodInvocation mi = (J.MethodInvocation) super.visitMethodInvocation(method, ctx);
if (methodMatcher.matches(mi) && isFeatureKey(mi.getArguments().get(0))) {
doAfterVisit(new SimplifyConstantIfBranchExecution().getVisitor());
doAfterVisit(new RemoveUnusedLocalVariables(null).getVisitor());
doAfterVisit(new RemoveUnusedLocalVariables(null, null).getVisitor());
doAfterVisit(new RemoveUnusedPrivateFields().getVisitor());
J.Literal literal = new J.Literal(Tree.randomId(), Space.SINGLE_SPACE, Markers.EMPTY, replacementValue, '"' + replacementValue + '"', null, JavaType.Primitive.String);
return literal.withPrefix(mi.getPrefix());
Expand Down

0 comments on commit 91d1862

Please sign in to comment.