Minor. Reformat CoroutineCodegen.kt

This commit is contained in:
Denis Zharkov
2018-06-22 14:53:03 +03:00
parent 1ced127660
commit 2c195555ad
@@ -20,7 +20,10 @@ import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.KtCallableReferenceExpression
import org.jetbrains.kotlin.psi.KtDeclarationWithBody
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtFunction
import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.resolve.descriptorUtil.module import org.jetbrains.kotlin.resolve.descriptorUtil.module
@@ -207,8 +210,8 @@ class CoroutineCodegenForLambda private constructor(
// this // this
load(0, AsmTypes.OBJECT_TYPE) load(0, AsmTypes.OBJECT_TYPE)
val parameterTypes = signature.valueParameters.map { it.asmType } val parameterTypes = signature.valueParameters.map { it.asmType }
parameterTypes.withVariableIndices().forEach { parameterTypes.withVariableIndices().forEach { (index, type) ->
(index, type) -> load(index + 1, type) load(index + 1, type)
} }
// this.create(..) // this.create(..)
@@ -345,7 +348,10 @@ class CoroutineCodegenForLambda private constructor(
expressionCodegen, expressionCodegen,
declaration, declaration,
expressionCodegen.context.intoCoroutineClosure( expressionCodegen.context.intoCoroutineClosure(
getOrCreateJvmSuspendFunctionView(originalSuspendLambdaDescriptor, expressionCodegen.state), getOrCreateJvmSuspendFunctionView(
originalSuspendLambdaDescriptor,
expressionCodegen.state
),
originalSuspendLambdaDescriptor, expressionCodegen, expressionCodegen.state.typeMapper originalSuspendLambdaDescriptor, expressionCodegen, expressionCodegen.state.typeMapper
), ),
classBuilder, classBuilder,
@@ -448,8 +454,7 @@ class CoroutineCodegenForNamedFunction private constructor(
val owner = captureThisType.internalName val owner = captureThisType.internalName
val impl = callableMethod.getAsmMethod().getImplForOpenMethod(owner) val impl = callableMethod.getAsmMethod().getImplForOpenMethod(owner)
codegen.v.invokestatic(owner, impl.name, impl.descriptor, false) codegen.v.invokestatic(owner, impl.name, impl.descriptor, false)
} } else {
else {
callableMethod.genInvokeInstruction(codegen.v) callableMethod.genInvokeInstruction(codegen.v)
} }
@@ -498,6 +503,7 @@ class CoroutineCodegenForNamedFunction private constructor(
AsmUtil.writeAnnotationData(av, serializer, functionProto) AsmUtil.writeAnnotationData(av, serializer, functionProto)
} }
} }
companion object { companion object {
fun create( fun create(
cv: ClassBuilder, cv: ClassBuilder,