public DfaInstructionState[] visitPush( PushInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) { if (instruction.isFieldReference()) { memState.fieldReferenced(); } memState.push(instruction.getValue()); return nextInstruction(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; }
@Override public DfaInstructionState[] visitPush( PushInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) { if (instruction.isReferenceRead()) { DfaValue dfaValue = instruction.getValue(); if (dfaValue instanceof DfaVariableValue) { DfaConstValue constValue = memState.getConstantValue((DfaVariableValue) dfaValue); myPossibleVariableValues.putValue( instruction, constValue != null && (constValue.getValue() == null || constValue.getValue() instanceof Boolean) ? constValue : ANY_VALUE); } } return super.visitPush(instruction, runner, memState); }