DataFlowRunner: remove TOO_EXPENSIVE_HASH

Fixes IDEA-179369 A method calling a constructor with conditional expressions as parameters leads the method itself to be marked as "Too complex to analyse"
This commit is contained in:
Tagir Valeev
2017-09-26 13:26:55 +07:00
parent ea888e88eb
commit 8c3cb1d763
@@ -22,7 +22,6 @@ import com.intellij.codeInspection.dataFlow.value.DfaValueFactory;
import com.intellij.codeInspection.dataFlow.value.DfaVariableValue;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.psi.*;
@@ -40,7 +39,6 @@ import java.util.*;
public class DataFlowRunner {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.dataFlow.DataFlowRunner");
private static final Key<Integer> TOO_EXPENSIVE_HASH = Key.create("TOO_EXPENSIVE_HASH");
private Instruction[] myInstructions;
private final MultiMap<PsiElement, DfaMemoryState> myNestedClosures = new MultiMap<>();
@@ -138,12 +136,6 @@ public class DataFlowRunner {
}
}
Integer tooExpensiveHash = psiBlock.getUserData(TOO_EXPENSIVE_HASH);
if (tooExpensiveHash != null && tooExpensiveHash == psiBlock.getText().hashCode()) {
LOG.trace("Too complex because hasn't changed since being too complex already");
return RunnerResult.TOO_COMPLEX;
}
final StateQueue queue = new StateQueue();
for (final DfaMemoryState initialState : initialStates) {
queue.offer(new DfaInstructionState(myInstructions[0], initialState));
@@ -159,7 +151,6 @@ public class DataFlowRunner {
for (DfaInstructionState instructionState : states) {
if (count++ > stateLimit) {
LOG.trace("Too complex data flow: too many instruction states processed");
psiBlock.putUserData(TOO_EXPENSIVE_HASH, psiBlock.getText().hashCode());
return RunnerResult.TOO_COMPLEX;
}
ProgressManager.checkCanceled();
@@ -218,7 +209,6 @@ public class DataFlowRunner {
}
}
psiBlock.putUserData(TOO_EXPENSIVE_HASH, null);
LOG.trace("Analysis ok");
return RunnerResult.OK;
}