public class VariableDeclarations extends SimpleInsnVisitor<None> implements MethodTransformer
Split variables with an aliased declaration in-scope are merged. Created by covers1624 on 15/9/21.
NONE| Constructor and Description |
|---|
VariableDeclarations() |
| Modifier and Type | Method and Description |
|---|---|
static Instruction |
selectDeclarableParent(Instruction insn)
find the first declaration point, the first ancestor which is a child of a block (which may be this instruction, or a parent)
|
void |
transform(MethodDecl function,
MethodTransformContext ctx)
Transform the
MethodDecl. |
static Instruction |
unifyUsages(Instruction decl,
Instruction usage)
Finds a suitable declaration location such that usage is in scope with the previous declaration.
|
None |
visitLocalReference(LocalReference localRef,
None ctx) |
visitDefaultvisitArrayElementReference, visitArrayLen, visitAssert, visitBinary, visitBlock, visitBlockContainer, visitBranch, visitCheckCast, visitClassDecl, visitCompare, visitComparison, visitCompoundAssignment, visitContinue, visitDeadCode, visitDoWhileLoop, visitFieldDecl, visitFieldReference, visitForEachLoop, visitForLoop, visitIfInstruction, visitInstanceOf, visitInvoke, visitInvokeDynamic, visitLdcBoolean, visitLdcChar, visitLdcClass, visitLdcNull, visitLdcNumber, visitLdcString, visitLeave, visitLoad, visitLoadThis, visitLocalVariable, visitLogicAnd, visitLogicNot, visitLogicOr, visitMethodDecl, visitMethodReference, visitMonitor, visitNew, visitNewArray, visitNewObject, visitNop, visitPostIncrement, visitReturn, visitStore, visitSwitch, visitSwitchSection, visitSwitchTable, visitSynchronized, visitTernary, visitThrow, visitTryCatch, visitTryCatchHandler, visitTryFinally, visitTryWithResources, visitWhileLoop, visitYieldclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetName, stepTypepublic void transform(MethodDecl function, MethodTransformContext ctx)
MethodTransformerMethodDecl.transform in interface MethodTransformerfunction - The function to transform.ctx - The MethodTransformContext.public static Instruction unifyUsages(Instruction decl, Instruction usage)
decl - The previous declaration for a variableusage - An instruction which requires the declaration to be in scopedecl, if decl is in scope, otherwise a common ancestor of both decl and usage,
which is a child of a block (so a declaration could be inserted before it)public static Instruction selectDeclarableParent(Instruction insn)
public None visitLocalReference(LocalReference localRef, None ctx)
visitLocalReference in class InsnVisitor<None,None>