Search in sources :

Example 1 with DfaConstValue

use of com.intellij.codeInspection.dataFlow.value.DfaConstValue 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

DfaConstValue (com.intellij.codeInspection.dataFlow.value.DfaConstValue)1 DfaValue (com.intellij.codeInspection.dataFlow.value.DfaValue)1