Cleanup: apply "cascade if..." inspection (+ some others)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
9c06739594
commit
1d2017b0fc
@@ -181,13 +181,10 @@ class SingleInstructionInterpreter(private val eval: Eval) : Interpreter<Value>(
|
||||
|
||||
CHECKCAST -> {
|
||||
val targetType = Type.getObjectType((insn as TypeInsnNode).desc)
|
||||
if (value == NULL_VALUE) {
|
||||
NULL_VALUE
|
||||
} else if (eval.isInstanceOf(value, targetType)) {
|
||||
ObjectValue(value.obj(), targetType)
|
||||
}
|
||||
else {
|
||||
throwEvalException(ClassCastException("${value.asmType.className} cannot be cast to ${targetType.className}"))
|
||||
when {
|
||||
value == NULL_VALUE -> NULL_VALUE
|
||||
eval.isInstanceOf(value, targetType) -> ObjectValue(value.obj(), targetType)
|
||||
else -> throwEvalException(ClassCastException("${value.asmType.className} cannot be cast to ${targetType.className}"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user