public class ProgVarReplaceVisitor extends CreatingASTVisitor
CreatingASTVisitor.DefaultAction
Modifier and Type | Field and Description |
---|---|
protected boolean |
replaceallbynew |
protected java.util.Map<ProgramVariable,ProgramVariable> |
replaceMap
stores the program variables to be replaced as keys and the new program
variables as values
|
private ProgramElement |
result |
CHANGED, preservesPositionInfo, stack
services
Constructor and Description |
---|
ProgVarReplaceVisitor(ProgramElement st,
java.util.Map<ProgramVariable,ProgramVariable> map,
boolean replaceall,
Services services)
creates a visitor that replaces the program variables in the given
statement
|
ProgVarReplaceVisitor(ProgramElement st,
java.util.Map<ProgramVariable,ProgramVariable> map,
Services services)
creates a visitor that replaces the program variables in the given
statement by new ones with the same name
|
addChild, addChildren, addToTopOfStack, changed, doDefaultAction, getPosition, performActionOnAllFields, performActionOnArrayInitializer, performActionOnArrayLengthReference, performActionOnArrayReference, performActionOnAssert, performActionOnBinaryAnd, performActionOnBinaryAndAssignment, performActionOnBinaryNot, performActionOnBinaryOr, performActionOnBinaryOrAssignment, performActionOnBinaryXOr, performActionOnBinaryXOrAssignment, performActionOnBreak, performActionOnCase, performActionOnCatch, performActionOnClassInitializer, performActionOnConditional, performActionOnContinue, performActionOnCopyAssignment, performActionOnDefault, performActionOnDivide, performActionOnDivideAssignment, performActionOnDLEmbeddedExpression, performActionOnDo, performActionOnElse, performActionOnEmptyStatement, performActionOnEnhancedFor, performActionOnEquals, performActionOnExecutionContext, performActionOnFieldReference, performActionOnFinally, performActionOnFor, performActionOnForUpdates, performActionOnGreaterOrEquals, performActionOnGreaterThan, performActionOnGuard, performActionOnIf, performActionOnInstanceof, performActionOnIntersect, performActionOnLabeledStatement, performActionOnLessOrEquals, performActionOnLessThan, performActionOnLocalVariableDeclaration, performActionOnLogicalAnd, performActionOnLogicalNot, performActionOnLogicalOr, performActionOnLoopInit, performActionOnLoopScopeBlock, performActionOnMergePointStatement, performActionOnMetaClassReference, performActionOnMethodBodyStatement, performActionOnMethodFrame, performActionOnMethodReference, performActionOnMinus, performActionOnMinusAssignment, performActionOnModulo, performActionOnModuloAssignment, performActionOnNegative, performActionOnNew, performActionOnNewArray, performActionOnNotEquals, performActionOnPackageReference, performActionOnPackageSpecification, performActionOnParameterDeclaration, performActionOnParenthesizedExpression, performActionOnPassiveExpression, performActionOnPlus, performActionOnPlusAssignment, performActionOnPositive, performActionOnPostDecrement, performActionOnPostIncrement, performActionOnPreDecrement, performActionOnPreIncrement, performActionOnReturn, performActionOnSchematicFieldReference, performActionOnSeqConcat, performActionOnSeqLength, performActionOnSeqReverse, performActionOnSeqSingleton, performActionOnSeqSub, performActionOnSetMinus, performActionOnSetUnion, performActionOnShiftLeft, performActionOnShiftLeftAssignment, performActionOnShiftRight, performActionOnShiftRightAssignment, performActionOnSingleton, performActionOnStatementBlock, performActionOnSuperConstructorReference, performActionOnSuperReference, performActionOnSwitch, performActionOnSynchronizedBlock, performActionOnThen, performActionOnThisConstructorReference, performActionOnThisReference, performActionOnThrow, performActionOnTimes, performActionOnTimesAssignment, performActionOnTry, performActionOnTypeCast, performActionOnTypeReference, performActionOnUnsignedShiftRight, performActionOnUnsignedShiftRightAssignment, performActionOnVariableSpecification, performActionOnWhile, preservesPositionInfo, toString
performActionOnAbstractProgramElement, performActionOnAllObjects, performActionOnArrayDeclaration, performActionOnBlockContract, performActionOnBooleanLiteral, performActionOnCatchAllStatement, performActionOnCharLiteral, performActionOnClassDeclaration, performActionOnComment, performActionOnCompilationUnit, performActionOnConstructorDeclaration, performActionOnContextStatementBlock, performActionOnDoubleLiteral, performActionOnEmptyMapLiteral, performActionOnEmptySeqLiteral, performActionOnEmptySetLiteral, performActionOnExactInstanceof, performActionOnExtends, performActionOnFieldDeclaration, performActionOnFieldSpecification, performActionOnFloatLiteral, performActionOnImplements, performActionOnImplicitFieldSpecification, performActionOnImport, performActionOnInterfaceDeclaration, performActionOnIntLiteral, performActionOnIProgramVariable, performActionOnLongLiteral, performActionOnLoopContract, performActionOnLoopInvariant, performActionOnMethod, performActionOnMethodDeclaration, performActionOnModifier, performActionOnNullLiteral, performActionOnProgramElementName, performActionOnProgramMetaConstruct, performActionOnProgramMethod, performActionOnSchemaVariable, performActionOnSeqGet, performActionOnSeqIndexOf, performActionOnStringLiteral, performActionOnSuperArrayDeclaration, performActionOnThrows, performActionOnTransactionStatement, performActionOnVariableDeclaration, performActionOnVariableReference
depth, root
protected boolean replaceallbynew
protected java.util.Map<ProgramVariable,ProgramVariable> replaceMap
private ProgramElement result
public ProgVarReplaceVisitor(ProgramElement st, java.util.Map<ProgramVariable,ProgramVariable> map, Services services)
st
- the statement where the prog vars are replacedmap
- the HashMap with the replacementsservices
- the services instancepublic ProgVarReplaceVisitor(ProgramElement st, java.util.Map<ProgramVariable,ProgramVariable> map, boolean replaceall, Services services)
st
- the statement where the prog vars are replacedmap
- the HashMap with the replacementsreplaceall
- decides if all variables are to be replacedservices
- the services instancepublic static LocationVariable copy(ProgramVariable pv)
public static LocationVariable copy(ProgramVariable pv, java.lang.String postFix)
protected void walk(ProgramElement node)
JavaASTWalker
walk
in class CreatingASTVisitor
node
- the JavaProgramElement the walker is atprotected void doAction(ProgramElement node)
doAction
in class JavaASTVisitor
node
- the node described abovepublic void start()
start
in class JavaASTWalker
public ProgramElement result()
public void performActionOnProgramVariable(ProgramVariable pv)
performActionOnProgramVariable
in interface Visitor
performActionOnProgramVariable
in class JavaASTVisitor
private ImmutableList<Term> replaceVariablesInTerms(ImmutableList<Term> terms)
private ImmutableList<InfFlowSpec> replaceVariablesInTermListTriples(ImmutableList<InfFlowSpec> terms)
public void performActionOnLocationVariable(LocationVariable x)
performActionOnLocationVariable
in interface Visitor
performActionOnLocationVariable
in class JavaASTVisitor
public void performActionOnProgramConstant(ProgramConstant x)
performActionOnProgramConstant
in interface Visitor
performActionOnProgramConstant
in class JavaASTVisitor
public void performActionOnBlockContract(StatementBlock oldBlock, StatementBlock newBlock)
Visitor
performActionOnBlockContract
in interface Visitor
performActionOnBlockContract
in class JavaASTVisitor
oldBlock
- the old blocknewBlock
- the new blockpublic void performActionOnLoopContract(StatementBlock oldBlock, StatementBlock newBlock)
Visitor
performActionOnLoopContract
in interface Visitor
performActionOnLoopContract
in class JavaASTVisitor
oldBlock
- the old blocknewBlock
- the new blockpublic void performActionOnLoopContract(LoopStatement oldLoop, LoopStatement newLoop)
Visitor
performActionOnLoopContract
in interface Visitor
performActionOnLoopContract
in class JavaASTVisitor
oldLoop
- the old loop statementnewLoop
- the new loop statementpublic void performActionOnMergeContract(MergeContract oldContract)
performActionOnMergeContract
in interface Visitor
performActionOnMergeContract
in class JavaASTVisitor
protected void performActionOnMergeContract(MergePointStatement oldMps, MergePointStatement newMps)
performActionOnMergeContract
in class CreatingASTVisitor
private MergeContract createNewMergeContract(MergeContract oldContract, MergePointStatement newMps, boolean changed)
private BlockContract createNewBlockContract(BlockContract oldContract, StatementBlock newBlock, boolean blockChanged)
private LoopContract createNewLoopContract(LoopContract oldContract, JavaStatement newStatement, boolean blockChanged)
private AuxiliaryContract.Variables replaceBlockContractVariables(AuxiliaryContract.Variables variables)
private ProgramVariable replaceVariable(ProgramVariable variable)
private java.util.Map<Label,ProgramVariable> replaceFlags(java.util.Map<Label,ProgramVariable> flags)
private java.util.Map<LocationVariable,LocationVariable> replaceRemembranceHeaps(java.util.Map<LocationVariable,LocationVariable> remembranceHeaps)
private java.util.Map<LocationVariable,LocationVariable> replaceRemembranceLocalVariables(java.util.Map<LocationVariable,LocationVariable> remembranceLocalVariables)
public void performActionOnLoopInvariant(LoopStatement oldLoop, LoopStatement newLoop)
performActionOnLoopInvariant
in class CreatingASTVisitor