Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Luro02 committed Apr 26, 2024
1 parent ff64f5a commit 18f83a6
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import de.firemage.autograder.core.integrated.SpoonUtil;
import spoon.reflect.code.CtCatchVariable;
import spoon.reflect.code.CtLocalVariable;
import spoon.reflect.code.CtPattern;
import spoon.reflect.code.CtResource;
import spoon.reflect.code.CtTypePattern;
import spoon.reflect.declaration.CtElement;
import spoon.reflect.declaration.CtExecutable;
import spoon.reflect.declaration.CtParameter;
import spoon.reflect.declaration.CtTypeMember;
import spoon.reflect.declaration.CtTypeParameter;
Expand Down Expand Up @@ -81,9 +84,11 @@ public CtQuery query() {
switch (this.toSearchFor) {
// for local variables, one does not need to search the whole model, it is enough to search in the parent block
case CtLocalVariable<?> ctLocalVariable -> {
searchScope = ctLocalVariable.getParent();
if (ctLocalVariable.getParent(CtPattern.class) == null) {
searchScope = ctLocalVariable.getParent();
}
}
case CtParameter<?> ctParameter -> {
case CtParameter<?> ctParameter when ctParameter.getParent() instanceof CtExecutable<?> ctExecutable && ctExecutable.getBody() != null -> {
searchScope = ctParameter.getParent();
}
case CtCatchVariable<?> ctCatchVariable -> {
Expand All @@ -108,9 +113,4 @@ public CtQuery query() {

return this.query(searchScope);
}

@Override
public List<R> all() {
return this.query().list();
}
}

0 comments on commit 18f83a6

Please sign in to comment.