JS: write and load pre-release flag on binaries
This commit is contained in:
+11
-6
@@ -17,8 +17,10 @@
|
||||
package org.jetbrains.kotlin.serialization.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPackageMemberScope
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
|
||||
@@ -26,17 +28,20 @@ abstract class DeserializedPackageFragmentImpl(
|
||||
fqName: FqName,
|
||||
storageManager: StorageManager,
|
||||
module: ModuleDescriptor,
|
||||
protected val proto: ProtoBuf.PackageFragment
|
||||
protected val proto: ProtoBuf.PackageFragment,
|
||||
private val containerSource: DeserializedContainerSource?
|
||||
) : DeserializedPackageFragment(fqName, storageManager, module) {
|
||||
protected val nameResolver = NameResolverImpl(proto.strings, proto.qualifiedNames)
|
||||
|
||||
override val classDataFinder = ProtoBasedClassDataFinder(proto, nameResolver)
|
||||
override val classDataFinder = ProtoBasedClassDataFinder(proto, nameResolver) { containerSource ?: SourceElement.NO_SOURCE }
|
||||
|
||||
override fun computeMemberScope() =
|
||||
DeserializedPackageMemberScope(
|
||||
this, proto.`package`, nameResolver, containerSource = null, components = components,
|
||||
classNames = { classDataFinder.allClassIds.filter { classId ->
|
||||
!classId.isNestedClass && classId !in ClassDeserializer.BLACK_LIST
|
||||
}.map { it.shortClassName } }
|
||||
this, proto.`package`, nameResolver, containerSource, components,
|
||||
classNames = {
|
||||
classDataFinder.allClassIds.filter { classId ->
|
||||
!classId.isNestedClass && classId !in ClassDeserializer.BLACK_LIST
|
||||
}.map { it.shortClassName }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
+3
-2
@@ -24,7 +24,8 @@ import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
|
||||
class ProtoBasedClassDataFinder(
|
||||
proto: ProtoBuf.PackageFragment,
|
||||
private val nameResolver: NameResolver
|
||||
private val nameResolver: NameResolver,
|
||||
private val classSource: (ClassId) -> SourceElement = { SourceElement.NO_SOURCE }
|
||||
) : ClassDataFinder {
|
||||
private val classIdToProto =
|
||||
proto.class_List.associateBy { klass ->
|
||||
@@ -35,6 +36,6 @@ class ProtoBasedClassDataFinder(
|
||||
|
||||
override fun findClassData(classId: ClassId): ClassDataWithSource? {
|
||||
val classProto = classIdToProto[classId] ?: return null
|
||||
return ClassDataWithSource(ClassData(nameResolver, classProto), SourceElement.NO_SOURCE)
|
||||
return ClassDataWithSource(ClassData(nameResolver, classProto), classSource(classId))
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -45,6 +45,7 @@ interface DeserializedMemberDescriptor : MemberDescriptor {
|
||||
get() = SinceKotlinInfo.create(proto, nameResolver, sinceKotlinInfoTable)
|
||||
|
||||
// Information about the origin of this callable's container (class or package part on JVM) or null if there's no such information.
|
||||
// TODO: merge with sourceElement of containingDeclaration
|
||||
val containerSource: DeserializedContainerSource?
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user