More cleanup: lift return / assignment out

This commit is contained in:
Mikhail Glukhikh
2017-07-07 13:57:36 +03:00
parent 9269de721e
commit dfe2c16bc7
116 changed files with 472 additions and 517 deletions
@@ -619,11 +619,11 @@ class MethodInliner(
}
private fun wrapException(originalException: Throwable, node: MethodNode, errorSuffix: String): RuntimeException {
if (originalException is InlineException) {
return InlineException("$errorPrefix: $errorSuffix", originalException)
return if (originalException is InlineException) {
InlineException("$errorPrefix: $errorSuffix", originalException)
}
else {
return InlineException("$errorPrefix: $errorSuffix\nCause: ${node.nodeText}", originalException)
InlineException("$errorPrefix: $errorSuffix\nCause: ${node.nodeText}", originalException)
}
}
@@ -679,11 +679,11 @@ class MethodInliner(
localReturns.add(LocalReturn(returnInsn, insertBeforeInsn, sourceValueFrame))
if (returnInsn.opcode != Opcodes.RETURN) {
if (returnInsn.opcode == Opcodes.LRETURN || returnInsn.opcode == Opcodes.DRETURN) {
returnVariableSize = 2
returnVariableSize = if (returnInsn.opcode == Opcodes.LRETURN || returnInsn.opcode == Opcodes.DRETURN) {
2
}
else {
returnVariableSize = 1
1
}
}
}
@@ -98,8 +98,8 @@ open class NestedSourceMapper(
override fun mapLineNumber(lineNumber: Int): Int {
val mappedLineNumber = visitedLines.get(lineNumber)
if (mappedLineNumber > 0) {
return mappedLineNumber
return if (mappedLineNumber > 0) {
mappedLineNumber
}
else {
val rangeForMapping =
@@ -111,7 +111,7 @@ open class NestedSourceMapper(
visitedLines.put(lineNumber, newLineNumber)
}
lastVisitedRange = rangeForMapping
return newLineNumber
newLineNumber
}
}
@@ -142,20 +142,20 @@ internal class FixStackAnalyzer(
}
override fun pop(): BasicValue {
if (extraStack.isNotEmpty()) {
return extraStack.pop()
return if (extraStack.isNotEmpty()) {
extraStack.pop()
}
else {
return super.pop()
super.pop()
}
}
override fun getStack(i: Int): BasicValue {
if (i < super.getMaxStackSize()) {
return super.getStack(i)
return if (i < super.getMaxStackSize()) {
super.getStack(i)
}
else {
return extraStack[i - maxStackSize]
extraStack[i - maxStackSize]
}
}
}