Minor. Weaken assertion in refined int type analysis

It's necessary because ASM remebers exact types obtained from
value parameters, and in the further commits we're going
to place code of suspend functions in their bodies, and there
we get already refined type for int-like slots
This commit is contained in:
Denis Zharkov
2017-04-25 12:15:26 +03:00
parent 0cd80d8b0e
commit bb7a188f87
@@ -149,7 +149,7 @@ internal fun performRefinedTypeAnalysis(methodNode: MethodNode, thisName: String
val current = Frame(basicFrames[insnIndex] ?: return@Array null)
refinedVarFrames[insnIndex].expectedTypeByVarIndex.withIndex().filter { it.value != null }.forEach {
assert(current.getLocal(it.index)?.type == Type.INT_TYPE) {
assert(current.getLocal(it.index)?.type?.sort in ALL_INT_SORTS) {
"int type expected, but ${current.getLocal(it.index)?.type} was found in basic frames"
}
@@ -181,6 +181,7 @@ private class MySourceInterpreter : SourceInterpreter() {
}
private val REFINED_INT_SORTS = setOf(Type.BOOLEAN, Type.CHAR, Type.BYTE, Type.SHORT)
private val ALL_INT_SORTS = REFINED_INT_SORTS + Type.INT
private fun MethodNode.findContainingVariableFromTable(insn: AbstractInsnNode, varIndex: Int): LocalVariableNode? {
val insnIndex = instructions.indexOf(insn)