Skip to content

Commit

Permalink
use UsesFinder in InlineVariableRead
Browse files Browse the repository at this point in the history
  • Loading branch information
Luro02 committed Jul 23, 2024
1 parent d9c18c0 commit ac5a499
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.firemage.autograder.core.integrated.evaluator.fold;

import de.firemage.autograder.core.integrated.SpoonUtil;
import de.firemage.autograder.core.integrated.UsesFinder;
import spoon.reflect.code.CtExpression;
import spoon.reflect.code.CtLiteral;
import spoon.reflect.code.CtLocalVariable;
Expand Down Expand Up @@ -30,7 +31,7 @@ public static Fold create(boolean ignoreLocalVariables) {
@Override
@SuppressWarnings("unchecked")
public <T> CtExpression<T> foldCtVariableRead(CtVariableRead<T> ctVariableRead) {
CtVariable<T> ctVariable = ctVariableRead.getVariable().getDeclaration();
CtVariable<T> ctVariable = (CtVariable<T>) UsesFinder.getDeclaredVariable(ctVariableRead);

if (ctVariable == null || this.ignoreLocalVariables && ctVariable instanceof CtLocalVariable<T>) {
return ctVariableRead;
Expand Down

0 comments on commit ac5a499

Please sign in to comment.