Minor: more cleanup after converting to Kotlin

This commit is contained in:
Dmitry Petrov
2017-05-22 10:50:28 +03:00
parent 39aa97eebf
commit 45820f0220
@@ -60,13 +60,14 @@ class RedundantBoxingMethodTransformer : MethodTransformer() {
node: MethodNode, node: MethodNode,
frames: Array<out Frame<BasicValue>?> frames: Array<out Frame<BasicValue>?>
) { ) {
for (i in 0..node.instructions.size() - 1) { for (i in frames.indices) {
val insn = node.instructions.get(i) val insn = node.instructions[i]
val frame = frames[i] if (insn.opcode != Opcodes.POP && insn.opcode != Opcodes.POP2) {
if (insn.opcode != Opcodes.POP && insn.opcode != Opcodes.POP2 || frame == null) {
continue continue
} }
val frame = frames[i] ?: continue
val top = frame.top()!! val top = frame.top()!!
interpreter.processPopInstruction(insn, top) interpreter.processPopInstruction(insn, top)
@@ -104,7 +105,7 @@ class RedundantBoxingMethodTransformer : MethodTransformer() {
if (boxed.isEmpty()) continue if (boxed.isEmpty()) continue
val firstBoxed = boxed.iterator().next().descriptor val firstBoxed = boxed.first().descriptor
if (isUnsafeToRemoveBoxingForConnectedValues(variableValues, firstBoxed.unboxedType)) { if (isUnsafeToRemoveBoxingForConnectedValues(variableValues, firstBoxed.unboxedType)) {
for (value in boxed) { for (value in boxed) {
val descriptor = value.descriptor val descriptor = value.descriptor
@@ -193,7 +194,7 @@ class RedundantBoxingMethodTransformer : MethodTransformer() {
} }
for (varIndex in doubleSizedVars) { for (varIndex in doubleSizedVars) {
for (i in varIndex + 1..remapping.size - 1) { for (i in varIndex + 1..remapping.lastIndex) {
remapping[i]++ remapping[i]++
} }
} }