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
ConstructorsModifierConstructorDescriptionprivate
AssignmentPreMutation
(BytecodeLoc loc, LValue lvalue, AbstractAssignmentExpression rvalue) AssignmentPreMutation
(BytecodeLoc loc, LValue lvalue, AbstractMutatingAssignmentExpression rvalue) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canThrow
(ExceptionCheck caught) collectLocallyMutatedVariables
(SSAIdentifierFactory<LValue, ?> ssaIdentifierFactory) void
collectLValueAssignments
(LValueAssignmentCollector<Statement> lValueAssigmentCollector) void
collectLValueUsage
(LValueUsageCollector lValueUsageCollector) void
collectObjectCreation
(CreationCollector creationCollector) deepClone
(CloneHelper cloneHelper) boolean
final boolean
equivalentUnder
(Object o, EquivalenceConstraint constraint) boolean
isSelfMutatingOp1
(LValue lValue, ArithOp arithOp) boolean
void
replaceSingleUsageLValues
(LValueRewriter lValueRewriter, SSAIdentifiers ssaIdentifiers) void
rewriteExpressions
(ExpressionRewriter expressionRewriter, SSAIdentifiers ssaIdentifiers) Methods inherited from class org.benf.cfr.reader.bytecode.analysis.parse.statement.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:
collectLValueAssignments
in interfaceStatement
- Overrides:
collectLValueAssignments
in classAbstractStatement
-
collectLValueUsage
-
collectObjectCreation
- Specified by:
collectObjectCreation
in interfaceStatement
- Overrides:
collectObjectCreation
in classAbstractStatement
-
collectLocallyMutatedVariables
public SSAIdentifiers<LValue> collectLocallyMutatedVariables(SSAIdentifierFactory<LValue, ?> ssaIdentifierFactory) - Specified by:
collectLocallyMutatedVariables
in interfaceStatement
- Overrides:
collectLocallyMutatedVariables
in classAbstractStatement
-
getCreatedLValue
- Specified by:
getCreatedLValue
in interfaceStatement
- Overrides:
getCreatedLValue
in classAbstractStatement
-
getRValue
- Specified by:
getRValue
in interfaceStatement
- Overrides:
getRValue
in classAbstractStatement
-
isSelfMutatingOperation
public boolean isSelfMutatingOperation()- Specified by:
isSelfMutatingOperation
in classAbstractAssignment
-
isSelfMutatingOp1
- Specified by:
isSelfMutatingOp1
in classAbstractAssignment
-
getPostMutation
- Specified by:
getPostMutation
in classAbstractAssignment
-
getPreMutation
- Specified by:
getPreMutation
in classAbstractAssignment
-
getInliningExpression
- Specified by:
getInliningExpression
in classAbstractAssignment
-
replaceSingleUsageLValues
-
rewriteExpressions
public void rewriteExpressions(ExpressionRewriter expressionRewriter, SSAIdentifiers ssaIdentifiers) -
getStructuredStatement
-
canThrow
- Specified by:
canThrow
in interfaceStatement
- Overrides:
canThrow
in classAbstractStatement
-
equals
-
equivalentUnder
-