From ac5a4994eeea1633d59aa6c5f3e27e55110c51d6 Mon Sep 17 00:00:00 2001 From: Luro02 <24826124+Luro02@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:16:05 +0200 Subject: [PATCH] use `UsesFinder` in `InlineVariableRead` --- .../core/integrated/evaluator/fold/InlineVariableRead.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/integrated/evaluator/fold/InlineVariableRead.java b/autograder-core/src/main/java/de/firemage/autograder/core/integrated/evaluator/fold/InlineVariableRead.java index fc608681..f21de6da 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/integrated/evaluator/fold/InlineVariableRead.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/integrated/evaluator/fold/InlineVariableRead.java @@ -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; @@ -30,7 +31,7 @@ public static Fold create(boolean ignoreLocalVariables) { @Override @SuppressWarnings("unchecked") public CtExpression foldCtVariableRead(CtVariableRead ctVariableRead) { - CtVariable ctVariable = ctVariableRead.getVariable().getDeclaration(); + CtVariable ctVariable = (CtVariable) UsesFinder.getDeclaredVariable(ctVariableRead); if (ctVariable == null || this.ignoreLocalVariables && ctVariable instanceof CtLocalVariable) { return ctVariableRead;