Skip to content

Commit

Permalink
refactor: refactor visitCtForEach method (#5244)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinWitt authored Jun 11, 2023
1 parent bc333f9 commit 779438a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/spoon/support/compiler/jdt/ParentExiter.java
Original file line number Diff line number Diff line change
Expand Up @@ -654,14 +654,13 @@ private boolean isContainedInForCondition() {

@Override
public void visitCtForEach(CtForEach foreach) {
if (foreach.getVariable() == null && child instanceof CtVariable) {
if (foreach.getVariable() == null && child instanceof CtLocalVariable<?>) {
foreach.setVariable((CtLocalVariable<?>) child);
return;
} else if (foreach.getExpression() == null && child instanceof CtExpression) {
foreach.setExpression((CtExpression<?>) child);
return;
} else {
super.visitCtForEach(foreach);
}
super.visitCtForEach(foreach);
}

@Override
Expand Down

0 comments on commit 779438a

Please sign in to comment.