Minor.Reformat

This commit is contained in:
Mikhael Bogdanov
2018-02-27 15:52:36 +01:00
parent 1d3e57acee
commit 1acd5642ce
@@ -19,27 +19,27 @@ import org.jetbrains.org.objectweb.asm.commons.Method
import org.jetbrains.org.objectweb.asm.util.Printer import org.jetbrains.org.objectweb.asm.util.Printer
class CallableMethod( class CallableMethod(
override val owner: Type, override val owner: Type,
private val defaultImplOwner: Type?, private val defaultImplOwner: Type?,
private val defaultMethodDesc: String, private val defaultMethodDesc: String,
private val signature: JvmMethodSignature, private val signature: JvmMethodSignature,
private val invokeOpcode: Int, private val invokeOpcode: Int,
override val dispatchReceiverType: Type?, override val dispatchReceiverType: Type?,
override val dispatchReceiverKotlinType: KotlinType?, override val dispatchReceiverKotlinType: KotlinType?,
override val extensionReceiverType: Type?, override val extensionReceiverType: Type?,
override val extensionReceiverKotlinType: KotlinType?, override val extensionReceiverKotlinType: KotlinType?,
override val generateCalleeType: Type?, override val generateCalleeType: Type?,
override val returnKotlinType: KotlinType?, override val returnKotlinType: KotlinType?,
private val isInterfaceMethod: Boolean = Opcodes.INVOKEINTERFACE == invokeOpcode private val isInterfaceMethod: Boolean = Opcodes.INVOKEINTERFACE == invokeOpcode
) : Callable { ) : Callable {
fun getValueParameters(): List<JvmMethodParameterSignature> = fun getValueParameters(): List<JvmMethodParameterSignature> =
signature.valueParameters signature.valueParameters
override val valueParameterTypes: List<Type> override val valueParameterTypes: List<Type>
get() = signature.valueParameters.filter { it.kind == JvmMethodParameterKind.VALUE }.map { it.asmType } get() = signature.valueParameters.filter { it.kind == JvmMethodParameterKind.VALUE }.map { it.asmType }
fun getAsmMethod(): Method = fun getAsmMethod(): Method =
signature.asmMethod signature.asmMethod
override val parameterTypes: Array<Type> override val parameterTypes: Array<Type>
get() = getAsmMethod().argumentTypes get() = getAsmMethod().argumentTypes
@@ -47,11 +47,11 @@ class CallableMethod(
override fun genInvokeInstruction(v: InstructionAdapter) { override fun genInvokeInstruction(v: InstructionAdapter) {
v.visitMethodInsn( v.visitMethodInsn(
invokeOpcode, invokeOpcode,
owner.internalName, owner.internalName,
getAsmMethod().name, getAsmMethod().name,
getAsmMethod().descriptor, getAsmMethod().descriptor,
isInterfaceMethod isInterfaceMethod
) )
} }
@@ -64,10 +64,11 @@ class CallableMethod(
if ("<init>" == method.name) { if ("<init>" == method.name) {
v.visitMethodInsn(INVOKESPECIAL, defaultImplOwner.internalName, "<init>", defaultMethodDesc, false) v.visitMethodInsn(INVOKESPECIAL, defaultImplOwner.internalName, "<init>", defaultMethodDesc, false)
} } else {
else { v.visitMethodInsn(
v.visitMethodInsn(INVOKESTATIC, defaultImplOwner.internalName, INVOKESTATIC, defaultImplOwner.internalName,
method.name + JvmAbi.DEFAULT_PARAMS_IMPL_SUFFIX, defaultMethodDesc, false) method.name + JvmAbi.DEFAULT_PARAMS_IMPL_SUFFIX, defaultMethodDesc, false
)
StackValue.coerce(Type.getReturnType(defaultMethodDesc), Type.getReturnType(signature.asmMethod.descriptor), v) StackValue.coerce(Type.getReturnType(defaultMethodDesc), Type.getReturnType(signature.asmMethod.descriptor), v)
} }
@@ -77,8 +78,8 @@ class CallableMethod(
get() = signature.returnType get() = signature.returnType
override fun isStaticCall(): Boolean = override fun isStaticCall(): Boolean =
invokeOpcode == INVOKESTATIC invokeOpcode == INVOKESTATIC
override fun toString(): String = override fun toString(): String =
"${Printer.OPCODES[invokeOpcode]} $owner.$signature" "${Printer.OPCODES[invokeOpcode]} $owner.$signature"
} }