Minor. Rewrite part in CoroutineTransformer with 'run'
It helps to avoid unnecessary val customCoroutineStartMarker in the scope of performTransformations
This commit is contained in:
+8
-5
@@ -54,12 +54,15 @@ class CoroutineTransformerMethodVisitor(
|
|||||||
private val exceptionIndex = dataIndex + 1
|
private val exceptionIndex = dataIndex + 1
|
||||||
|
|
||||||
override fun performTransformations(methodNode: MethodNode) {
|
override fun performTransformations(methodNode: MethodNode) {
|
||||||
val customCoroutineStartMarker = methodNode.instructions.toArray().filterIsInstance<MethodInsnNode>().firstOrNull {
|
val customCoroutineStart = run {
|
||||||
it.owner == COROUTINE_MARKER_OWNER && it.name == ACTUAL_COROUTINE_START_MARKER_NAME
|
val customCoroutineStartMarker = methodNode.instructions.toArray().filterIsInstance<MethodInsnNode>().firstOrNull {
|
||||||
}
|
it.owner == COROUTINE_MARKER_OWNER && it.name == ACTUAL_COROUTINE_START_MARKER_NAME
|
||||||
|
}
|
||||||
|
|
||||||
val customCoroutineStart = customCoroutineStartMarker?.next
|
customCoroutineStartMarker?.next?.also {
|
||||||
customCoroutineStartMarker?.let(methodNode.instructions::remove)
|
methodNode.instructions.remove(customCoroutineStartMarker)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val suspensionPoints = collectSuspensionPoints(methodNode)
|
val suspensionPoints = collectSuspensionPoints(methodNode)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user