Supported IrFunction.isOperator
(cherry picked from commit 86dbb83c7f726214cb27dd03425ce7a2e06d2bad)
This commit is contained in:
committed by
Vasily Levchenko
parent
f36a066f4d
commit
7385bf9473
+4
-2
@@ -73,7 +73,8 @@ internal val Context.getBoxFunction: (IrClass) -> IrSimpleFunction by Context.la
|
||||
isTailrec = false,
|
||||
isSuspend = false,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).also { function ->
|
||||
function.valueParameters.add(WrappedValueParameterDescriptor().let {
|
||||
IrValueParameterImpl(
|
||||
@@ -126,7 +127,8 @@ internal val Context.getUnboxFunction: (IrClass) -> IrSimpleFunction by Context.
|
||||
isTailrec = false,
|
||||
isSuspend = false,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).also { function ->
|
||||
function.valueParameters.add(WrappedValueParameterDescriptor().let {
|
||||
IrValueParameterImpl(
|
||||
|
||||
+2
-1
@@ -141,7 +141,8 @@ internal class SpecialDeclarationsFactory(val context: Context) : KotlinMangler
|
||||
isSuspend = function.isSuspend,
|
||||
returnType = returnType,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).apply {
|
||||
descriptor.bind(this)
|
||||
parent = function.parent
|
||||
|
||||
+2
-1
@@ -41,7 +41,8 @@ internal fun makeEntryPoint(context: Context): IrFunction {
|
||||
isTailrec = false,
|
||||
isSuspend = false,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).also { function ->
|
||||
function.valueParameters.add(WrappedValueParameterDescriptor().let {
|
||||
IrValueParameterImpl(
|
||||
|
||||
+2
-1
@@ -98,7 +98,8 @@ internal class EnumSpecialDeclarationsFactory(val context: Context) {
|
||||
isTailrec = false,
|
||||
isSuspend = false,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).apply {
|
||||
it.bind(this)
|
||||
parent = implObject
|
||||
|
||||
+3
-2
@@ -569,7 +569,8 @@ private fun KotlinStubs.createFakeKotlinExternalFunction(
|
||||
isTailrec = false,
|
||||
isSuspend = false,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
)
|
||||
bridgeDescriptor.bind(bridge)
|
||||
|
||||
@@ -1269,7 +1270,7 @@ private class ObjCBlockPointerValuePassing(
|
||||
Visibilities.PUBLIC, Modality.FINAL,
|
||||
returnType = functionType.arguments.last().typeOrNull!!,
|
||||
isInline = false, isExternal = false, isTailrec = false, isSuspend = false, isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false, isOperator = false
|
||||
)
|
||||
invokeMethodDescriptor.bind(invokeMethod)
|
||||
invokeMethod.overriddenSymbols += overriddenInvokeMethod.symbol
|
||||
|
||||
+2
-1
@@ -117,7 +117,8 @@ private fun createKotlinBridge(
|
||||
isTailrec = false,
|
||||
isSuspend = false,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
)
|
||||
bridgeDescriptor.bind(bridge)
|
||||
if (isExternal) {
|
||||
|
||||
+2
-1
@@ -504,7 +504,8 @@ private val Context.getLoweredInlineClassConstructor: (IrConstructor) -> IrSimpl
|
||||
isSuspend = false,
|
||||
returnType = irConstructor.returnType,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).apply {
|
||||
descriptor.bind(this)
|
||||
parent = irConstructor.parent
|
||||
|
||||
+2
-1
@@ -81,7 +81,8 @@ internal class WorkersBridgesBuilding(val context: Context) : DeclarationContain
|
||||
isSuspend = false,
|
||||
returnType = context.irBuiltIns.anyNType,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).apply {
|
||||
it.bind(this)
|
||||
}
|
||||
|
||||
+2
-1
@@ -312,7 +312,8 @@ internal class CallableReferenceLowering(val context: Context): FileLoweringPass
|
||||
isTailrec = false,
|
||||
isSuspend = superFunction.isSuspend,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).apply {
|
||||
it.bind(this)
|
||||
val function = this
|
||||
|
||||
+1
@@ -188,6 +188,7 @@ internal class FinallyBlocksLowering(val context: Context): FileLoweringPass, Ir
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false)
|
||||
)
|
||||
return descriptor
|
||||
|
||||
+2
-1
@@ -109,7 +109,8 @@ internal class InitializersLowering(val context: CommonBackendContext) : ClassLo
|
||||
isExternal = false,
|
||||
isTailrec = false,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).apply {
|
||||
it.bind(this)
|
||||
parent = irClass
|
||||
|
||||
+4
-2
@@ -234,7 +234,8 @@ internal class InteropLoweringPart1(val context: Context) : BaseInteropIrTransfo
|
||||
isTailrec = false,
|
||||
isSuspend = false,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).also { result ->
|
||||
resultDescriptor.bind(result)
|
||||
result.parent = irClass
|
||||
@@ -377,7 +378,8 @@ internal class InteropLoweringPart1(val context: Context) : BaseInteropIrTransfo
|
||||
isTailrec = false,
|
||||
isSuspend = false,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).apply {
|
||||
it.bind(this)
|
||||
}
|
||||
|
||||
+4
-2
@@ -489,7 +489,8 @@ internal class NativeSuspendFunctionsLowering(ctx: Context): AbstractSuspendFunc
|
||||
isTailrec = false,
|
||||
isSuspend = false,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).apply {
|
||||
it.bind(this)
|
||||
}
|
||||
@@ -509,7 +510,8 @@ internal class NativeSuspendFunctionsLowering(ctx: Context): AbstractSuspendFunc
|
||||
isTailrec = false,
|
||||
isSuspend = false,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).apply {
|
||||
it.bind(this)
|
||||
}
|
||||
|
||||
+4
-2
@@ -349,7 +349,8 @@ internal class TestProcessor (val context: Context) {
|
||||
isTailrec = false,
|
||||
isSuspend = false,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).apply {
|
||||
descriptor.bind(this)
|
||||
parent = owner
|
||||
@@ -387,7 +388,8 @@ internal class TestProcessor (val context: Context) {
|
||||
isTailrec = false,
|
||||
isSuspend = false,
|
||||
isExpect = false,
|
||||
isFakeOverride = false
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).apply {
|
||||
descriptor.bind(this)
|
||||
parent = owner
|
||||
|
||||
-64
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-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 file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.backend.konan.serialization
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.impl.*
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.name.*
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.*
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||
|
||||
private val konanInternalPackageName = FqName("kotlin.native.internal")
|
||||
private val fakeCapturedTypeClassName = Name.identifier("FAKE_CAPTURED_TYPE_CLASS")
|
||||
|
||||
internal fun createFakeClass(packageName: FqName, className: Name)
|
||||
= MutableClassDescriptor(
|
||||
EmptyPackageFragmentDescriptor(
|
||||
ErrorUtils.getErrorModule(),
|
||||
packageName
|
||||
),
|
||||
ClassKind.INTERFACE,
|
||||
/* isInner = */ false,
|
||||
/* isExternal = */ false,
|
||||
className,
|
||||
SourceElement.NO_SOURCE,
|
||||
LockBasedStorageManager.NO_LOCKS
|
||||
)
|
||||
|
||||
// We do the trick similar to FAKE_CONTINUATION_CLASS_DESCRIPTOR.
|
||||
// To pack a captured type constructor as a type parameter
|
||||
// of a fake class. We need it because type serialization
|
||||
// protobuf is not expressive enough.
|
||||
private val FAKE_CAPTURED_TYPE_CLASS_DESCRIPTOR
|
||||
= createFakeClass(konanInternalPackageName, fakeCapturedTypeClassName)
|
||||
.apply {
|
||||
modality = Modality.ABSTRACT
|
||||
visibility = Visibilities.PUBLIC
|
||||
setTypeParameterDescriptors(
|
||||
TypeParameterDescriptorImpl
|
||||
.createWithDefaultBound(
|
||||
this, Annotations.EMPTY,
|
||||
false, Variance.IN_VARIANCE,
|
||||
Name.identifier("Projection"),
|
||||
/* index = */ 0,
|
||||
LockBasedStorageManager.NO_LOCKS
|
||||
).let(::listOf)
|
||||
)
|
||||
createTypeConstructor()
|
||||
}
|
||||
|
||||
internal fun packCapturedType(type: CapturedType): SimpleType =
|
||||
KotlinTypeFactory.simpleType(
|
||||
Annotations.EMPTY,
|
||||
FAKE_CAPTURED_TYPE_CLASS_DESCRIPTOR.typeConstructor,
|
||||
listOf(type.typeProjection),
|
||||
nullable = false
|
||||
)
|
||||
|
||||
internal fun unpackCapturedType(type: KotlinType)
|
||||
= createCapturedType(type.arguments.single())
|
||||
Reference in New Issue
Block a user