use of org.jetbrains.plugins.groovy.lang.psi.controlFlow.CallEnvironment in project intellij-community by JetBrains.
the class DFAEngine method performDFA.
@Nullable
private List<E> performDFA(boolean timeout) {
final int n = myFlow.length;
final List<E> info = new ArrayList<>(Collections.nCopies(n, myDfa.initial()));
final CallEnvironment env = new MyCallEnvironment(n);
final WorkList workList = new WorkList(getFlowOrder());
while (!workList.isEmpty()) {
ProgressManager.checkCanceled();
if (timeout && checkCounter())
return null;
final int num = workList.next();
final Instruction curr = myFlow[num];
// saved outbound state
final E oldE = info.get(num);
// inbound state
final E newE = getInboundState(curr, info, env);
// newly modified outbound state
myDfa.fun(newE, curr);
if (!mySemilattice.eq(newE, oldE)) {
// if outbound state changed
// save new state
info.set(num, newE);
for (Instruction next : getNext(curr, env)) {
workList.offer(next.num());
}
}
}
return info;
}
Aggregations