mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
some diagnostics for EA-28785 (wrong instruction passed to dfa)
This commit is contained in:
+5
-1
@@ -21,17 +21,21 @@ import org.jetbrains.plugins.groovy.lang.psi.controlFlow.Instruction;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.controlFlow.ReadWriteVariableInstruction;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.dataFlow.DfaInstance;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class ReachingDefinitionsDfaInstance implements DfaInstance<TIntObjectHashMap<TIntHashSet>> {
|
||||
private final TObjectIntHashMap<String> myVarToIndexMap = new TObjectIntHashMap<String>();
|
||||
private final Instruction[] myFlow;
|
||||
|
||||
public int getVarIndex(String varName) {
|
||||
return myVarToIndexMap.get(varName);
|
||||
}
|
||||
|
||||
public ReachingDefinitionsDfaInstance(Instruction[] flow) {
|
||||
myFlow = flow;
|
||||
int num = 0;
|
||||
for (Instruction instruction : flow) {
|
||||
if (instruction instanceof ReadWriteVariableInstruction) {
|
||||
@@ -48,7 +52,7 @@ public class ReachingDefinitionsDfaInstance implements DfaInstance<TIntObjectHas
|
||||
if (instruction instanceof ReadWriteVariableInstruction) {
|
||||
final ReadWriteVariableInstruction varInsn = (ReadWriteVariableInstruction) instruction;
|
||||
final String name = varInsn.getVariableName();
|
||||
assert myVarToIndexMap.containsKey(name);
|
||||
assert myVarToIndexMap.containsKey(name) : name + "; " + Arrays.asList(myFlow).contains(instruction);
|
||||
final int num = myVarToIndexMap.get(name);
|
||||
if (varInsn.isWrite()) {
|
||||
registerDef(m, varInsn, num);
|
||||
|
||||
Reference in New Issue
Block a user