private void addToResult(Map<PsiExpression, PsiType> map) { if (myResult == null) { myResult = new THashMap<>(map, ExpressionTypeMemoryState.EXPRESSION_HASHING_STRATEGY); } else { final Iterator<PsiExpression> iterator = myResult.keySet().iterator(); while (iterator.hasNext()) { PsiExpression psiExpression = iterator.next(); if (!myResult.get(psiExpression).equals(map.get(psiExpression))) { iterator.remove(); } } } }
@Override @Nullable public PsiType getControlFlowExpressionType(@NotNull PsiExpression expr) { final Map<PsiExpression, PsiType> allCasts = getAllTypeCasts(expr); if (!allCasts.containsKey(expr)) { return null; // optimization } final Map<PsiExpression, PsiType> fromDfa = buildDataflowTypeMap(expr); if (fromDfa != null) { return fromDfa.get(expr); } return null; }