Support boxing/unboxing for method return types

This commit is contained in:
Mikhail Zarechenskiy
2018-02-05 11:43:10 +03:00
parent 390c214943
commit c5c8d84719
15 changed files with 210 additions and 100 deletions
@@ -1,17 +1,6 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.android.synthetic.codegen
@@ -20,8 +9,8 @@ import kotlinx.android.extensions.CacheImplementation
import kotlinx.android.extensions.CacheImplementation.NO_CACHE
import org.jetbrains.kotlin.android.synthetic.AndroidConst
import org.jetbrains.kotlin.android.synthetic.codegen.AndroidContainerType.LAYOUT_CONTAINER
import org.jetbrains.kotlin.android.synthetic.descriptors.ContainerOptionsProxy
import org.jetbrains.kotlin.android.synthetic.descriptors.AndroidSyntheticPackageFragmentDescriptor
import org.jetbrains.kotlin.android.synthetic.descriptors.ContainerOptionsProxy
import org.jetbrains.kotlin.android.synthetic.res.AndroidSyntheticFunction
import org.jetbrains.kotlin.android.synthetic.res.AndroidSyntheticProperty
import org.jetbrains.kotlin.codegen.*
@@ -37,9 +26,7 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf
import org.jetbrains.org.objectweb.asm.Label
import org.jetbrains.org.objectweb.asm.Opcodes.ACC_PRIVATE
import org.jetbrains.org.objectweb.asm.Opcodes.ACC_PUBLIC
import org.jetbrains.org.objectweb.asm.Opcodes.ACC_SYNTHETIC
import org.jetbrains.org.objectweb.asm.Opcodes.*
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
@@ -96,13 +83,13 @@ abstract class AbstractAndroidExtensionsExpressionCodegenExtension : ExpressionC
val containerOptions = ContainerOptionsProxy.create(container)
if (!containerOptions.getCacheOrDefault(resolvedCall.call.calleeExpression).hasCache) {
return StackValue.functionCall(Type.VOID_TYPE) {}
return StackValue.functionCall(Type.VOID_TYPE, null) {}
}
if (containerOptions.containerType == AndroidContainerType.UNKNOWN) return null
val actualReceiver = StackValue.receiver(resolvedCall, receiver, c.codegen, null)
return StackValue.functionCall(Type.VOID_TYPE) {
return StackValue.functionCall(Type.VOID_TYPE, null) {
val bytecodeClassName = c.typeMapper.mapType(container).internalName
actualReceiver.put(c.typeMapper.mapType(container), it)