IDEA-218906 Compiling evaluator does not work for decompiled files

GitOrigin-RevId: 868d4b77366e5d80b77fe077b6dd09dd8bfc04fe
This commit is contained in:
Vitaliy.Bibaev
2020-05-01 09:40:21 +00:00
committed by intellij-monorepo-bot
parent f96ca1b495
commit 18831fb5b5
@@ -148,9 +148,10 @@ public class CompilingEvaluatorImpl extends CompilingEvaluator {
try {
XDebugSession currentSession = XDebuggerManager.getInstance(project).getCurrentSession();
JavaSdkVersion javaVersion = getJavaVersion(currentSession);
PsiElement physicalContext = findPhysicalContext(psiContext);
ExtractLightMethodObjectHandler.ExtractedData data = ExtractLightMethodObjectHandler.extractLightMethodObject(
project,
findPhysicalContext(psiContext),
physicalContext != null ? physicalContext : psiContext,
fragmentFactory.apply(psiContext),
getGeneratedClassName(),
javaVersion);
@@ -167,14 +168,10 @@ public class CompilingEvaluatorImpl extends CompilingEvaluator {
return null;
}
@NotNull
@Nullable
private static PsiElement findPhysicalContext(@NotNull PsiElement element) {
while (!element.isPhysical()) {
PsiElement context = element.getContext();
if (context == null) {
break;
}
element = context;
while (element != null && !element.isPhysical()) {
element = element.getContext();
}
return element;
}