@Override public DfaInstructionState[] visitPush( PushInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) { if (myContext == instruction.getPlace()) { final Map<DfaVariableValue, DfaVariableState> map = ((ValuableDataFlowRunner.MyDfaMemoryState) memState).getVariableStates(); for (Map.Entry<DfaVariableValue, DfaVariableState> entry : map.entrySet()) { ValuableDataFlowRunner.ValuableDfaVariableState state = (ValuableDataFlowRunner.ValuableDfaVariableState) entry.getValue(); DfaVariableValue variableValue = entry.getKey(); final PsiExpression psiExpression = state.myExpression; if (psiExpression != null && variableValue.getQualifier() == null) { myValues.put(variableValue.getPsiVariable(), psiExpression); } } DfaValue value = instruction.getValue(); if (value instanceof DfaVariableValue && ((DfaVariableValue) value).getQualifier() == null) { if (memState.isNotNull((DfaVariableValue) value)) { myNotNulls.add(((DfaVariableValue) value).getPsiVariable()); } if (memState.isNull(value)) { myNulls.add(((DfaVariableValue) value).getPsiVariable()); } } } return super.visitPush(instruction, runner, memState); }
@Override public DfaInstructionState[] visitPush( PushInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) { if (myForPlace == instruction.getPlace()) { addToResult(((ExpressionTypeMemoryState) memState).getStates()); } return super.visitPush(instruction, runner, memState); }
public List<Pair<PsiReferenceExpression, DfaConstValue>> getConstantReferenceValues() { List<Pair<PsiReferenceExpression, DfaConstValue>> result = ContainerUtil.newArrayList(); for (PushInstruction instruction : myPossibleVariableValues.keySet()) { Collection<Object> values = myPossibleVariableValues.get(instruction); if (values.size() == 1) { Object singleValue = values.iterator().next(); if (singleValue != ANY_VALUE) { result.add( Pair.create( (PsiReferenceExpression) instruction.getPlace(), (DfaConstValue) singleValue)); } } } return result; }