This commit is contained in:
2026-06-23 22:31:47 +02:00
parent 135e4278ef
commit 652435a58d

View File

@@ -157,6 +157,15 @@ public class ConstantResolver {
private String evaluateMethodOutput(MethodInvocation mi, MethodDeclaration md, CodebaseContext context, Set<String> visited) {
if (md.getBody() == null || mi.arguments().size() != md.parameters().size()) return null;
TypeDeclaration td = findEnclosingType(md);
if (td == null) return null;
String methodFqn = context.getFqn(td) + "." + md.getName().getIdentifier();
if (!visited.add(methodFqn)) {
return null; // Cycle detected in method evaluation
}
try {
java.util.Map<String, String> localVars = new java.util.HashMap<>();
java.util.Set<String> declaredLocals = new java.util.HashSet<>();
@@ -173,6 +182,9 @@ public class ConstantResolver {
}
return evaluateBody(md.getBody(), localVars, declaredLocals, context, visited);
} finally {
visited.remove(methodFqn);
}
}
/**
@@ -187,9 +199,22 @@ public class ConstantResolver {
CodebaseContext context,
Set<String> visited) {
if (md.getBody() == null) return null;
TypeDeclaration td = findEnclosingType(md);
if (td == null) return null;
String methodFqn = context.getFqn(td) + "." + md.getName().getIdentifier();
if (!visited.add(methodFqn)) {
return null; // Cycle detected in method evaluation
}
try {
java.util.Map<String, String> localVars = new java.util.HashMap<>(prebuiltLocals);
java.util.Set<String> declaredLocals = new java.util.HashSet<>(prebuiltLocals.keySet());
return evaluateBody(md.getBody(), localVars, declaredLocals, context, visited);
} finally {
visited.remove(methodFqn);
}
}
/**