IR: remove KotlinIrLinker.checkAccessibility
This sanity check conflicted with cases where visibility test is suppressed in the frontend.
This commit is contained in:
-5
@@ -527,7 +527,6 @@ abstract class KotlinIrLinker(
|
|||||||
protected abstract fun readFile(moduleDescriptor: ModuleDescriptor, fileIndex: Int): ByteArray
|
protected abstract fun readFile(moduleDescriptor: ModuleDescriptor, fileIndex: Int): ByteArray
|
||||||
protected abstract fun readFileCount(moduleDescriptor: ModuleDescriptor): Int
|
protected abstract fun readFileCount(moduleDescriptor: ModuleDescriptor): Int
|
||||||
|
|
||||||
protected abstract fun checkAccessibility(declarationDescriptor: DeclarationDescriptor): Boolean
|
|
||||||
protected open fun handleNoModuleDeserializerFound(key: UniqId): DeserializationState<*> {
|
protected open fun handleNoModuleDeserializerFound(key: UniqId): DeserializationState<*> {
|
||||||
error("Deserializer for declaration $key is not found")
|
error("Deserializer for declaration $key is not found")
|
||||||
}
|
}
|
||||||
@@ -556,10 +555,6 @@ abstract class KotlinIrLinker(
|
|||||||
//
|
//
|
||||||
if (!topLevelDescriptor.shouldBeDeserialized()) return null
|
if (!topLevelDescriptor.shouldBeDeserialized()) return null
|
||||||
|
|
||||||
require(checkAccessibility(topLevelDescriptor)) {
|
|
||||||
"Locally accessible declarations should not be accessed here $topLevelDescriptor"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (topLevelDescriptor !is DeserializedClassDescriptor && topLevelDescriptor !is DeserializedCallableMemberDescriptor) {
|
if (topLevelDescriptor !is DeserializedClassDescriptor && topLevelDescriptor !is DeserializedCallableMemberDescriptor) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
-5
@@ -51,10 +51,5 @@ class JsIrLinker(
|
|||||||
override fun readFileCount(moduleDescriptor: ModuleDescriptor) =
|
override fun readFileCount(moduleDescriptor: ModuleDescriptor) =
|
||||||
moduleDescriptor.kotlinLibrary.fileCount()
|
moduleDescriptor.kotlinLibrary.fileCount()
|
||||||
|
|
||||||
override fun checkAccessibility(declarationDescriptor: DeclarationDescriptor): Boolean {
|
|
||||||
require(declarationDescriptor is DeclarationDescriptorWithVisibility)
|
|
||||||
return declarationDescriptor.isPublishedApi() || declarationDescriptor.visibility.let { it.isPublicAPI || it == Visibilities.INTERNAL }
|
|
||||||
}
|
|
||||||
|
|
||||||
private val ModuleDescriptor.userName get() = kotlinLibrary.libraryFile.absolutePath
|
private val ModuleDescriptor.userName get() = kotlinLibrary.libraryFile.absolutePath
|
||||||
}
|
}
|
||||||
-9
@@ -62,14 +62,5 @@ class JvmIrLinker(
|
|||||||
override fun readFileCount(moduleDescriptor: ModuleDescriptor) =
|
override fun readFileCount(moduleDescriptor: ModuleDescriptor) =
|
||||||
moduleDescriptor.kotlinLibrary.fileCount()
|
moduleDescriptor.kotlinLibrary.fileCount()
|
||||||
|
|
||||||
override fun checkAccessibility(declarationDescriptor: DeclarationDescriptor): Boolean {
|
|
||||||
require(declarationDescriptor is DeclarationDescriptorWithVisibility)
|
|
||||||
return declarationDescriptor.isPublishedApi() ||
|
|
||||||
declarationDescriptor.visibility.let {
|
|
||||||
it.isPublicAPI || it == Visibilities.INTERNAL ||
|
|
||||||
it == JavaVisibilities.PACKAGE_VISIBILITY || it == JavaVisibilities.PROTECTED_AND_PACKAGE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val ModuleDescriptor.userName get() = kotlinLibrary.libraryFile.absolutePath
|
private val ModuleDescriptor.userName get() = kotlinLibrary.libraryFile.absolutePath
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user