Minor, add nameResolver to ProtoContainer
This commit is contained in:
+2
-2
@@ -241,8 +241,8 @@ public class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun DeclarationDescriptor.asProtoContainer(): ProtoContainer? = when(this) {
|
private fun DeclarationDescriptor.asProtoContainer(): ProtoContainer? = when(this) {
|
||||||
is PackageFragmentDescriptor -> ProtoContainer(null, fqName)
|
is PackageFragmentDescriptor -> ProtoContainer(null, fqName, c.nameResolver)
|
||||||
is DeserializedClassDescriptor -> ProtoContainer(classProto, null)
|
is DeserializedClassDescriptor -> ProtoContainer(classProto, null, c.nameResolver)
|
||||||
else -> null // TODO: support annotations on lambdas and their parameters
|
else -> null // TODO: support annotations on lambdas and their parameters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -19,7 +19,11 @@ package org.jetbrains.kotlin.serialization.deserialization
|
|||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||||
|
|
||||||
public data class ProtoContainer(val classProto: ProtoBuf.Class?, val packageFqName: FqName?) {
|
public data class ProtoContainer(
|
||||||
|
val classProto: ProtoBuf.Class?,
|
||||||
|
val packageFqName: FqName?,
|
||||||
|
val nameResolver: NameResolver
|
||||||
|
) {
|
||||||
init {
|
init {
|
||||||
assert((classProto != null) xor (packageFqName != null))
|
assert((classProto != null) xor (packageFqName != null))
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -135,7 +135,7 @@ private class ClassClsStubBuilder(
|
|||||||
assert(classProto.getPrimaryConstructor().hasData(),
|
assert(classProto.getPrimaryConstructor().hasData(),
|
||||||
"Primary constructor in class is always non-default, so data should not be empty")
|
"Primary constructor in class is always non-default, so data should not be empty")
|
||||||
|
|
||||||
createCallableStub(classOrObjectStub, primaryConstructorProto.getData(), c, ProtoContainer(classProto, null))
|
createCallableStub(classOrObjectStub, primaryConstructorProto.getData(), c, ProtoContainer(classProto, null, c.nameResolver))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createDelegationSpecifierList() {
|
private fun createDelegationSpecifierList() {
|
||||||
@@ -188,7 +188,7 @@ private class ClassClsStubBuilder(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createCallableMemberStubs(classBody: KotlinPlaceHolderStubImpl<JetClassBody>) {
|
private fun createCallableMemberStubs(classBody: KotlinPlaceHolderStubImpl<JetClassBody>) {
|
||||||
val container = ProtoContainer(classProto, null)
|
val container = ProtoContainer(classProto, null, c.nameResolver)
|
||||||
val allMembers = classProto.getSecondaryConstructorList() + classProto.getMemberList()
|
val allMembers = classProto.getSecondaryConstructorList() + classProto.getMemberList()
|
||||||
for (callableProto in allMembers) {
|
for (callableProto in allMembers) {
|
||||||
createCallableStub(classBody, callableProto, c, container)
|
createCallableStub(classBody, callableProto, c, container)
|
||||||
|
|||||||
+3
-4
@@ -51,7 +51,7 @@ fun createPackageFacadeStub(
|
|||||||
): KotlinFileStubImpl {
|
): KotlinFileStubImpl {
|
||||||
val fileStub = KotlinFileStubForIde.forFile(packageFqName, packageFqName.isRoot)
|
val fileStub = KotlinFileStubForIde.forFile(packageFqName, packageFqName.isRoot)
|
||||||
setupFileStub(fileStub, packageFqName)
|
setupFileStub(fileStub, packageFqName)
|
||||||
val container = ProtoContainer(null, packageFqName)
|
val container = ProtoContainer(null, packageFqName, c.nameResolver)
|
||||||
for (callableProto in packageProto.getMemberList()) {
|
for (callableProto in packageProto.getMemberList()) {
|
||||||
createCallableStub(fileStub, callableProto, c, container)
|
createCallableStub(fileStub, callableProto, c, container)
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ fun createFileFacadeStub(
|
|||||||
val packageFqName = facadeFqName.parent()
|
val packageFqName = facadeFqName.parent()
|
||||||
val fileStub = KotlinFileStubForIde.forFileFacadeStub(facadeFqName, packageFqName.isRoot)
|
val fileStub = KotlinFileStubForIde.forFileFacadeStub(facadeFqName, packageFqName.isRoot)
|
||||||
setupFileStub(fileStub, packageFqName)
|
setupFileStub(fileStub, packageFqName)
|
||||||
val container = ProtoContainer(null, facadeFqName.parent())
|
val container = ProtoContainer(null, facadeFqName.parent(), c.nameResolver)
|
||||||
for (callableProto in packageProto.getMemberList()) {
|
for (callableProto in packageProto.getMemberList()) {
|
||||||
createCallableStub(fileStub, callableProto, c, container)
|
createCallableStub(fileStub, callableProto, c, container)
|
||||||
}
|
}
|
||||||
@@ -83,13 +83,12 @@ fun createMultifileClassStub(
|
|||||||
val partNames = multifileClass.classHeader.filePartClassNames?.asList()
|
val partNames = multifileClass.classHeader.filePartClassNames?.asList()
|
||||||
val fileStub = KotlinFileStubForIde.forMultifileClassStub(facadeFqName, partNames, packageFqName.isRoot)
|
val fileStub = KotlinFileStubForIde.forMultifileClassStub(facadeFqName, partNames, packageFqName.isRoot)
|
||||||
setupFileStub(fileStub, packageFqName)
|
setupFileStub(fileStub, packageFqName)
|
||||||
val multifileClassContainer = ProtoContainer(null, packageFqName)
|
|
||||||
for (partFile in partFiles) {
|
for (partFile in partFiles) {
|
||||||
val partHeader = partFile.classHeader
|
val partHeader = partFile.classHeader
|
||||||
val partData = JvmProtoBufUtil.readPackageDataFrom(partHeader.annotationData!!, partHeader.strings!!)
|
val partData = JvmProtoBufUtil.readPackageDataFrom(partHeader.annotationData!!, partHeader.strings!!)
|
||||||
val partContext = components.createContext(partData.nameResolver, packageFqName)
|
val partContext = components.createContext(partData.nameResolver, packageFqName)
|
||||||
for (partMember in partData.packageProto.memberList) {
|
for (partMember in partData.packageProto.memberList) {
|
||||||
createCallableStub(fileStub, partMember, partContext, multifileClassContainer)
|
createCallableStub(fileStub, partMember, partContext, ProtoContainer(null, packageFqName, partContext.nameResolver))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fileStub
|
return fileStub
|
||||||
|
|||||||
Reference in New Issue
Block a user