Minor, make ProtoContainer sealed with two subclasses
This commit is contained in:
+1
-1
@@ -76,7 +76,7 @@ abstract class CallableClsStubBuilder(
|
||||
) {
|
||||
protected val c = outerContext.child(typeParameters)
|
||||
protected val typeStubBuilder = TypeClsStubBuilder(c)
|
||||
protected val isTopLevel: Boolean get() = protoContainer.packageFqName != null
|
||||
protected val isTopLevel: Boolean get() = protoContainer is ProtoContainer.Package
|
||||
protected val callableStub: StubElement<out PsiElement> by lazy(LazyThreadSafetyMode.NONE) { doCreateCallableStub(parent) }
|
||||
|
||||
fun build() {
|
||||
|
||||
+3
-3
@@ -137,7 +137,7 @@ private class ClassClsStubBuilder(
|
||||
|
||||
val primaryConstructorProto = classProto.constructorList.find { !Flags.IS_SECONDARY.get(it.flags) } ?: return
|
||||
|
||||
createConstructorStub(classOrObjectStub, primaryConstructorProto, c, ProtoContainer(classProto, null, c.nameResolver, c.typeTable))
|
||||
createConstructorStub(classOrObjectStub, primaryConstructorProto, c, ProtoContainer.Class(classProto, c.nameResolver, c.typeTable))
|
||||
}
|
||||
|
||||
private fun createDelegationSpecifierList() {
|
||||
@@ -175,7 +175,7 @@ private class ClassClsStubBuilder(
|
||||
private fun createEnumEntryStubs(classBody: KotlinPlaceHolderStubImpl<KtClassBody>) {
|
||||
if (classKind != ProtoBuf.Class.Kind.ENUM_CLASS) return
|
||||
|
||||
val container = ProtoContainer(classProto, null, c.nameResolver, c.typeTable)
|
||||
val container = ProtoContainer.Class(classProto, c.nameResolver, c.typeTable)
|
||||
val enumEntries: List<Pair<Int, List<ClassId>>> =
|
||||
if (classProto.enumEntryList.isNotEmpty())
|
||||
classProto.enumEntryList.map { enumEntryProto ->
|
||||
@@ -206,7 +206,7 @@ private class ClassClsStubBuilder(
|
||||
}
|
||||
|
||||
private fun createCallableMemberStubs(classBody: KotlinPlaceHolderStubImpl<KtClassBody>) {
|
||||
val container = ProtoContainer(classProto, null, c.nameResolver, c.typeTable)
|
||||
val container = ProtoContainer.Class(classProto, c.nameResolver, c.typeTable)
|
||||
|
||||
for (secondaryConstructorProto in classProto.constructorList) {
|
||||
if (Flags.IS_SECONDARY.get(secondaryConstructorProto.flags)) {
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@ fun createPackageFacadeStub(
|
||||
): KotlinFileStubImpl {
|
||||
val fileStub = KotlinFileStubForIde.forFile(packageFqName, packageFqName.isRoot)
|
||||
setupFileStub(fileStub, packageFqName)
|
||||
createCallableStubs(fileStub, c, ProtoContainer(null, packageFqName, c.nameResolver, c.typeTable),
|
||||
createCallableStubs(fileStub, c, ProtoContainer.Package(packageFqName, c.nameResolver, c.typeTable),
|
||||
packageProto.functionList, packageProto.propertyList)
|
||||
return fileStub
|
||||
}
|
||||
@@ -65,7 +65,7 @@ fun createFileFacadeStub(
|
||||
val packageFqName = facadeFqName.parent()
|
||||
val fileStub = KotlinFileStubForIde.forFileFacadeStub(facadeFqName, packageFqName.isRoot)
|
||||
setupFileStub(fileStub, packageFqName)
|
||||
createCallableStubs(fileStub, c, ProtoContainer(null, packageFqName, c.nameResolver, c.typeTable),
|
||||
createCallableStubs(fileStub, c, ProtoContainer.Package(packageFqName, c.nameResolver, c.typeTable),
|
||||
packageProto.functionList, packageProto.propertyList)
|
||||
return fileStub
|
||||
}
|
||||
@@ -84,7 +84,7 @@ fun createMultifileClassStub(
|
||||
val partHeader = partFile.classHeader
|
||||
val (nameResolver, packageProto) = JvmProtoBufUtil.readPackageDataFrom(partHeader.annotationData!!, partHeader.strings!!)
|
||||
val partContext = components.createContext(nameResolver, packageFqName, TypeTable(packageProto.typeTable))
|
||||
createCallableStubs(fileStub, partContext, ProtoContainer(null, packageFqName, partContext.nameResolver, partContext.typeTable),
|
||||
createCallableStubs(fileStub, partContext, ProtoContainer.Package(packageFqName, partContext.nameResolver, partContext.typeTable),
|
||||
packageProto.functionList, packageProto.propertyList)
|
||||
}
|
||||
return fileStub
|
||||
|
||||
Reference in New Issue
Block a user