Search in sources :

Example 1 with DFAType

use of org.jetbrains.plugins.groovy.lang.psi.dataFlow.DFAType in project intellij-community by JetBrains.

the class TypeDfaState method getBindings.

Map<String, PsiType> getBindings(Instruction instruction) {
    HashMap<String, PsiType> map = ContainerUtil.newHashMap();
    for (Map.Entry<String, DFAType> entry : myVarTypes.entrySet()) {
        DFAType value = entry.getValue();
        map.put(entry.getKey(), value == null ? null : value.negate(instruction).getResultType());
    }
    return map;
}
Also used : Map(java.util.Map) HashMap(java.util.HashMap) PsiType(com.intellij.psi.PsiType) DFAType(org.jetbrains.plugins.groovy.lang.psi.dataFlow.DFAType)

Example 2 with DFAType

use of org.jetbrains.plugins.groovy.lang.psi.dataFlow.DFAType in project intellij-community by JetBrains.

the class TypeDfaState method joinState.

void joinState(TypeDfaState another, PsiManager manager) {
    for (Map.Entry<String, DFAType> entry : another.myVarTypes.entrySet()) {
        final String name = entry.getKey();
        final DFAType t1 = entry.getValue();
        if (myVarTypes.containsKey(name)) {
            final DFAType t2 = myVarTypes.get(name);
            if (t1 != null && t2 != null) {
                myVarTypes.put(name, DFAType.create(t1, t2, manager));
            } else {
                myVarTypes.put(name, null);
            }
        }
    }
}
Also used : Map(java.util.Map) HashMap(java.util.HashMap) DFAType(org.jetbrains.plugins.groovy.lang.psi.dataFlow.DFAType)

Aggregations

HashMap (java.util.HashMap)2 Map (java.util.Map)2 DFAType (org.jetbrains.plugins.groovy.lang.psi.dataFlow.DFAType)2 PsiType (com.intellij.psi.PsiType)1