Minor, rename PackagePartSource -> BinarySource

This commit is contained in:
Alexander Udalov
2016-04-06 15:45:58 +03:00
parent ac92be12c6
commit 7620d66019
17 changed files with 36 additions and 37 deletions
@@ -56,7 +56,7 @@ class ClassDeserializer(private val components: DeserializationComponents) {
if (!fragment.hasTopLevelClass(classId.shortClassName)) return null
}
components.createContext(fragment, nameResolver, TypeTable(classProto.typeTable), packagePartSource = null)
components.createContext(fragment, nameResolver, TypeTable(classProto.typeTable), containerSource = null)
}
return DeserializedClassDescriptor(outerContext, classProto, nameResolver, sourceElement)
@@ -47,7 +47,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
proto,
c.nameResolver,
c.typeTable,
c.packagePartSource
c.containerSource
)
val local = c.childContext(property, proto.typeParameterList)
@@ -147,7 +147,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
else Annotations.EMPTY
val function = DeserializedSimpleFunctionDescriptor(
c.containingDeclaration, /* original = */ null, annotations, c.nameResolver.getName(proto.name),
Deserialization.memberKind(Flags.MEMBER_KIND.get(flags)), proto, c.nameResolver, c.typeTable, c.packagePartSource
Deserialization.memberKind(Flags.MEMBER_KIND.get(flags)), proto, c.nameResolver, c.typeTable, c.containerSource
)
val local = c.childContext(function, proto.typeParameterList)
function.initialize(
@@ -175,7 +175,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
val classDescriptor = c.containingDeclaration as ClassDescriptor
val descriptor = DeserializedConstructorDescriptor(
classDescriptor, null, getAnnotations(proto, proto.flags, AnnotatedCallableKind.FUNCTION),
isPrimary, CallableMemberDescriptor.Kind.DECLARATION, proto, c.nameResolver, c.typeTable, c.packagePartSource
isPrimary, CallableMemberDescriptor.Kind.DECLARATION, proto, c.nameResolver, c.typeTable, c.containerSource
)
val local = c.childContext(descriptor, listOf())
descriptor.initialize(
@@ -240,7 +240,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
}
private fun DeclarationDescriptor.asProtoContainer(): ProtoContainer? = when (this) {
is PackageFragmentDescriptor -> ProtoContainer.Package(fqName, c.nameResolver, c.typeTable, c.packagePartSource)
is PackageFragmentDescriptor -> ProtoContainer.Package(fqName, c.nameResolver, c.typeTable, c.containerSource)
is DeserializedClassDescriptor -> thisAsProtoContainer
else -> null // TODO: support annotations on lambdas and their parameters
}
@@ -21,7 +21,7 @@ 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.PackagePartSource
import org.jetbrains.kotlin.serialization.deserialization.descriptors.BinarySource
sealed class ProtoContainer(
val nameResolver: NameResolver,
@@ -45,7 +45,7 @@ sealed class ProtoContainer(
val fqName: FqName,
nameResolver: NameResolver,
typeTable: TypeTable,
val packagePartSource: PackagePartSource?
val source: BinarySource?
) : ProtoContainer(nameResolver, typeTable) {
override fun debugFqName(): FqName = fqName
}
@@ -23,7 +23,7 @@ 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.PackagePartSource
import org.jetbrains.kotlin.serialization.deserialization.descriptors.BinarySource
import org.jetbrains.kotlin.storage.StorageManager
class DeserializationComponents(
@@ -49,9 +49,9 @@ class DeserializationComponents(
descriptor: PackageFragmentDescriptor,
nameResolver: NameResolver,
typeTable: TypeTable,
packagePartSource: PackagePartSource?
containerSource: BinarySource?
): DeserializationContext =
DeserializationContext(this, nameResolver, descriptor, typeTable, packagePartSource,
DeserializationContext(this, nameResolver, descriptor, typeTable, containerSource,
parentTypeDeserializer = null, typeParameters = listOf())
}
@@ -61,7 +61,7 @@ class DeserializationContext(
val nameResolver: NameResolver,
val containingDeclaration: DeclarationDescriptor,
val typeTable: TypeTable,
val packagePartSource: PackagePartSource?,
val containerSource: BinarySource?,
parentTypeDeserializer: TypeDeserializer?,
typeParameters: List<ProtoBuf.TypeParameter>
) {
@@ -78,7 +78,7 @@ class DeserializationContext(
nameResolver: NameResolver = this.nameResolver,
typeTable: TypeTable = this.typeTable
) = DeserializationContext(
components, nameResolver, descriptor, typeTable, this.packagePartSource,
components, nameResolver, descriptor, typeTable, this.containerSource,
parentTypeDeserializer = this.typeDeserializer, typeParameters = typeParameterProtos
)
}
@@ -35,12 +35,11 @@ interface DeserializedCallableMemberDescriptor : CallableMemberDescriptor {
val typeTable: TypeTable
// Information about the origin of this top-level callable or null, if it's not top-level or there's no such information.
// On JVM, this is JvmPackagePartSource which contains the internal name of the package part class
val packagePartSource: PackagePartSource?
// 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?
}
interface PackagePartSource
interface BinarySource
class DeserializedSimpleFunctionDescriptor(
containingDeclaration: DeclarationDescriptor,
@@ -51,7 +50,7 @@ class DeserializedSimpleFunctionDescriptor(
override val proto: ProtoBuf.Function,
override val nameResolver: NameResolver,
override val typeTable: TypeTable,
override val packagePartSource: PackagePartSource?
override val containerSource: BinarySource?
) : DeserializedCallableMemberDescriptor,
SimpleFunctionDescriptorImpl(containingDeclaration, original, annotations, name, kind, SourceElement.NO_SOURCE) {
@@ -64,7 +63,7 @@ class DeserializedSimpleFunctionDescriptor(
): FunctionDescriptorImpl {
return DeserializedSimpleFunctionDescriptor(
newOwner, original as SimpleFunctionDescriptor?, annotations, newName ?: name, kind,
proto, nameResolver, typeTable, packagePartSource
proto, nameResolver, typeTable, containerSource
)
}
}
@@ -83,7 +82,7 @@ class DeserializedPropertyDescriptor(
override val proto: ProtoBuf.Property,
override val nameResolver: NameResolver,
override val typeTable: TypeTable,
override val packagePartSource: PackagePartSource?
override val containerSource: BinarySource?
) : DeserializedCallableMemberDescriptor,
PropertyDescriptorImpl(containingDeclaration, original, annotations,
modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE, isLateInit, isConst) {
@@ -97,7 +96,7 @@ class DeserializedPropertyDescriptor(
): PropertyDescriptorImpl {
return DeserializedPropertyDescriptor(
newOwner, original, annotations, newModality, newVisibility, isVar, name, kind, isLateInit, isConst,
proto, nameResolver, typeTable, packagePartSource
proto, nameResolver, typeTable, containerSource
)
}
}
@@ -111,7 +110,7 @@ class DeserializedConstructorDescriptor(
override val proto: ProtoBuf.Constructor,
override val nameResolver: NameResolver,
override val typeTable: TypeTable,
override val packagePartSource: PackagePartSource?
override val containerSource: BinarySource?
) : DeserializedCallableMemberDescriptor,
ConstructorDescriptorImpl(containingDeclaration, original, annotations, isPrimary, kind, SourceElement.NO_SOURCE) {
@@ -124,7 +123,7 @@ class DeserializedConstructorDescriptor(
): DeserializedConstructorDescriptor {
return DeserializedConstructorDescriptor(
newOwner as ClassDescriptor, original as ConstructorDescriptor?, annotations, isPrimary, kind,
proto, nameResolver, typeTable, packagePartSource
proto, nameResolver, typeTable, containerSource
)
}
@@ -36,11 +36,11 @@ open class DeserializedPackageMemberScope(
packageDescriptor: PackageFragmentDescriptor,
proto: ProtoBuf.Package,
nameResolver: NameResolver,
packagePartSource: PackagePartSource?,
containerSource: BinarySource?,
components: DeserializationComponents,
classNames: () -> Collection<Name>
) : DeserializedMemberScope(
components.createContext(packageDescriptor, nameResolver, TypeTable(proto.typeTable), packagePartSource),
components.createContext(packageDescriptor, nameResolver, TypeTable(proto.typeTable), containerSource),
proto.functionList, proto.propertyList
) {
private val packageFqName = packageDescriptor.fqName