Class AssignmentPreMutation
java.lang.Object
org.benf.cfr.reader.bytecode.analysis.parse.statement.AbstractStatement
org.benf.cfr.reader.bytecode.analysis.parse.statement.AbstractAssignment
org.benf.cfr.reader.bytecode.analysis.parse.statement.AssignmentPreMutation
- All Implemented Interfaces:
HasByteCodeLoc, DeepCloneable<Statement>, Statement, ComparableUnderEC, Dumpable
In an assignment prechange, the LHS is by definition equal to the RHS after the statement.
I.e. x = ++x;
y = y|=3;
We can always drop the assignment, and just display this as the expression.
As the name implies, this is not appropriate for postchanges, i.e. x++;
In order to do those, we will have a copy of the value before increment. So we'll see
i = x;
x = ++x; // (with our daft AssignmentMutation).
if (i ... )
If we have a guaranteed single use of a pre-change, we can run it together with the PRIOR use, and convert
it to a post change. Similarly, if we have a SINGLE use of a prechange AFTER, we can just move the prechange RHS.
x = ++x;
if (x ) ......
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateAssignmentPreMutation(BytecodeLoc loc, LValue lvalue, AbstractAssignmentExpression rvalue) AssignmentPreMutation(BytecodeLoc loc, LValue lvalue, AbstractMutatingAssignmentExpression rvalue) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanThrow(ExceptionCheck caught) collectLocallyMutatedVariables(SSAIdentifierFactory<LValue, ?> ssaIdentifierFactory) voidcollectLValueAssignments(LValueAssignmentCollector<Statement> lValueAssigmentCollector) voidcollectLValueUsage(LValueUsageCollector lValueUsageCollector) voidcollectObjectCreation(CreationCollector creationCollector) deepClone(CloneHelper cloneHelper) booleanfinal booleanequivalentUnder(Object o, EquivalenceConstraint constraint) booleanisSelfMutatingOp1(LValue lValue, ArithOp arithOp) booleanvoidreplaceSingleUsageLValues(LValueRewriter lValueRewriter, SSAIdentifiers ssaIdentifiers) voidrewriteExpressions(ExpressionRewriter expressionRewriter, SSAIdentifiers ssaIdentifiers) Methods inherited from class AbstractStatement
addLoc, doesBlackListLValueReplacement, fallsToNext, getCompoundParts, getContainer, getLoc, getTargetStatement, isCompound, outerDeepClone, setContainer, setLifetimeHint, toString, wantsLifetimeHint
-
Field Details
-
lvalue
-
rvalue
-
-
Constructor Details
-
AssignmentPreMutation
public AssignmentPreMutation(BytecodeLoc loc, LValue lvalue, AbstractMutatingAssignmentExpression rvalue) -
AssignmentPreMutation
-
-
Method Details
-
deepClone
-
getCombinedLoc
-
dump
-
collectLValueAssignments
- Specified by:
collectLValueAssignmentsin interfaceStatement- Overrides:
collectLValueAssignmentsin classAbstractStatement
-
collectLValueUsage
-
collectObjectCreation
- Specified by:
collectObjectCreationin interfaceStatement- Overrides:
collectObjectCreationin classAbstractStatement
-
collectLocallyMutatedVariables
public SSAIdentifiers<LValue> collectLocallyMutatedVariables(SSAIdentifierFactory<LValue, ?> ssaIdentifierFactory) - Specified by:
collectLocallyMutatedVariablesin interfaceStatement- Overrides:
collectLocallyMutatedVariablesin classAbstractStatement
-
getCreatedLValue
- Specified by:
getCreatedLValuein interfaceStatement- Overrides:
getCreatedLValuein classAbstractStatement
-
getRValue
- Specified by:
getRValuein interfaceStatement- Overrides:
getRValuein classAbstractStatement
-
isSelfMutatingOperation
public boolean isSelfMutatingOperation()- Specified by:
isSelfMutatingOperationin classAbstractAssignment
-
isSelfMutatingOp1
- Specified by:
isSelfMutatingOp1in classAbstractAssignment
-
getPostMutation
- Specified by:
getPostMutationin classAbstractAssignment
-
getPreMutation
- Specified by:
getPreMutationin classAbstractAssignment
-
getInliningExpression
- Specified by:
getInliningExpressionin classAbstractAssignment
-
replaceSingleUsageLValues
-
rewriteExpressions
public void rewriteExpressions(ExpressionRewriter expressionRewriter, SSAIdentifiers ssaIdentifiers) -
getStructuredStatement
-
canThrow
- Specified by:
canThrowin interfaceStatement- Overrides:
canThrowin classAbstractStatement
-
equals
-
equivalentUnder
-