Package com.android.dx.rop.code
Class SwitchInsn
java.lang.Object
com.android.dx.rop.code.Insn
com.android.dx.rop.code.SwitchInsn
- All Implemented Interfaces:
ToHuman
Instruction which contains switch cases.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.android.dx.rop.code.Insn
Insn.BaseVisitor, Insn.Visitor
-
Constructor Summary
ConstructorDescriptionSwitchInsn
(Rop opcode, SourcePosition position, RegisterSpec result, RegisterSpecList sources, IntList cases) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(Insn.Visitor visitor) Calls the appropriate method on the given visitor, depending on the class of this instance.boolean
Compares Insn contents, sinceInsn.equals()
is defined to be an identity compare.getCases()
Gets the list of switch cases.Gets the list of possibly-caught exceptions.Gets an "inline" string portion for toHuman(), if available.withAddedCatch
(Type type) Returns an instance that is just like this one, except that it has a catch list with the given item appended to the end.withNewRegisters
(RegisterSpec result, RegisterSpecList sources) Returns an instance that is just like this one, except with new result and source registers.withRegisterOffset
(int delta) Returns an instance that is just like this one, except that all register references have been offset by the given delta.Methods inherited from class com.android.dx.rop.code.Insn
canThrow, copy, equals, getLocalAssignment, getOpcode, getPosition, getResult, getSources, hashCode, toHuman, toHumanWithInline, toString, toStringWithInline, withSourceLiteral
-
Constructor Details
-
SwitchInsn
public SwitchInsn(Rop opcode, SourcePosition position, RegisterSpec result, RegisterSpecList sources, IntList cases) Constructs an instance.- Parameters:
opcode
-non-null;
the opcodeposition
-non-null;
source positionresult
-null-ok;
spec for the result, if anysources
-non-null;
specs for all the sourcescases
-non-null;
list of switch cases
-
-
Method Details
-
getInlineString
Gets an "inline" string portion for toHuman(), if available. This is the portion that appears after the Rop opcode- Overrides:
getInlineString
in classInsn
- Returns:
null-ok;
if non-null, the inline text for toHuman()
-
getCatches
Gets the list of possibly-caught exceptions. This returnsStdTypeList.EMPTY
if this instruction has no handlers, which can be either if this instruction can't possibly throw or if it merely doesn't handle any of its possible exceptions. To determine whether this instruction can throw, useInsn.canThrow()
.- Specified by:
getCatches
in classInsn
- Returns:
non-null;
the catches list
-
accept
Calls the appropriate method on the given visitor, depending on the class of this instance. Subclasses must override this. -
withAddedCatch
Returns an instance that is just like this one, except that it has a catch list with the given item appended to the end. This method throws an exception if this instance can't possibly throw. To determine whether this instruction can throw, useInsn.canThrow()
.- Specified by:
withAddedCatch
in classInsn
- Parameters:
type
-non-null;
type to append to the catch list- Returns:
non-null;
an appropriately-constructed instance
-
withRegisterOffset
Returns an instance that is just like this one, except that all register references have been offset by the given delta.- Specified by:
withRegisterOffset
in classInsn
- Parameters:
delta
- the amount to offset register references by- Returns:
non-null;
an appropriately-constructed instance
-
contentEquals
Compares Insn contents, sinceInsn.equals()
is defined to be an identity compare. Insn's arecontentEquals()
if they have the same opcode, registers, source position, and other metadata.SwitchInsn always compares false. The current use for this method never encounters
SwitchInsn
s- Overrides:
contentEquals
in classInsn
- Returns:
- true in the case described above
-
withNewRegisters
Returns an instance that is just like this one, except with new result and source registers.- Specified by:
withNewRegisters
in classInsn
- Parameters:
result
-null-ok;
new result registersources
-non-null;
new sources registers- Returns:
non-null;
an appropriately-constructed instance
-
getCases
Gets the list of switch cases.- Returns:
non-null;
the case list
-