[FIR] introduce FirReceiverParameter
^KT-54417
This commit is contained in:
committed by
Space Team
parent
e6801abce8
commit
be7d282974
+2
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -7,15 +7,12 @@ package org.jetbrains.kotlin.fir.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange
|
||||
import org.jetbrains.kotlin.fir.contracts.FirContractDescription
|
||||
import org.jetbrains.kotlin.fir.contracts.FirEffectDeclaration
|
||||
import org.jetbrains.kotlin.fir.contracts.builder.buildEffectDeclaration
|
||||
import org.jetbrains.kotlin.fir.contracts.builder.buildResolvedContractDescription
|
||||
import org.jetbrains.kotlin.fir.contracts.description.*
|
||||
import org.jetbrains.kotlin.fir.contracts.toFirEffectDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirContractDescriptionOwner
|
||||
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
||||
import org.jetbrains.kotlin.fir.expressions.LogicOperationKind
|
||||
import org.jetbrains.kotlin.fir.types.ConeAttributes
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.fir.types.isBoolean
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
@@ -132,7 +129,7 @@ class FirContractDeserializer(private val c: FirDeserializationContext) {
|
||||
val name: String
|
||||
val typeRef = if (valueParameterIndex < 0) {
|
||||
name = "this"
|
||||
ownerFunction.receiverTypeRef
|
||||
ownerFunction.receiverParameter?.type
|
||||
} else {
|
||||
val parameter = ownerFunction.valueParameters.getOrNull(valueParameterIndex) ?: return null
|
||||
name = parameter.name.asString()
|
||||
|
||||
+17
-6
@@ -1,13 +1,15 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.fir.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.FirModuleData
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.caches.firCachesFactory
|
||||
import org.jetbrains.kotlin.fir.containingClassForStaticMemberAttr
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.*
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyGetter
|
||||
@@ -20,6 +22,7 @@ import org.jetbrains.kotlin.fir.expressions.builder.buildExpressionStub
|
||||
import org.jetbrains.kotlin.fir.resolve.defaultType
|
||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.toEffectiveVisibility
|
||||
import org.jetbrains.kotlin.fir.types.ConeLookupTagBasedType
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||
@@ -366,9 +369,13 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
||||
moduleData = c.moduleData
|
||||
origin = FirDeclarationOrigin.Library
|
||||
this.returnTypeRef = returnTypeRef
|
||||
receiverTypeRef = proto.receiverType(c.typeTable)?.toTypeRef(local).apply {
|
||||
annotations += receiverAnnotations
|
||||
receiverParameter = proto.receiverType(c.typeTable)?.toTypeRef(local)?.let { receiverType ->
|
||||
buildReceiverParameter {
|
||||
type = receiverType
|
||||
annotations += receiverAnnotations
|
||||
}
|
||||
}
|
||||
|
||||
name = callableName
|
||||
this.isVar = isVar
|
||||
this.symbol = symbol
|
||||
@@ -467,9 +474,13 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
||||
moduleData = c.moduleData
|
||||
origin = deserializationOrigin
|
||||
returnTypeRef = proto.returnType(local.typeTable).toTypeRef(local)
|
||||
receiverTypeRef = proto.receiverType(local.typeTable)?.toTypeRef(local).apply {
|
||||
annotations += receiverAnnotations
|
||||
receiverParameter = proto.receiverType(local.typeTable)?.toTypeRef(local)?.let { receiverType ->
|
||||
buildReceiverParameter {
|
||||
type = receiverType
|
||||
annotations += receiverAnnotations
|
||||
}
|
||||
}
|
||||
|
||||
name = callableName
|
||||
val visibility = ProtoEnumFlags.visibility(Flags.VISIBILITY.get(flags))
|
||||
status = FirResolvedDeclarationStatusImpl(
|
||||
|
||||
Reference in New Issue
Block a user