use of org.jf.smalidea.psi.impl.SmaliCatchStatement in project smali by JesusFreke.
the class SmalideaMethod method getImplementation.
@Nullable
@Override
public MethodImplementation getImplementation() {
if (psiMethod instanceof SmaliMethod) {
final SmaliMethod smaliMethod = (SmaliMethod) this.psiMethod;
List<SmaliInstruction> instructions = smaliMethod.getInstructions();
if (instructions.size() == 0) {
return null;
}
// TODO: cache this?
return new MethodImplementation() {
@Override
public int getRegisterCount() {
return smaliMethod.getRegisterCount();
}
@Nonnull
@Override
public Iterable<? extends Instruction> getInstructions() {
return Lists.transform(smaliMethod.getInstructions(), new Function<SmaliInstruction, Instruction>() {
@Override
public Instruction apply(SmaliInstruction smaliInstruction) {
return SmalideaInstruction.of(smaliInstruction);
}
});
}
@Nonnull
@Override
public List<? extends TryBlock<? extends ExceptionHandler>> getTryBlocks() {
return Lists.transform(smaliMethod.getCatchStatements(), new Function<SmaliCatchStatement, TryBlock<? extends ExceptionHandler>>() {
@Override
public TryBlock<? extends ExceptionHandler> apply(SmaliCatchStatement smaliCatchStatement) {
assert smaliCatchStatement != null;
return new SmalideaTryBlock(smaliCatchStatement);
}
});
}
@Nonnull
@Override
public Iterable<? extends DebugItem> getDebugItems() {
// TODO: implement this
return ImmutableList.of();
}
};
}
return null;
}
Aggregations