SideEffectVisitor: fixes after separation of FlushVariableInstruction and FlushFieldsInstruction

This commit is contained in:
Tagir Valeev
2018-04-03 10:02:14 +07:00
parent 519cd800c8
commit 0080280e10
@@ -1,10 +1,7 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInspection.dataFlow;
import com.intellij.codeInspection.dataFlow.instructions.AssignInstruction;
import com.intellij.codeInspection.dataFlow.instructions.FlushVariableInstruction;
import com.intellij.codeInspection.dataFlow.instructions.MethodCallInstruction;
import com.intellij.codeInspection.dataFlow.instructions.ReturnInstruction;
import com.intellij.codeInspection.dataFlow.instructions.*;
import com.intellij.codeInspection.dataFlow.value.DfaValue;
import com.intellij.codeInspection.dataFlow.value.DfaVariableValue;
import org.jetbrains.annotations.NotNull;
@@ -24,12 +21,19 @@ public class SideEffectVisitor extends StandardInstructionVisitor {
return false;
}
@Override
public DfaInstructionState[] visitFlushFields(FlushFieldsInstruction instruction,
DataFlowRunner runner,
DfaMemoryState memState) {
runner.cancel();
return super.visitFlushFields(instruction, runner, memState);
}
@Override
public DfaInstructionState[] visitFlushVariable(FlushVariableInstruction instruction,
DataFlowRunner runner,
DfaMemoryState memState) {
final DfaVariableValue variable = instruction.getVariable();
if (variable == null || !isModificationAllowed(variable)) {
if (!isModificationAllowed(instruction.getVariable())) {
runner.cancel();
}
return super.visitFlushVariable(instruction, runner, memState);