本文整理汇总了Java中com.intellij.codeInspection.dataFlow.DfaMemoryState类的典型用法代码示例。如果您正苦于以下问题:Java DfaMemoryState类的具体用法?Java DfaMemoryState怎么用?Java DfaMemoryState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DfaMemoryState类属于com.intellij.codeInspection.dataFlow包,在下文中一共展示了DfaMemoryState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accept
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Override
public DfaInstructionState[] accept(DataFlowRunner runner, DfaMemoryState memState, InstructionVisitor visitor) {
if (myDuplicationCount == 1 && myValueCount == 1) {
memState.push(memState.peek());
} else {
List<DfaValue> values = new ArrayList<DfaValue>(myValueCount);
for (int i = 0; i < myValueCount; i++) {
values.add(memState.pop());
}
for (int j = 0; j < myDuplicationCount + 1; j++) {
for (int i = values.size() - 1; i >= 0; i--) {
memState.push(values.get(i));
}
}
}
Instruction nextInstruction = runner.getInstruction(getIndex() + 1);
return new DfaInstructionState[]{new DfaInstructionState(nextInstruction, memState)};
}
示例2: accept
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Override
public DfaInstructionState[] accept(DataFlowRunner runner, DfaMemoryState memState, InstructionVisitor visitor) {
if (myDuplicationCount == 1 && myValueCount == 1) {
memState.push(memState.peek());
} else {
List<DfaValue> values = new ArrayList<DfaValue>(myValueCount);
for (int i = 0; i < myValueCount; i++) {
values.add(memState.pop());
}
for (int j = 0; j < myDuplicationCount; j++) {
for (int i = values.size() - 1; i >= 0; i--) {
memState.push(values.get(i));
}
}
}
Instruction nextInstruction = runner.getInstruction(getIndex() + 1);
return new DfaInstructionState[]{new DfaInstructionState(nextInstruction, memState)};
}
示例3: accept
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Override
public DfaInstructionState[] accept(DataFlowRunner runner, DfaMemoryState memState, InstructionVisitor visitor)
{
if(myDuplicationCount == 1 && myValueCount == 1)
{
memState.push(memState.peek());
}
else
{
List<DfaValue> values = new ArrayList<DfaValue>(myValueCount);
for(int i = 0; i < myValueCount; i++)
{
values.add(memState.pop());
}
for(int j = 0; j < myDuplicationCount + 1; j++)
{
for(int i = values.size() - 1; i >= 0; i--)
{
memState.push(values.get(i));
}
}
}
Instruction nextInstruction = runner.getInstruction(getIndex() + 1);
return new DfaInstructionState[]{new DfaInstructionState(nextInstruction, memState)};
}
示例4: accept
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Override
public DfaInstructionState[] accept(DataFlowRunner runner, DfaMemoryState stateBefore, InstructionVisitor visitor) {
final DfaValue a = stateBefore.pop();
final DfaValue b = stateBefore.pop();
stateBefore.push(a);
stateBefore.push(b);
Instruction nextInstruction = runner.getInstruction(getIndex() + 1);
return new DfaInstructionState[]{new DfaInstructionState(nextInstruction, stateBefore)};
}
示例5: accept
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Override
public DfaInstructionState[] accept(DataFlowRunner runner, DfaMemoryState state, InstructionVisitor visitor) {
if (!myVarsToFlush.isEmpty()) {
for (DfaVariableValue value : myVarsToFlush) {
state.flushVariable(value);
}
}
return nextInstruction(runner, state);
}
示例6: accept
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Override
public DfaInstructionState[] accept(DataFlowRunner runner, DfaMemoryState stateBefore, InstructionVisitor visitor) {
final int returnIndex = getIndex() + 1;
stateBefore.pushOffset(returnIndex);
Instruction nextInstruction = runner.getInstruction(mySubprogramOffset);
return new DfaInstructionState[] {new DfaInstructionState(nextInstruction, stateBefore)};
}
示例7: isMemoryStateProcessed
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
public boolean isMemoryStateProcessed(DfaMemoryState dfaMemState) {
for (DfaMemoryState state : myProcessedStates) {
ProgressManager.checkCanceled();
if (dfaMemState.equals(state)) {
return true;
}
}
return false;
}
示例8: accept
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Override
public DfaInstructionState[] accept(DataFlowRunner runner, DfaMemoryState stateBefore, InstructionVisitor visitor)
{
List<DfaValue> removed = IntStreamEx.range(myCount).mapToObj(idx -> stateBefore.pop()).toList();
IntStreamEx.of(myReplacement).elements(removed).forEach(stateBefore::push);
Instruction nextInstruction = runner.getInstruction(getIndex() + 1);
return new DfaInstructionState[]{new DfaInstructionState(nextInstruction, stateBefore)};
}
示例9: accept
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Override
public DfaInstructionState[] accept(DataFlowRunner runner, DfaMemoryState stateBefore, InstructionVisitor visitor)
{
final DfaValue a = stateBefore.pop();
final DfaValue b = stateBefore.pop();
stateBefore.push(a);
stateBefore.push(b);
Instruction nextInstruction = runner.getInstruction(getIndex() + 1);
return new DfaInstructionState[]{new DfaInstructionState(nextInstruction, stateBefore)};
}
示例10: accept
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Override
public DfaInstructionState[] accept(DataFlowRunner runner, DfaMemoryState state, InstructionVisitor visitor)
{
if(!myVarsToFlush.isEmpty())
{
for(DfaVariableValue value : myVarsToFlush)
{
state.flushVariable(value);
}
}
return nextInstruction(runner, state);
}
示例11: buildDataflowTypeMap
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Nullable
private static Map<PsiExpression, PsiType> buildDataflowTypeMap(PsiExpression forPlace)
{
PsiElement scope = DfaPsiUtil.getTopmostBlockInSameClass(forPlace);
if(scope == null)
{
PsiFile file = forPlace.getContainingFile();
if(!(file instanceof PsiCodeFragment))
{
return Collections.emptyMap();
}
scope = file;
}
DataFlowRunner runner = new DataFlowRunner()
{
@NotNull
@Override
protected DfaMemoryState createMemoryState()
{
return new ExpressionTypeMemoryState(getFactory());
}
};
final ExpressionTypeInstructionVisitor visitor = new ExpressionTypeInstructionVisitor(forPlace);
if(runner.analyzeMethod(scope, visitor) == RunnerResult.OK)
{
return visitor.getResult();
}
return null;
}
示例12: visitInstanceof
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Override
public DfaInstructionState[] visitInstanceof(InstanceofInstruction instruction, DataFlowRunner runner, DfaMemoryState memState)
{
memState.pop();
memState.pop();
memState.push(new DfaInstanceofValue(runner.getFactory(), instruction.getLeft(), instruction.getCastType()));
return new DfaInstructionState[]{new DfaInstructionState(runner.getInstruction(instruction.getIndex() + 1), memState)};
}
示例13: visitMethodCall
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Override
public DfaInstructionState[] visitMethodCall(MethodCallInstruction instruction, DataFlowRunner runner, DfaMemoryState memState)
{
if(myForPlace == instruction.getCallExpression())
{
addToResult(((ExpressionTypeMemoryState) memState).getStates());
}
return super.visitMethodCall(instruction, runner, memState);
}
示例14: visitPush
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Override
public DfaInstructionState[] visitPush(PushInstruction instruction, DataFlowRunner runner, DfaMemoryState memState)
{
if(myForPlace == instruction.getPlace())
{
addToResult(((ExpressionTypeMemoryState) memState).getStates());
}
return super.visitPush(instruction, runner, memState);
}
示例15: accept
import com.intellij.codeInspection.dataFlow.DfaMemoryState; //导入依赖的package包/类
@Override
public DfaInstructionState[] accept(DataFlowRunner runner, DfaMemoryState stateBefore, InstructionVisitor visitor) {
return visitor.visitInstanceof(this, runner, stateBefore);
}