Get rid of BinarySource interface, use SourceElement instead

This commit is contained in:
Alexander Udalov
2016-04-06 16:44:26 +03:00
parent ad068ed4ac
commit 88106bb13b
9 changed files with 28 additions and 26 deletions
@@ -17,22 +17,22 @@
package org.jetbrains.kotlin.serialization.deserialization
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.SourceElement
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.descriptors.BinarySource
sealed class ProtoContainer(
val nameResolver: NameResolver,
val typeTable: TypeTable,
val source: BinarySource?
val source: SourceElement?
) {
class Class(
val classProto: ProtoBuf.Class,
nameResolver: NameResolver,
typeTable: TypeTable,
source: BinarySource?,
source: SourceElement?,
val outerClassKind: ClassKind?
) : ProtoContainer(nameResolver, typeTable, source) {
val classId: ClassId = nameResolver.getClassId(classProto.fqName)
@@ -47,7 +47,7 @@ sealed class ProtoContainer(
val fqName: FqName,
nameResolver: NameResolver,
typeTable: TypeTable,
source: BinarySource?
source: SourceElement?
) : ProtoContainer(nameResolver, typeTable, source) {
override fun debugFqName(): FqName = fqName
}
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.resolve.constants.ConstantValue
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.descriptors.BinarySource
import org.jetbrains.kotlin.storage.StorageManager
class DeserializationComponents(
@@ -49,7 +48,7 @@ class DeserializationComponents(
descriptor: PackageFragmentDescriptor,
nameResolver: NameResolver,
typeTable: TypeTable,
containerSource: BinarySource?
containerSource: SourceElement?
): DeserializationContext =
DeserializationContext(this, nameResolver, descriptor, typeTable, containerSource,
parentTypeDeserializer = null, typeParameters = listOf())
@@ -61,7 +60,7 @@ class DeserializationContext(
val nameResolver: NameResolver,
val containingDeclaration: DeclarationDescriptor,
val typeTable: TypeTable,
val containerSource: BinarySource?,
val containerSource: SourceElement?,
parentTypeDeserializer: TypeDeserializer?,
typeParameters: List<ProtoBuf.TypeParameter>
) {
@@ -36,11 +36,9 @@ interface DeserializedCallableMemberDescriptor : CallableMemberDescriptor {
val typeTable: TypeTable
// Information about the origin of this callable's container (class or package part on JVM) or null if there's no such information.
val containerSource: BinarySource?
val containerSource: SourceElement?
}
interface BinarySource
class DeserializedSimpleFunctionDescriptor(
containingDeclaration: DeclarationDescriptor,
original: SimpleFunctionDescriptor?,
@@ -50,7 +48,7 @@ class DeserializedSimpleFunctionDescriptor(
override val proto: ProtoBuf.Function,
override val nameResolver: NameResolver,
override val typeTable: TypeTable,
override val containerSource: BinarySource?
override val containerSource: SourceElement?
) : DeserializedCallableMemberDescriptor,
SimpleFunctionDescriptorImpl(containingDeclaration, original, annotations, name, kind, SourceElement.NO_SOURCE) {
@@ -82,7 +80,7 @@ class DeserializedPropertyDescriptor(
override val proto: ProtoBuf.Property,
override val nameResolver: NameResolver,
override val typeTable: TypeTable,
override val containerSource: BinarySource?
override val containerSource: SourceElement?
) : DeserializedCallableMemberDescriptor,
PropertyDescriptorImpl(containingDeclaration, original, annotations,
modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE, isLateInit, isConst) {
@@ -110,7 +108,7 @@ class DeserializedConstructorDescriptor(
override val proto: ProtoBuf.Constructor,
override val nameResolver: NameResolver,
override val typeTable: TypeTable,
override val containerSource: BinarySource?
override val containerSource: SourceElement?
) : DeserializedCallableMemberDescriptor,
ConstructorDescriptorImpl(containingDeclaration, original, annotations, isPrimary, kind, SourceElement.NO_SOURCE) {
@@ -74,7 +74,7 @@ class DeserializedClassDescriptor(
private val companionObjectDescriptor = c.storageManager.createNullableLazyValue { computeCompanionObjectDescriptor() }
internal val thisAsProtoContainer = ProtoContainer.Class(
classProto, c.nameResolver, c.typeTable, sourceElement as? BinarySource, (containingDeclaration as? ClassDescriptor)?.kind
classProto, c.nameResolver, c.typeTable, sourceElement, (containingDeclaration as? ClassDescriptor)?.kind
)
private val annotations =
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.serialization.deserialization.descriptors
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
import org.jetbrains.kotlin.descriptors.SourceElement
import org.jetbrains.kotlin.incremental.components.LookupLocation
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.name.ClassId
@@ -36,7 +37,7 @@ open class DeserializedPackageMemberScope(
packageDescriptor: PackageFragmentDescriptor,
proto: ProtoBuf.Package,
nameResolver: NameResolver,
containerSource: BinarySource?,
containerSource: SourceElement?,
components: DeserializationComponents,
classNames: () -> Collection<Name>
) : DeserializedMemberScope(