Search in sources :

Example 6 with DfaValue

use of com.intellij.codeInspection.dataFlow.value.DfaValue in project intellij-community by JetBrains.

the class EqClass method getMemberValues.

List<DfaValue> getMemberValues() {
    final List<DfaValue> result = new ArrayList<>(size());
    forEach(new TIntProcedure() {

        @Override
        public boolean execute(int c1) {
            DfaValue value = myFactory.getValue(c1);
            result.add(value);
            return true;
        }
    });
    return result;
}
Also used : TIntProcedure(gnu.trove.TIntProcedure) ArrayList(java.util.ArrayList) DfaValue(com.intellij.codeInspection.dataFlow.value.DfaValue)

Example 7 with DfaValue

use of com.intellij.codeInspection.dataFlow.value.DfaValue in project intellij-community by JetBrains.

the class DataFlowInspectionBase method reportConstantPushes.

private void reportConstantPushes(StandardDataFlowRunner runner, ProblemsHolder holder, DataFlowInstructionVisitor visitor, Set<PsiElement> reportedAnchors) {
    for (Instruction instruction : runner.getInstructions()) {
        if (instruction instanceof PushInstruction) {
            PsiExpression place = ((PushInstruction) instruction).getPlace();
            DfaValue value = ((PushInstruction) instruction).getValue();
            Object constant = value instanceof DfaConstValue ? ((DfaConstValue) value).getValue() : null;
            if (place instanceof PsiPolyadicExpression && constant instanceof Boolean && !isFlagCheck(place) && reportedAnchors.add(place)) {
                reportConstantCondition(holder, visitor, place, (Boolean) constant);
            }
        }
    }
}
Also used : DfaConstValue(com.intellij.codeInspection.dataFlow.value.DfaConstValue) DfaValue(com.intellij.codeInspection.dataFlow.value.DfaValue)

Aggregations

DfaValue (com.intellij.codeInspection.dataFlow.value.DfaValue)7 ArrayList (java.util.ArrayList)2 DfaInstructionState (com.intellij.codeInspection.dataFlow.DfaInstructionState)1 DfaConstValue (com.intellij.codeInspection.dataFlow.value.DfaConstValue)1 TIntProcedure (gnu.trove.TIntProcedure)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 NotNull (org.jetbrains.annotations.NotNull)1