Class LocalVariable
java.lang.Object
net.covers1624.coffeegrinder.bytecode.Instruction
net.covers1624.coffeegrinder.bytecode.insns.LocalVariable
- All Implemented Interfaces:
net.covers1624.quack.util.Copyable<Instruction>
- Direct Known Subclasses:
ParameterVariable
Represents a variable within a Method.
Created by covers1624 on 23/2/21.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class net.covers1624.coffeegrinder.bytecode.Instruction
opcode -
Constructor Summary
ConstructorsConstructorDescriptionLocalVariable(LocalVariable.VariableKind kind, AType type, @Nullable String genericSignature, int index, String name) LocalVariable(LocalVariable.VariableKind kind, AType type, String name) -
Method Summary
Modifier and TypeMethodDescription<R,C> R accept(InsnVisitor<R, C> visitor, C ctx) Pass thisInstructionthrough the suppliedInsnVisitor.voidaddReference(LocalReference insn) Any direct flags for thisInstruction.@Nullable StringintgetIndex()getKind()intThe number of instructions currently referencing this variable which read from it.getName()intGets the total number of references this variable has.Gets the stack type of the value produced by thisInstruction.intThe number of instructions currently referencing this variable which write to it.intgetSubId()getType()booleanisDead()If this variable can be considered dead.booleanvoidvoidsetAnnotationSupplier(AnnotationSupplier annotationSupplier) voidsetGenericSignature(@Nullable String genericSignature) voidvoidsetSubId(int subId) voidsetSynthetic(boolean synthetic) voidMethods inherited from class net.covers1624.coffeegrinder.bytecode.Instruction
accept, addRef, ancestorsOfType, computeFlags, copy, descendantsMatching, descendantsOfType, descendantsToList, descendantsToListWhere, descendantsWhere, firstAncestorOfType, getBytecodeOffset, getChildren, getDescendants, getFirstChild, getFirstChildOrNull, getFlags, getLastChild, getLastChildOrNull, getNextSibling, getNextSiblingOrNull, getParent, getParentOrNull, getPrevSibling, getPrevSiblingOrNull, getSourceLine, getTag, hasDirectFlag, hasFlag, insertAfter, insertBefore, invalidateFlags, isConnected, isDescendantOf, onChildModified, onConnected, onDisconnected, releaseRef, remove, replaceWith, setBytecodeOffset, setOffsets, setSourceLine, setTag, toString, toString, withOffsets
-
Constructor Details
-
LocalVariable
-
LocalVariable
public LocalVariable(LocalVariable.VariableKind kind, AType type, @Nullable @Nullable String genericSignature, int index, String name)
-
-
Method Details
-
addReference
-
removeReference
-
getDirectFlags
Description copied from class:InstructionAny direct flags for thisInstruction.The return value should be cached statically inside the
Instructionimpl.- Specified by:
getDirectFlagsin classInstruction- Returns:
- An
EnumBitSetrepresenting the flags. - See Also:
-
accept
Description copied from class:InstructionPass thisInstructionthrough the suppliedInsnVisitor.- Specified by:
acceptin classInstruction- Parameters:
visitor- TheInsnVisitor.ctx- The context.- Returns:
- The return result from the
InsnVisitor.
-
getResultType
Description copied from class:InstructionGets the stack type of the value produced by thisInstruction.- Specified by:
getResultTypein classInstruction- Returns:
- The
AType.
-
getKind
-
getGenericSignature
-
getType
-
getIndex
public int getIndex() -
getName
-
getSubId
public int getSubId() -
getReferences
-
isSynthetic
public boolean isSynthetic() -
getAnnotationSupplier
-
setGenericSignature
-
setType
-
setName
-
setSubId
public void setSubId(int subId) -
setSynthetic
public void setSynthetic(boolean synthetic) -
setAnnotationSupplier
-
getLoadCount
public int getLoadCount()The number of instructions currently referencing this variable which read from it.- Returns:
- The number of read references.
-
getStoreCount
public int getStoreCount()The number of instructions currently referencing this variable which write to it.- Returns:
- The number of write references.
-
getReferenceCount
public int getReferenceCount()Gets the total number of references this variable has.- Returns:
- The number of references.
-
isDead
public boolean isDead()If this variable can be considered dead.A variable is considered dead if: 1, It is not a parameter. 2, The variable has no stores.
- Returns:
- If the variable is dead.
-
getUniqueName
-