Rename "context" -> "c" in deserialization for brevity
This commit is contained in:
@@ -156,7 +156,7 @@ class LazyOperationsLog(
|
||||
}
|
||||
o.javaClass.getSimpleName() == "DeserializedType" -> {
|
||||
val typeDeserializer = o.field<TypeDeserializer>("typeDeserializer")
|
||||
val context = typeDeserializer.field<DeserializationContext>("context")
|
||||
val context = typeDeserializer.field<DeserializationContext>("c")
|
||||
val typeProto = o.field<ProtoBuf.Type>("typeProto")
|
||||
val text = when (typeProto.getConstructor().getKind()) {
|
||||
ProtoBuf.Type.Constructor.Kind.CLASS -> context.nameResolver.getFqName(typeProto.getConstructor().getId()).asString()
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class ClassDeserializer(private val components: DeserializationComponents
|
||||
components.createContext(fragments.single(), classData.getNameResolver())
|
||||
}
|
||||
else {
|
||||
deserializeClass(classId.getOuterClassId())?.context ?: return null
|
||||
deserializeClass(classId.getOuterClassId())?.c ?: return null
|
||||
}
|
||||
|
||||
return DeserializedClassDescriptor(outerContext, classData.getClassProto(), classData.getNameResolver())
|
||||
|
||||
+4
-4
@@ -24,18 +24,18 @@ import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
||||
import org.jetbrains.jet.lang.types.*
|
||||
|
||||
class DeserializedType(
|
||||
context: DeserializationContext,
|
||||
c: DeserializationContext,
|
||||
private val typeProto: ProtoBuf.Type
|
||||
) : AbstractJetType(), LazyType {
|
||||
private val typeDeserializer = context.typeDeserializer
|
||||
private val typeDeserializer = c.typeDeserializer
|
||||
|
||||
private val constructor = context.components.storageManager.createLazyValue {
|
||||
private val constructor = c.components.storageManager.createLazyValue {
|
||||
typeDeserializer.typeConstructor(typeProto)
|
||||
}
|
||||
|
||||
private val arguments = typeDeserializer.typeArguments(typeProto.getArgumentList())
|
||||
|
||||
private val memberScope = context.components.storageManager.createLazyValue {
|
||||
private val memberScope = c.components.storageManager.createLazyValue {
|
||||
computeMemberScope()
|
||||
}
|
||||
|
||||
|
||||
+23
-26
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.jet.descriptors.serialization
|
||||
|
||||
import org.jetbrains.jet.descriptors.serialization.*
|
||||
import org.jetbrains.jet.descriptors.serialization.context.DeserializationComponents
|
||||
import org.jetbrains.jet.descriptors.serialization.context.DeserializationContext
|
||||
import org.jetbrains.jet.descriptors.serialization.descriptors.*
|
||||
import org.jetbrains.jet.lang.descriptors.*
|
||||
@@ -27,9 +26,7 @@ import org.jetbrains.jet.lang.resolve.DescriptorFactory
|
||||
import org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable
|
||||
import org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.CallableKind.*
|
||||
|
||||
public class MemberDeserializer(private val context: DeserializationContext) {
|
||||
private val components: DeserializationComponents get() = context.components
|
||||
|
||||
public class MemberDeserializer(private val c: DeserializationContext) {
|
||||
public fun loadCallable(proto: Callable): CallableMemberDescriptor {
|
||||
val callableKind = Flags.CALLABLE_KIND.get(proto.getFlags())
|
||||
return when (callableKind) {
|
||||
@@ -44,18 +41,18 @@ public class MemberDeserializer(private val context: DeserializationContext) {
|
||||
val flags = proto.getFlags()
|
||||
|
||||
val property = DeserializedPropertyDescriptor(
|
||||
context.containingDeclaration, null,
|
||||
c.containingDeclaration, null,
|
||||
getAnnotations(proto, flags, AnnotatedCallableKind.PROPERTY),
|
||||
modality(Flags.MODALITY.get(flags)),
|
||||
visibility(Flags.VISIBILITY.get(flags)),
|
||||
Flags.CALLABLE_KIND.get(flags) == Callable.CallableKind.VAR,
|
||||
context.nameResolver.getName(proto.getName()),
|
||||
c.nameResolver.getName(proto.getName()),
|
||||
memberKind(Flags.MEMBER_KIND.get(flags)),
|
||||
proto,
|
||||
context.nameResolver
|
||||
c.nameResolver
|
||||
)
|
||||
|
||||
val local = context.childContext(property, proto.getTypeParameterList())
|
||||
val local = c.childContext(property, proto.getTypeParameterList())
|
||||
property.setType(
|
||||
local.typeDeserializer.type(proto.getReturnType()),
|
||||
local.typeDeserializer.getOwnTypeParameters(),
|
||||
@@ -115,9 +112,9 @@ public class MemberDeserializer(private val context: DeserializationContext) {
|
||||
|
||||
if (Flags.HAS_CONSTANT.get(flags)) {
|
||||
property.setCompileTimeInitializer(
|
||||
components.storageManager.createNullableLazyValue {
|
||||
val container = context.containingDeclaration.asClassOrPackage()
|
||||
components.constantLoader.loadPropertyConstant(container, proto, context.nameResolver, AnnotatedCallableKind.PROPERTY)
|
||||
c.components.storageManager.createNullableLazyValue {
|
||||
val container = c.containingDeclaration.asClassOrPackage()
|
||||
c.components.constantLoader.loadPropertyConstant(container, proto, c.nameResolver, AnnotatedCallableKind.PROPERTY)
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -129,8 +126,8 @@ public class MemberDeserializer(private val context: DeserializationContext) {
|
||||
|
||||
private fun loadFunction(proto: Callable): CallableMemberDescriptor {
|
||||
val annotations = getAnnotations(proto, proto.getFlags(), AnnotatedCallableKind.FUNCTION)
|
||||
val function = DeserializedSimpleFunctionDescriptor.create(context.containingDeclaration, proto, context.nameResolver, annotations)
|
||||
val local = context.childContext(function, proto.getTypeParameterList())
|
||||
val function = DeserializedSimpleFunctionDescriptor.create(c.containingDeclaration, proto, c.nameResolver, annotations)
|
||||
val local = c.childContext(function, proto.getTypeParameterList())
|
||||
function.initialize(
|
||||
if (proto.hasReceiverType()) local.typeDeserializer.type(proto.getReceiverType()) else null,
|
||||
getDispatchReceiverParameter(),
|
||||
@@ -144,16 +141,16 @@ public class MemberDeserializer(private val context: DeserializationContext) {
|
||||
}
|
||||
|
||||
private fun getDispatchReceiverParameter(): ReceiverParameterDescriptor? {
|
||||
return (context.containingDeclaration as? ClassDescriptor)?.getThisAsReceiverParameter()
|
||||
return (c.containingDeclaration as? ClassDescriptor)?.getThisAsReceiverParameter()
|
||||
}
|
||||
|
||||
private fun loadConstructor(proto: Callable): CallableMemberDescriptor {
|
||||
val classDescriptor = context.containingDeclaration as ClassDescriptor
|
||||
val classDescriptor = c.containingDeclaration as ClassDescriptor
|
||||
val descriptor = ConstructorDescriptorImpl.create(
|
||||
classDescriptor, getAnnotations(proto, proto.getFlags(), AnnotatedCallableKind.FUNCTION), // TODO: primary
|
||||
true, SourceElement.NO_SOURCE
|
||||
)
|
||||
val local = context.childContext(descriptor, listOf())
|
||||
val local = c.childContext(descriptor, listOf())
|
||||
descriptor.initialize(
|
||||
classDescriptor.getTypeConstructor().getParameters(),
|
||||
local.memberDeserializer.valueParameters(proto, AnnotatedCallableKind.FUNCTION),
|
||||
@@ -167,24 +164,24 @@ public class MemberDeserializer(private val context: DeserializationContext) {
|
||||
if (!Flags.HAS_ANNOTATIONS.get(flags)) {
|
||||
return Annotations.EMPTY
|
||||
}
|
||||
return DeserializedAnnotations(components.storageManager) {
|
||||
components.annotationLoader.loadCallableAnnotations(
|
||||
context.containingDeclaration.asClassOrPackage(), proto, context.nameResolver, kind
|
||||
return DeserializedAnnotations(c.components.storageManager) {
|
||||
c.components.annotationLoader.loadCallableAnnotations(
|
||||
c.containingDeclaration.asClassOrPackage(), proto, c.nameResolver, kind
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun valueParameters(callable: Callable, kind: AnnotatedCallableKind): List<ValueParameterDescriptor> {
|
||||
val containerOfCallable = context.containingDeclaration.getContainingDeclaration().asClassOrPackage()
|
||||
val containerOfCallable = c.containingDeclaration.getContainingDeclaration().asClassOrPackage()
|
||||
|
||||
return callable.getValueParameterList().withIndices().map { val (i, proto) = it
|
||||
ValueParameterDescriptorImpl(
|
||||
context.containingDeclaration, null, i,
|
||||
c.containingDeclaration, null, i,
|
||||
getParameterAnnotations(containerOfCallable, callable, kind, proto),
|
||||
context.nameResolver.getName(proto.getName()),
|
||||
context.typeDeserializer.type(proto.getType()),
|
||||
c.nameResolver.getName(proto.getName()),
|
||||
c.typeDeserializer.type(proto.getType()),
|
||||
Flags.DECLARES_DEFAULT_VALUE.get(proto.getFlags()),
|
||||
if (proto.hasVarargElementType()) context.typeDeserializer.type(proto.getVarargElementType()) else null,
|
||||
if (proto.hasVarargElementType()) c.typeDeserializer.type(proto.getVarargElementType()) else null,
|
||||
SourceElement.NO_SOURCE
|
||||
)
|
||||
}
|
||||
@@ -199,8 +196,8 @@ public class MemberDeserializer(private val context: DeserializationContext) {
|
||||
if (!Flags.HAS_ANNOTATIONS.get(valueParameter.getFlags())) {
|
||||
return Annotations.EMPTY
|
||||
}
|
||||
return DeserializedAnnotations(components.storageManager) {
|
||||
components.annotationLoader.loadValueParameterAnnotations(classOrPackage, callable, context.nameResolver, kind, valueParameter)
|
||||
return DeserializedAnnotations(c.components.storageManager) {
|
||||
c.components.annotationLoader.loadValueParameterAnnotations(classOrPackage, callable, c.nameResolver, kind, valueParameter)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -26,23 +26,23 @@ import org.jetbrains.jet.utils.*
|
||||
import java.util.LinkedHashMap
|
||||
|
||||
public class TypeDeserializer(
|
||||
private val context: DeserializationContext,
|
||||
private val c: DeserializationContext,
|
||||
private val parent: TypeDeserializer?,
|
||||
private val typeParameterProtos: List<ProtoBuf.TypeParameter>,
|
||||
private val debugName: String
|
||||
) {
|
||||
private val classDescriptors: (Int) -> ClassDescriptor? = context.components.storageManager.createMemoizedFunctionWithNullableValues {
|
||||
private val classDescriptors: (Int) -> ClassDescriptor? = c.components.storageManager.createMemoizedFunctionWithNullableValues {
|
||||
fqNameIndex -> computeClassDescriptor(fqNameIndex)
|
||||
}
|
||||
|
||||
private val typeParameterDescriptors = context.components.storageManager.createLazyValue {
|
||||
private val typeParameterDescriptors = c.components.storageManager.createLazyValue {
|
||||
if (typeParameterProtos.isEmpty()) {
|
||||
mapOf<Int, TypeParameterDescriptor>()
|
||||
}
|
||||
else {
|
||||
val result = LinkedHashMap<Int, TypeParameterDescriptor>()
|
||||
for ((index, proto) in typeParameterProtos.withIndices()) {
|
||||
result[proto.getId()] = DeserializedTypeParameterDescriptor(context, proto, index)
|
||||
result[proto.getId()] = DeserializedTypeParameterDescriptor(c, proto, index)
|
||||
}
|
||||
result
|
||||
}
|
||||
@@ -52,21 +52,21 @@ public class TypeDeserializer(
|
||||
|
||||
fun type(proto: ProtoBuf.Type): JetType {
|
||||
if (proto.hasFlexibleTypeCapabilitiesId()) {
|
||||
val id = context.nameResolver.getString(proto.getFlexibleTypeCapabilitiesId())
|
||||
val capabilities = context.components.flexibleTypeCapabilitiesDeserializer.capabilitiesById(id)
|
||||
val id = c.nameResolver.getString(proto.getFlexibleTypeCapabilitiesId())
|
||||
val capabilities = c.components.flexibleTypeCapabilitiesDeserializer.capabilitiesById(id)
|
||||
|
||||
if (capabilities == null) {
|
||||
return ErrorUtils.createErrorType("${DeserializedType(context, proto)}: Capabilities not found for id $id")
|
||||
return ErrorUtils.createErrorType("${DeserializedType(c, proto)}: Capabilities not found for id $id")
|
||||
}
|
||||
|
||||
return DelegatingFlexibleType.create(
|
||||
DeserializedType(context, proto),
|
||||
DeserializedType(context, proto.getFlexibleUpperBound()),
|
||||
DeserializedType(c, proto),
|
||||
DeserializedType(c, proto.getFlexibleUpperBound()),
|
||||
capabilities
|
||||
)
|
||||
}
|
||||
|
||||
return DeserializedType(context, proto)
|
||||
return DeserializedType(c, proto)
|
||||
}
|
||||
|
||||
fun typeConstructor(proto: ProtoBuf.Type): TypeConstructor {
|
||||
@@ -74,7 +74,7 @@ public class TypeDeserializer(
|
||||
val id = constructorProto.getId()
|
||||
return typeConstructor(constructorProto) ?: ErrorUtils.createErrorType(
|
||||
if (constructorProto.getKind() == ProtoBuf.Type.Constructor.Kind.CLASS)
|
||||
context.nameResolver.getClassId(id).asSingleFqName().asString()
|
||||
c.nameResolver.getClassId(id).asSingleFqName().asString()
|
||||
else
|
||||
"Unknown type parameter $id"
|
||||
).getConstructor()
|
||||
@@ -91,7 +91,7 @@ public class TypeDeserializer(
|
||||
parent?.typeParameterTypeConstructor(proto)
|
||||
|
||||
private fun computeClassDescriptor(fqNameIndex: Int): ClassDescriptor? =
|
||||
context.components.moduleDescriptor.findClassAcrossModuleDependencies(context.nameResolver.getClassId(fqNameIndex))
|
||||
c.components.moduleDescriptor.findClassAcrossModuleDependencies(c.nameResolver.getClassId(fqNameIndex))
|
||||
|
||||
fun typeArguments(protos: List<ProtoBuf.Type.Argument>): List<TypeProjection> =
|
||||
protos.map { proto ->
|
||||
|
||||
+25
-25
@@ -51,8 +51,7 @@ public class DeserializedClassDescriptor(
|
||||
private val kind = classKind(Flags.CLASS_KIND.get(classProto.getFlags()))
|
||||
private val isInner = Flags.INNER.get(classProto.getFlags())
|
||||
|
||||
val context = outerContext.childContext(this, classProto.getTypeParameterList(), nameResolver)
|
||||
private val components: DeserializationComponents get() = context.components
|
||||
val c = outerContext.childContext(this, classProto.getTypeParameterList(), nameResolver)
|
||||
|
||||
private val classId = nameResolver.getClassId(classProto.getFqName())
|
||||
|
||||
@@ -63,15 +62,16 @@ public class DeserializedClassDescriptor(
|
||||
private val enumEntries = EnumEntryClassDescriptors()
|
||||
|
||||
private val containingDeclaration = outerContext.containingDeclaration
|
||||
private val primaryConstructor = components.storageManager.createNullableLazyValue { computePrimaryConstructor() }
|
||||
private val classObjectDescriptor = components.storageManager.createNullableLazyValue { computeClassObjectDescriptor() }
|
||||
private val primaryConstructor = c.components.storageManager.createNullableLazyValue { computePrimaryConstructor() }
|
||||
private val classObjectDescriptor = c.components.storageManager.createNullableLazyValue { computeClassObjectDescriptor() }
|
||||
|
||||
private val annotations = if (!Flags.HAS_ANNOTATIONS.get(classProto.getFlags())) {
|
||||
Annotations.EMPTY
|
||||
}
|
||||
else DeserializedAnnotations(components.storageManager) {
|
||||
components.annotationLoader.loadClassAnnotations(this, classProto)
|
||||
}
|
||||
private val annotations =
|
||||
if (!Flags.HAS_ANNOTATIONS.get(classProto.getFlags())) {
|
||||
Annotations.EMPTY
|
||||
}
|
||||
else DeserializedAnnotations(c.components.storageManager) {
|
||||
c.components.annotationLoader.loadClassAnnotations(this, classProto)
|
||||
}
|
||||
|
||||
override fun getContainingDeclaration(): DeclarationDescriptor = containingDeclaration
|
||||
|
||||
@@ -101,7 +101,7 @@ public class DeserializedClassDescriptor(
|
||||
return descriptor
|
||||
}
|
||||
|
||||
return context.memberDeserializer.loadCallable(constructorProto.getData()) as ConstructorDescriptor
|
||||
return c.memberDeserializer.loadCallable(constructorProto.getData()) as ConstructorDescriptor
|
||||
}
|
||||
|
||||
override fun getUnsubstitutedPrimaryConstructor(): ConstructorDescriptor? = primaryConstructor()
|
||||
@@ -121,10 +121,10 @@ public class DeserializedClassDescriptor(
|
||||
throw IllegalStateException("Object should have a serialized class object: $classId")
|
||||
}
|
||||
|
||||
return DeserializedClassDescriptor(context, classObjectProto.getData(), context.nameResolver)
|
||||
return DeserializedClassDescriptor(c, classObjectProto.getData(), c.nameResolver)
|
||||
}
|
||||
|
||||
return components.deserializeClass(classId.createNestedClassId(getClassObjectName(getName())))
|
||||
return c.components.deserializeClass(classId.createNestedClassId(getClassObjectName(getName())))
|
||||
}
|
||||
|
||||
override fun getClassObjectDescriptor(): ClassDescriptor? = classObjectDescriptor()
|
||||
@@ -132,7 +132,7 @@ public class DeserializedClassDescriptor(
|
||||
private fun computeSuperTypes(): Collection<JetType> {
|
||||
val supertypes = ArrayList<JetType>(classProto.getSupertypeCount())
|
||||
for (supertype in classProto.getSupertypeList()) {
|
||||
supertypes.add(context.typeDeserializer.type(supertype))
|
||||
supertypes.add(c.typeDeserializer.type(supertype))
|
||||
}
|
||||
return supertypes
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public class DeserializedClassDescriptor(
|
||||
private inner class DeserializedClassTypeConstructor : AbstractClassTypeConstructor() {
|
||||
private val supertypes = computeSuperTypes()
|
||||
|
||||
override fun getParameters() = context.typeDeserializer.getOwnTypeParameters()
|
||||
override fun getParameters() = c.typeDeserializer.getOwnTypeParameters()
|
||||
|
||||
override fun getSupertypes(): Collection<JetType> {
|
||||
// We cannot have error supertypes because subclasses inherit error functions from them
|
||||
@@ -168,9 +168,9 @@ public class DeserializedClassDescriptor(
|
||||
override fun toString() = getName().toString()
|
||||
}
|
||||
|
||||
private inner class DeserializedClassMemberScope : DeserializedMemberScope(context, classProto.getMemberList()) {
|
||||
private inner class DeserializedClassMemberScope : DeserializedMemberScope(c, classProto.getMemberList()) {
|
||||
private val classDescriptor: DeserializedClassDescriptor get() = this@DeserializedClassDescriptor
|
||||
private val allDescriptors = components.storageManager.createLazyValue {
|
||||
private val allDescriptors = c.components.storageManager.createLazyValue {
|
||||
computeDescriptors(DescriptorKindFilter.ALL, JetScope.ALL_NAME_FILTER)
|
||||
}
|
||||
|
||||
@@ -241,17 +241,17 @@ public class DeserializedClassDescriptor(
|
||||
private inner class NestedClassDescriptors {
|
||||
private val nestedClassNames = nestedClassNames()
|
||||
|
||||
val findNestedClass = components.storageManager.createMemoizedFunctionWithNullableValues<Name, ClassDescriptor> {
|
||||
val findNestedClass = c.components.storageManager.createMemoizedFunctionWithNullableValues<Name, ClassDescriptor> {
|
||||
name ->
|
||||
if (name in nestedClassNames) {
|
||||
components.deserializeClass(classId.createNestedClassId(name))
|
||||
c.components.deserializeClass(classId.createNestedClassId(name))
|
||||
}
|
||||
else null
|
||||
}
|
||||
|
||||
private fun nestedClassNames(): Set<Name> {
|
||||
val result = LinkedHashSet<Name>()
|
||||
val nameResolver = context.nameResolver
|
||||
val nameResolver = c.nameResolver
|
||||
for (index in classProto.getNestedClassNameList()) {
|
||||
result.add(nameResolver.getName(index!!))
|
||||
}
|
||||
@@ -272,24 +272,24 @@ public class DeserializedClassDescriptor(
|
||||
if (getKind() != ClassKind.ENUM_CLASS) return setOf()
|
||||
|
||||
val result = LinkedHashSet<Name>()
|
||||
val nameResolver = context.nameResolver
|
||||
val nameResolver = c.nameResolver
|
||||
for (index in classProto.getEnumEntryList()) {
|
||||
result.add(nameResolver.getName(index!!))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
val findEnumEntry = components.storageManager.createMemoizedFunctionWithNullableValues<Name, ClassDescriptor> {
|
||||
val findEnumEntry = c.components.storageManager.createMemoizedFunctionWithNullableValues<Name, ClassDescriptor> {
|
||||
name ->
|
||||
if (name in enumEntryNames) {
|
||||
EnumEntrySyntheticClassDescriptor.create(
|
||||
components.storageManager, this@DeserializedClassDescriptor, name, enumMemberNames, SourceElement.NO_SOURCE
|
||||
c.components.storageManager, this@DeserializedClassDescriptor, name, enumMemberNames, SourceElement.NO_SOURCE
|
||||
)
|
||||
}
|
||||
else null
|
||||
}
|
||||
|
||||
private val enumMemberNames = components.storageManager.createLazyValue { computeEnumMemberNames() }
|
||||
private val enumMemberNames = c.components.storageManager.createLazyValue { computeEnumMemberNames() }
|
||||
|
||||
private fun computeEnumMemberNames(): Collection<Name> {
|
||||
// NOTE: order of enum entry members should be irrelevant
|
||||
@@ -304,7 +304,7 @@ public class DeserializedClassDescriptor(
|
||||
}
|
||||
}
|
||||
|
||||
val nameResolver = context.nameResolver
|
||||
val nameResolver = c.nameResolver
|
||||
return classProto.getMemberList().mapTo(result) { nameResolver.getName(it.getName()) }
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -29,9 +29,9 @@ import org.jetbrains.jet.descriptors.serialization.context.DeserializationContex
|
||||
import java.util.*
|
||||
|
||||
public abstract class DeserializedMemberScope protected(
|
||||
protected val context: DeserializationContext,
|
||||
membersList: Collection<ProtoBuf.Callable>)
|
||||
: JetScope {
|
||||
protected val c: DeserializationContext,
|
||||
membersList: Collection<ProtoBuf.Callable>
|
||||
) : JetScope {
|
||||
|
||||
private data class ProtoKey(val name: Name, val kind: Kind, val isExtension: Boolean)
|
||||
private enum class Kind { FUNCTION PROPERTY }
|
||||
@@ -45,11 +45,11 @@ public abstract class DeserializedMemberScope protected(
|
||||
}
|
||||
|
||||
private val membersProtos =
|
||||
context.components.storageManager.createLazyValue { groupByKey(filteredMemberProtos(membersList)) }
|
||||
c.components.storageManager.createLazyValue { groupByKey(filteredMemberProtos(membersList)) }
|
||||
private val functions =
|
||||
context.components.storageManager.createMemoizedFunction<Name, Collection<FunctionDescriptor>> { computeFunctions(it) }
|
||||
c.components.storageManager.createMemoizedFunction<Name, Collection<FunctionDescriptor>> { computeFunctions(it) }
|
||||
private val properties =
|
||||
context.components.storageManager.createMemoizedFunction<Name, Collection<VariableDescriptor>> { computeProperties(it) }
|
||||
c.components.storageManager.createMemoizedFunction<Name, Collection<VariableDescriptor>> { computeProperties(it) }
|
||||
|
||||
protected open fun filteredMemberProtos(allMemberProtos: Collection<ProtoBuf.Callable>): Collection<ProtoBuf.Callable> = allMemberProtos
|
||||
|
||||
@@ -57,7 +57,7 @@ public abstract class DeserializedMemberScope protected(
|
||||
val map = LinkedHashMap<ProtoKey, MutableList<ProtoBuf.Callable>>()
|
||||
for (memberProto in membersList) {
|
||||
val key = ProtoKey(
|
||||
context.nameResolver.getName(memberProto.getName()),
|
||||
c.nameResolver.getName(memberProto.getName()),
|
||||
Flags.CALLABLE_KIND[memberProto.getFlags()].toKind(),
|
||||
memberProto.hasReceiverType()
|
||||
)
|
||||
@@ -77,7 +77,7 @@ public abstract class DeserializedMemberScope protected(
|
||||
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
return memberProtos.mapTo(LinkedHashSet<D>()) { memberProto ->
|
||||
context.memberDeserializer.loadCallable(memberProto) as D
|
||||
c.memberDeserializer.loadCallable(memberProto) as D
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public abstract class DeserializedMemberScope protected(
|
||||
|
||||
override fun getLocalVariable(name: Name): VariableDescriptor? = null
|
||||
|
||||
override fun getContainingDeclaration() = context.containingDeclaration
|
||||
override fun getContainingDeclaration() = c.containingDeclaration
|
||||
|
||||
override fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor> = listOf()
|
||||
|
||||
|
||||
+2
-2
@@ -36,12 +36,12 @@ public open class DeserializedPackageMemberScope(
|
||||
) : DeserializedMemberScope(components.createContext(packageDescriptor, nameResolver), proto.getMemberList()) {
|
||||
|
||||
private val packageFqName = packageDescriptor.fqName
|
||||
private val classNames = context.components.storageManager.createLazyValue(classNames)
|
||||
private val classNames = c.components.storageManager.createLazyValue(classNames)
|
||||
|
||||
override fun getDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean)
|
||||
= computeDescriptors(kindFilter, nameFilter)
|
||||
|
||||
override fun getClassDescriptor(name: Name) = context.components.deserializeClass(ClassId(packageFqName, name))
|
||||
override fun getClassDescriptor(name: Name) = c.components.deserializeClass(ClassId(packageFqName, name))
|
||||
|
||||
override fun addClassDescriptors(result: MutableCollection<DeclarationDescriptor>, nameFilter: (Name) -> Boolean) {
|
||||
for (className in classNames()) {
|
||||
|
||||
+5
-5
@@ -34,16 +34,16 @@ public class DeserializedTypeParameterDescriptor extends AbstractLazyTypeParamet
|
||||
private final ProtoBuf.TypeParameter proto;
|
||||
private final TypeDeserializer typeDeserializer;
|
||||
|
||||
public DeserializedTypeParameterDescriptor(@NotNull DeserializationContext context, @NotNull ProtoBuf.TypeParameter proto, int index) {
|
||||
super(context.getComponents().getStorageManager(),
|
||||
context.getContainingDeclaration(),
|
||||
context.getNameResolver().getName(proto.getName()),
|
||||
public DeserializedTypeParameterDescriptor(@NotNull DeserializationContext c, @NotNull ProtoBuf.TypeParameter proto, int index) {
|
||||
super(c.getComponents().getStorageManager(),
|
||||
c.getContainingDeclaration(),
|
||||
c.getNameResolver().getName(proto.getName()),
|
||||
SerializationPackage.variance(proto.getVariance()),
|
||||
proto.getReified(),
|
||||
index,
|
||||
SourceElement.NO_SOURCE);
|
||||
this.proto = proto;
|
||||
this.typeDeserializer = context.getTypeDeserializer();
|
||||
this.typeDeserializer = c.getTypeDeserializer();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user