Add external property to class and property descriptors
This commit is contained in:
+1
-1
@@ -78,7 +78,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
|
||||
super(containingDeclaration, null, Annotations.Companion.getEMPTY(), Modality.FINAL, Visibilities.LOCAL,
|
||||
original.isVar(), Name.identifier("access$" + nameSuffix),
|
||||
Kind.DECLARATION, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false,
|
||||
/* isPlatform = */ false, /* isImpl = */ false);
|
||||
/* isPlatform = */ false, /* isImpl = */ false, /* isExternal = */ false);
|
||||
|
||||
this.calleeDescriptor = original;
|
||||
this.superCallTarget = superCallTarget;
|
||||
|
||||
@@ -308,8 +308,8 @@ class CollectionStubMethodGenerator(
|
||||
}
|
||||
|
||||
private fun createSyntheticSubclass(): Pair<MutableClassDescriptor, List<TypeParameterDescriptor>> {
|
||||
val child = MutableClassDescriptor(descriptor.containingDeclaration, ClassKind.CLASS, false,
|
||||
Name.special("<synthetic inheritor of ${descriptor.name}>"), descriptor.source)
|
||||
val child = MutableClassDescriptor(descriptor.containingDeclaration, ClassKind.CLASS, /* isInner = */ false,
|
||||
/* isExternal */ false, Name.special("<synthetic inheritor of ${descriptor.name}>"), descriptor.source)
|
||||
child.modality = Modality.FINAL
|
||||
child.visibility = Visibilities.PUBLIC
|
||||
val typeParameters = descriptor.typeConstructor.parameters
|
||||
|
||||
@@ -62,7 +62,8 @@ class InterfaceImplBodyCodegen(
|
||||
if (DescriptorUtils.isLocal(descriptor)) return null
|
||||
val classDescriptorImpl = ClassDescriptorImpl(
|
||||
descriptor, Name.identifier(JvmAbi.DEFAULT_IMPLS_CLASS_NAME),
|
||||
Modality.FINAL, ClassKind.CLASS, Collections.emptyList(), SourceElement.NO_SOURCE)
|
||||
Modality.FINAL, ClassKind.CLASS, Collections.emptyList(), SourceElement.NO_SOURCE,
|
||||
/* isExternal = */ false)
|
||||
|
||||
classDescriptorImpl.initialize(MemberScope.Empty, emptySet(), null)
|
||||
return classDescriptorImpl
|
||||
|
||||
@@ -67,7 +67,8 @@ class JvmRuntimeTypes(module: ModuleDescriptor) {
|
||||
}
|
||||
|
||||
private fun createClass(packageFragment: PackageFragmentDescriptor, name: String): ClassDescriptor =
|
||||
MutableClassDescriptor(packageFragment, ClassKind.CLASS, false, Name.identifier(name), SourceElement.NO_SOURCE).apply {
|
||||
MutableClassDescriptor(packageFragment, ClassKind.CLASS, /* isInner = */ false, /* isExternal = */ false,
|
||||
Name.identifier(name), SourceElement.NO_SOURCE).apply {
|
||||
modality = Modality.FINAL
|
||||
visibility = Visibilities.PUBLIC
|
||||
setTypeParameterDescriptors(emptyList())
|
||||
|
||||
@@ -47,10 +47,11 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull ClassKind kind,
|
||||
boolean isInner,
|
||||
boolean isExternal,
|
||||
@NotNull Name name,
|
||||
@NotNull SourceElement source
|
||||
) {
|
||||
super(LockBasedStorageManager.NO_LOCKS, containingDeclaration, name, source);
|
||||
super(LockBasedStorageManager.NO_LOCKS, containingDeclaration, name, source, isExternal);
|
||||
assert kind != ClassKind.OBJECT : "Fix isCompanionObject()";
|
||||
|
||||
this.kind = kind;
|
||||
|
||||
@@ -84,7 +84,8 @@ public class SamWrapperCodegen {
|
||||
Modality.FINAL,
|
||||
ClassKind.CLASS,
|
||||
Collections.singleton(samType.getType()),
|
||||
SourceElement.NO_SOURCE
|
||||
SourceElement.NO_SOURCE,
|
||||
/* isExternal = */ false
|
||||
);
|
||||
// e.g. compare(T, T)
|
||||
SimpleFunctionDescriptor erasedInterfaceFunction = samType.getAbstractMethod().getOriginal().copy(
|
||||
|
||||
+2
-1
@@ -31,7 +31,8 @@ class SyntheticClassDescriptorForLambda(
|
||||
name: Name,
|
||||
supertypes: Collection<KotlinType>,
|
||||
element: KtElement
|
||||
) : ClassDescriptorImpl(containingDeclaration, name, Modality.FINAL, ClassKind.CLASS, supertypes, element.toSourceElement()) {
|
||||
) : ClassDescriptorImpl(containingDeclaration, name, Modality.FINAL, ClassKind.CLASS, supertypes, element.toSourceElement(),
|
||||
/* isExternal = */ false) {
|
||||
init {
|
||||
initialize(MemberScope.Empty, emptySet(), null)
|
||||
}
|
||||
|
||||
+1
-1
@@ -280,7 +280,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
|
||||
source: SourceElement
|
||||
) : SyntheticJavaPropertyDescriptor, PropertyDescriptorImpl(
|
||||
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, source,
|
||||
/* lateInit = */ false, /* isConst = */ false, /* isPlatform = */ false, /* isImpl = */ false
|
||||
/* lateInit = */ false, /* isConst = */ false, /* isPlatform = */ false, /* isImpl = */ false, /* isExternal = */ false
|
||||
) {
|
||||
|
||||
override var getMethod: FunctionDescriptor by Delegates.notNull()
|
||||
|
||||
@@ -811,7 +811,8 @@ public class DescriptorResolver {
|
||||
modifierList != null && modifierList.hasModifier(KtTokens.CONST_KEYWORD),
|
||||
modifierList != null && modifierList.hasModifier(KtTokens.PLATFORM_KEYWORD) ||
|
||||
containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor) containingDeclaration).isPlatform(),
|
||||
modifierList != null && modifierList.hasModifier(KtTokens.IMPL_KEYWORD)
|
||||
modifierList != null && modifierList.hasModifier(KtTokens.IMPL_KEYWORD),
|
||||
modifierList != null && modifierList.hasModifier(KtTokens.EXTERNAL_KEYWORD)
|
||||
);
|
||||
wrapper.setDescriptor(propertyDescriptor);
|
||||
|
||||
@@ -1128,7 +1129,8 @@ public class DescriptorResolver {
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false,
|
||||
/* isPlatform = */ false,
|
||||
/* isImpl = */ false
|
||||
/* isImpl = */ false,
|
||||
/* isExternal = */ false
|
||||
);
|
||||
propertyWrapper.setDescriptor(propertyDescriptor);
|
||||
propertyDescriptor.setType(type, Collections.<TypeParameterDescriptor>emptyList(),
|
||||
|
||||
@@ -148,7 +148,8 @@ class LocalVariableResolver(
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false,
|
||||
/* isPlatform = */ false,
|
||||
/* isImpl = */ false
|
||||
/* isImpl = */ false,
|
||||
/* isExternal = */ false
|
||||
)
|
||||
// For a local variable the type must not be deferred
|
||||
type = variableTypeAndInitializerResolver.resolveType(propertyDescriptor, scope, variable, dataFlowInfo, trace, local = true)
|
||||
|
||||
@@ -99,7 +99,8 @@ class DynamicCallableDescriptors(storageManager: StorageManager, builtIns: Kotli
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false,
|
||||
/* isPlatform = */ false,
|
||||
/* isImpl = */ false
|
||||
/* isImpl = */ false,
|
||||
/* isExternal = */ false
|
||||
)
|
||||
propertyDescriptor.setType(
|
||||
dynamicType,
|
||||
|
||||
+5
-2
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.resolve.lazy.descriptors
|
||||
import com.google.common.collect.Sets
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
@@ -53,8 +54,10 @@ protected constructor(
|
||||
return declarationProvider.getClassOrObjectDeclarations(name).map {
|
||||
if (it is KtScriptInfo)
|
||||
LazyScriptDescriptor(c as ResolveSession, thisDescriptor, name, it)
|
||||
else
|
||||
LazyClassDescriptor(c, thisDescriptor, name, it)
|
||||
else {
|
||||
val isExternal = it.modifierList?.hasModifier(KtTokens.EXTERNAL_KEYWORD) ?: false
|
||||
LazyClassDescriptor(c, thisDescriptor, name, it, isExternal)
|
||||
}
|
||||
}.toReadOnlyList()
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -111,10 +111,12 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
@NotNull final LazyClassContext c,
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull Name name,
|
||||
@NotNull final KtClassLikeInfo classLikeInfo
|
||||
@NotNull final KtClassLikeInfo classLikeInfo,
|
||||
boolean isExternal
|
||||
) {
|
||||
super(c.getStorageManager(), containingDeclaration, name,
|
||||
KotlinSourceElementKt.toSourceElement(classLikeInfo.getCorrespondingClassOrObject())
|
||||
KotlinSourceElementKt.toSourceElement(classLikeInfo.getCorrespondingClassOrObject()),
|
||||
isExternal
|
||||
);
|
||||
this.c = c;
|
||||
|
||||
|
||||
+2
-1
@@ -43,7 +43,8 @@ class LazyScriptDescriptor(
|
||||
resolveSession,
|
||||
containingDeclaration,
|
||||
name,
|
||||
scriptInfo
|
||||
scriptInfo,
|
||||
/* isExternal = */ false
|
||||
) {
|
||||
init {
|
||||
resolveSession.trace.record(BindingContext.SCRIPT, scriptInfo.script, this)
|
||||
|
||||
+3
-1
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.descriptors.SupertypeLoopChecker
|
||||
import org.jetbrains.kotlin.frontend.di.createContainerForLazyLocalClassifierAnalyzer
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
@@ -152,7 +153,8 @@ class LocalClassDescriptorHolder(
|
||||
,
|
||||
containingDeclaration,
|
||||
classOrObject.getNameAsSafeName(),
|
||||
KtClassInfoUtil.createClassLikeInfo(classOrObject)
|
||||
KtClassInfoUtil.createClassLikeInfo(classOrObject),
|
||||
classOrObject.hasModifier(KtTokens.EXTERNAL_KEYWORD)
|
||||
)
|
||||
writableScope?.addClassifierDescriptor(classDescriptor!!)
|
||||
}
|
||||
|
||||
+2
@@ -33,4 +33,6 @@ class DefaultImplsClassDescriptorImpl(
|
||||
init {
|
||||
initialize(emptyList(), listOf(correspondingInterface.module.builtIns.anyType))
|
||||
}
|
||||
|
||||
override fun isExternal() = false
|
||||
}
|
||||
+2
@@ -37,4 +37,6 @@ class FileClassDescriptorImpl(
|
||||
init {
|
||||
initialize(emptyList(), supertypes)
|
||||
}
|
||||
|
||||
override fun isExternal() = false
|
||||
}
|
||||
+1
-1
@@ -44,7 +44,7 @@ class JvmPropertyDescriptorImpl(
|
||||
isImpl: Boolean
|
||||
) : JvmDescriptorWithExtraFlags, PropertyDescriptorImpl(
|
||||
containingDeclaration, original, annotations, modality, visibility, isVar,
|
||||
name, kind, source, isLateInit, isConst, isPlatform, isImpl
|
||||
name, kind, source, isLateInit, isConst, isPlatform, isImpl, /* isExternal = */ false
|
||||
) {
|
||||
override fun createSubstitutedCopy(
|
||||
newOwner: DeclarationDescriptor,
|
||||
|
||||
+1
@@ -140,6 +140,7 @@ open class KnownClassDescriptor(
|
||||
override fun isInner(): Boolean = false
|
||||
override fun isPlatform(): Boolean = false
|
||||
override fun isImpl(): Boolean = false
|
||||
override fun isExternal(): Boolean = false
|
||||
|
||||
override fun <R : Any?, D : Any?> accept(visitor: DeclarationDescriptorVisitor<R, D>, data: D): R {
|
||||
return visitor.visitClassDescriptor(this, data)
|
||||
|
||||
+4
-2
@@ -59,7 +59,8 @@ class JvmSharedVariablesManager(val builtIns: KotlinBuiltIns) : SharedVariablesM
|
||||
PropertyDescriptorImpl.create(
|
||||
refClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
|
||||
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
|
||||
false, false, false, false
|
||||
/* lateInit = */ false, /* isConst = */ false, /* isPlatform = */ false, /* isImpl = */ false,
|
||||
/* isExternal = */ false
|
||||
).initialize(type, dispatchReceiverParameter = refClass.thisAsReceiverParameter)
|
||||
}
|
||||
|
||||
@@ -99,7 +100,8 @@ class JvmSharedVariablesManager(val builtIns: KotlinBuiltIns) : SharedVariablesM
|
||||
PropertyDescriptorImpl.create(
|
||||
genericRefClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
|
||||
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
|
||||
false, false, false, false
|
||||
/* lateInit = */ false, /* isConst = */ false, /* isPlatform = */ false, /* isImpl = */ false,
|
||||
/* isExternal = */ false
|
||||
).initialize(
|
||||
type = builtIns.anyType,
|
||||
dispatchReceiverParameter = genericRefClass.thisAsReceiverParameter
|
||||
|
||||
+2
-1
@@ -128,7 +128,8 @@ class SpecialDescriptorsFactory(
|
||||
objectDescriptor,
|
||||
Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, false,
|
||||
Name.identifier("INSTANCE"),
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE, false, false, false, false
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false,
|
||||
/* isPlatform = */ false, /* isImpl = */ false, /* isExternal = */ false
|
||||
).initialize(objectDescriptor.defaultType)
|
||||
|
||||
return instanceFieldDescriptor
|
||||
|
||||
@@ -61,7 +61,8 @@ abstract class IrDelegateDescriptorBase(
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false,
|
||||
/* isPlatform = */ false,
|
||||
/* isImpl = */ false
|
||||
/* isImpl = */ false,
|
||||
/* isExternal = */ false
|
||||
) {
|
||||
init {
|
||||
setOutType(delegateType)
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ class JvmBuiltInClassDescriptorFactory(
|
||||
ClassDescriptorImpl(
|
||||
moduleDescriptor.getPackage(KOTLIN_FQ_NAME).fragments.filterIsInstance<BuiltInsPackageFragment>().first(),
|
||||
CLONEABLE_NAME, Modality.ABSTRACT, ClassKind.INTERFACE, listOf(moduleDescriptor.builtIns.anyType),
|
||||
SourceElement.NO_SOURCE
|
||||
SourceElement.NO_SOURCE, /* isExternal = */ false
|
||||
).apply {
|
||||
initialize(CloneableClassScope(storageManager, this), emptySet(), null)
|
||||
}
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
|
||||
boolean isStaticFinal
|
||||
) {
|
||||
super(containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, source,
|
||||
/* lateInit = */ false, /* isConst = */ false, /* isPlatform = */ false, /* isImpl = */ false);
|
||||
/* lateInit = */ false, /* isConst = */ false, /* isPlatform = */ false, /* isImpl = */ false, /* isExternal = */ false);
|
||||
|
||||
this.isStaticFinal = isStaticFinal;
|
||||
}
|
||||
|
||||
+2
-1
@@ -55,7 +55,8 @@ class LazyJavaClassDescriptor(
|
||||
private val jClass: JavaClass,
|
||||
private val additionalSupertypeClassDescriptor: ClassDescriptor? = null
|
||||
) : ClassDescriptorBase(outerContext.storageManager, containingDeclaration, jClass.name,
|
||||
outerContext.components.sourceElementFactory.source(jClass)), JavaClassDescriptor {
|
||||
outerContext.components.sourceElementFactory.source(jClass),
|
||||
/* isExternal = */ false), JavaClassDescriptor {
|
||||
|
||||
private val c: LazyJavaResolverContext = outerContext.child(this, jClass)
|
||||
|
||||
|
||||
+5
-4
@@ -87,9 +87,9 @@ open class JvmBuiltInsSettings(
|
||||
// - Otherwise error will be reported because of Deprecated annotation with Error level
|
||||
val lowPriorityAnnotation =
|
||||
ClassDescriptorImpl(
|
||||
moduleDescriptor.getPackage(LOW_PRIORITY_IN_OVERLOAD_RESOLUTION_FQ_NAME.parent()),
|
||||
LOW_PRIORITY_IN_OVERLOAD_RESOLUTION_FQ_NAME.shortName(), Modality.FINAL, ClassKind.ANNOTATION_CLASS,
|
||||
moduleDescriptor.builtIns.anyType.singletonList(), SourceElement.NO_SOURCE
|
||||
moduleDescriptor.getPackage(LOW_PRIORITY_IN_OVERLOAD_RESOLUTION_FQ_NAME.parent()), LOW_PRIORITY_IN_OVERLOAD_RESOLUTION_FQ_NAME.shortName(),
|
||||
Modality.FINAL, ClassKind.ANNOTATION_CLASS, moduleDescriptor.builtIns.anyType.singletonList(),
|
||||
SourceElement.NO_SOURCE, /* isExternal = */ false
|
||||
).run {
|
||||
initialize(MemberScope.Empty, emptySet(), null)
|
||||
AnnotationDescriptorImpl(defaultType, emptyMap(), SourceElement.NO_SOURCE)
|
||||
@@ -112,7 +112,8 @@ open class JvmBuiltInsSettings(
|
||||
val superTypes = listOf(LazyWrappedType(this) { moduleDescriptor.builtIns.anyType })
|
||||
|
||||
val mockSerializableClass = ClassDescriptorImpl(
|
||||
mockJavaIoPackageFragment, Name.identifier("Serializable"), Modality.ABSTRACT, ClassKind.INTERFACE, superTypes, SourceElement.NO_SOURCE
|
||||
mockJavaIoPackageFragment, Name.identifier("Serializable"), Modality.ABSTRACT, ClassKind.INTERFACE, superTypes,
|
||||
SourceElement.NO_SOURCE, /* isExternal = */ false
|
||||
)
|
||||
|
||||
mockSerializableClass.initialize(MemberScope.Empty, emptySet(), null)
|
||||
|
||||
+1
@@ -104,6 +104,7 @@ class FunctionClassDescriptor(
|
||||
override fun isData() = false
|
||||
override fun isPlatform() = false
|
||||
override fun isImpl() = false
|
||||
override fun isExternal() = false
|
||||
override val annotations: Annotations get() = Annotations.EMPTY
|
||||
override fun getSource() = SourceElement.NO_SOURCE
|
||||
|
||||
|
||||
@@ -75,8 +75,6 @@ public interface FunctionDescriptor extends CallableMemberDescriptor {
|
||||
|
||||
boolean isTailrec();
|
||||
|
||||
boolean isExternal();
|
||||
|
||||
boolean isHiddenForResolutionEverywhereBesideSupercalls();
|
||||
|
||||
boolean isSuspend();
|
||||
|
||||
@@ -29,4 +29,6 @@ public interface MemberDescriptor extends DeclarationDescriptorNonRoot, Declarat
|
||||
boolean isPlatform();
|
||||
|
||||
boolean isImpl();
|
||||
|
||||
boolean isExternal();
|
||||
}
|
||||
|
||||
+2
@@ -69,6 +69,8 @@ abstract class AbstractTypeAliasDescriptor(
|
||||
|
||||
override fun isImpl(): Boolean = false
|
||||
|
||||
override fun isExternal() = false
|
||||
|
||||
override fun getTypeConstructor(): TypeConstructor =
|
||||
typeConstructor
|
||||
|
||||
|
||||
@@ -26,16 +26,24 @@ public abstract class ClassDescriptorBase extends AbstractClassDescriptor {
|
||||
|
||||
private final DeclarationDescriptor containingDeclaration;
|
||||
private final SourceElement source;
|
||||
private final boolean isExternal;
|
||||
|
||||
protected ClassDescriptorBase(
|
||||
@NotNull StorageManager storageManager,
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull Name name,
|
||||
@NotNull SourceElement source
|
||||
@NotNull SourceElement source,
|
||||
boolean isExternal
|
||||
) {
|
||||
super(storageManager, name);
|
||||
this.containingDeclaration = containingDeclaration;
|
||||
this.source = source;
|
||||
this.isExternal = isExternal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExternal() {
|
||||
return isExternal;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -47,9 +47,10 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
|
||||
@NotNull Modality modality,
|
||||
@NotNull ClassKind kind,
|
||||
@NotNull Collection<KotlinType> supertypes,
|
||||
@NotNull SourceElement source
|
||||
@NotNull SourceElement source,
|
||||
boolean isExternal
|
||||
) {
|
||||
super(LockBasedStorageManager.NO_LOCKS, containingDeclaration, name, source);
|
||||
super(LockBasedStorageManager.NO_LOCKS, containingDeclaration, name, source, isExternal);
|
||||
this.modality = modality;
|
||||
this.kind = kind;
|
||||
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
|
||||
@NotNull Annotations annotations,
|
||||
@NotNull SourceElement source
|
||||
) {
|
||||
super(storageManager, containingClass, name, source);
|
||||
super(storageManager, containingClass, name, source, /* isExternal = */ false);
|
||||
assert containingClass.getKind() == ClassKind.ENUM_CLASS;
|
||||
|
||||
this.annotations = annotations;
|
||||
|
||||
+5
@@ -216,6 +216,11 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
|
||||
return original.isData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExternal() {
|
||||
return original.isExternal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompanionObject() {
|
||||
return original.isCompanionObject();
|
||||
|
||||
+14
-4
@@ -46,6 +46,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
private final boolean isConst;
|
||||
private final boolean isPlatform;
|
||||
private final boolean isImpl;
|
||||
private final boolean isExternal;
|
||||
|
||||
private ReceiverParameterDescriptor dispatchReceiverParameter;
|
||||
private ReceiverParameterDescriptor extensionReceiverParameter;
|
||||
@@ -67,7 +68,8 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
boolean lateInit,
|
||||
boolean isConst,
|
||||
boolean isPlatform,
|
||||
boolean isImpl
|
||||
boolean isImpl,
|
||||
boolean isExternal
|
||||
) {
|
||||
super(containingDeclaration, annotations, name, null, isVar, source);
|
||||
this.modality = modality;
|
||||
@@ -78,6 +80,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
this.isConst = isConst;
|
||||
this.isPlatform = isPlatform;
|
||||
this.isImpl = isImpl;
|
||||
this.isExternal = isExternal;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -93,10 +96,12 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
boolean lateInit,
|
||||
boolean isConst,
|
||||
boolean isPlatform,
|
||||
boolean isImpl
|
||||
boolean isImpl,
|
||||
boolean isExternal
|
||||
) {
|
||||
return new PropertyDescriptorImpl(containingDeclaration, null, annotations,
|
||||
modality, visibility, isVar, name, kind, source, lateInit, isConst, isPlatform, isImpl);
|
||||
modality, visibility, isVar, name, kind, source, lateInit, isConst,
|
||||
isPlatform, isImpl, isExternal);
|
||||
}
|
||||
|
||||
public void setType(
|
||||
@@ -199,6 +204,11 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
return isConst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExternal() {
|
||||
return isExternal;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<PropertyAccessorDescriptor> getAccessors() {
|
||||
@@ -342,7 +352,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
) {
|
||||
return new PropertyDescriptorImpl(
|
||||
newOwner, original, getAnnotations(), newModality, newVisibility, isVar(), getName(), kind, SourceElement.NO_SOURCE,
|
||||
isLateInit(), isConst(), isPlatform(), isImpl()
|
||||
isLateInit(), isConst(), isPlatform(), isImpl(), isExternal()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -286,7 +286,9 @@ public class ErrorUtils {
|
||||
private static class ErrorClassDescriptor extends ClassDescriptorImpl {
|
||||
public ErrorClassDescriptor(@Nullable String name) {
|
||||
super(getErrorModule(), Name.special(name == null ? "<ERROR CLASS>" : "<ERROR CLASS: " + name + ">"),
|
||||
Modality.OPEN, ClassKind.CLASS, Collections.<KotlinType>emptyList(), SourceElement.NO_SOURCE);
|
||||
Modality.OPEN, ClassKind.CLASS, Collections.<KotlinType>emptyList(), SourceElement.NO_SOURCE,
|
||||
/* isExternal = */ false
|
||||
);
|
||||
|
||||
ClassConstructorDescriptorImpl
|
||||
errorConstructor = ClassConstructorDescriptorImpl.create(this, Annotations.Companion.getEMPTY(), true, SourceElement.NO_SOURCE);
|
||||
@@ -367,7 +369,8 @@ public class ErrorUtils {
|
||||
/* lateInit = */ false,
|
||||
/* isConst = */ false,
|
||||
/* isPlatform = */ false,
|
||||
/* isImpl = */ false
|
||||
/* isImpl = */ false,
|
||||
/* isExternal = */ false
|
||||
);
|
||||
descriptor.setType(ERROR_PROPERTY_TYPE,
|
||||
Collections.<TypeParameterDescriptor>emptyList(),
|
||||
|
||||
@@ -35,6 +35,7 @@ public class Flags {
|
||||
public static final FlagField<ProtoBuf.Class.Kind> CLASS_KIND = FlagField.after(MODALITY, ProtoBuf.Class.Kind.values());
|
||||
public static final BooleanFlagField IS_INNER = FlagField.booleanAfter(CLASS_KIND);
|
||||
public static final BooleanFlagField IS_DATA = FlagField.booleanAfter(IS_INNER);
|
||||
public static final BooleanFlagField IS_EXTERNAL_CLASS = FlagField.booleanAfter(IS_DATA);
|
||||
|
||||
// Constructors
|
||||
|
||||
@@ -61,6 +62,7 @@ public class Flags {
|
||||
public static final BooleanFlagField IS_CONST = FlagField.booleanAfter(HAS_SETTER);
|
||||
public static final BooleanFlagField IS_LATEINIT = FlagField.booleanAfter(IS_CONST);
|
||||
public static final BooleanFlagField HAS_CONSTANT = FlagField.booleanAfter(IS_LATEINIT);
|
||||
public static final BooleanFlagField IS_EXTERNAL_PROPERTY = FlagField.booleanAfter(HAS_CONSTANT);
|
||||
|
||||
// Parameters
|
||||
|
||||
|
||||
+1
@@ -46,6 +46,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
Deserialization.memberKind(Flags.MEMBER_KIND.get(flags)),
|
||||
Flags.IS_LATEINIT.get(flags),
|
||||
Flags.IS_CONST.get(flags),
|
||||
Flags.IS_EXTERNAL_PROPERTY.get(flags),
|
||||
proto,
|
||||
c.nameResolver,
|
||||
c.typeTable,
|
||||
|
||||
+2
-1
@@ -86,7 +86,7 @@ class NotFoundClasses(private val storageManager: StorageManager, private val mo
|
||||
name: Name,
|
||||
private val isInner: Boolean,
|
||||
numberOfDeclaredTypeParameters: Int
|
||||
) : ClassDescriptorBase(storageManager, container, name, SourceElement.NO_SOURCE) {
|
||||
) : ClassDescriptorBase(storageManager, container, name, SourceElement.NO_SOURCE, /* isExternal = */ false) {
|
||||
private val typeParameters = createTypeParameters(this, numberOfDeclaredTypeParameters)
|
||||
|
||||
private val typeConstructor = ClassTypeConstructorImpl(this, /* isFinal = */ true, typeParameters, setOf(module.builtIns.anyType))
|
||||
@@ -102,6 +102,7 @@ class NotFoundClasses(private val storageManager: StorageManager, private val mo
|
||||
override fun isData() = false
|
||||
override fun isPlatform() = false
|
||||
override fun isImpl() = false
|
||||
override fun isExternal() = false
|
||||
override val annotations: Annotations get() = Annotations.EMPTY
|
||||
|
||||
override fun getUnsubstitutedMemberScope() = MemberScope.Empty
|
||||
|
||||
+2
@@ -99,6 +99,8 @@ class DeserializedClassDescriptor(
|
||||
|
||||
override fun isImpl() = false
|
||||
|
||||
override fun isExternal() = Flags.IS_EXTERNAL_CLASS.get(classProto.flags)
|
||||
|
||||
override fun getUnsubstitutedMemberScope(): MemberScope = memberScope
|
||||
|
||||
override fun getStaticScope() = staticScope
|
||||
|
||||
+7
-2
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.impl.*
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.protobuf.MessageLite
|
||||
import org.jetbrains.kotlin.serialization.Flags
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
|
||||
import org.jetbrains.kotlin.serialization.deserialization.TypeTable
|
||||
@@ -87,13 +88,15 @@ class DeserializedPropertyDescriptor(
|
||||
kind: CallableMemberDescriptor.Kind,
|
||||
isLateInit: Boolean,
|
||||
isConst: Boolean,
|
||||
isExternal: Boolean,
|
||||
override val proto: ProtoBuf.Property,
|
||||
override val nameResolver: NameResolver,
|
||||
override val typeTable: TypeTable,
|
||||
override val containerSource: DeserializedContainerSource?
|
||||
) : DeserializedCallableMemberDescriptor,
|
||||
PropertyDescriptorImpl(containingDeclaration, original, annotations,
|
||||
modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE, isLateInit, isConst, false, false) {
|
||||
modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE, isLateInit, isConst, false, false,
|
||||
isExternal) {
|
||||
|
||||
override fun createSubstitutedCopy(
|
||||
newOwner: DeclarationDescriptor,
|
||||
@@ -103,10 +106,12 @@ class DeserializedPropertyDescriptor(
|
||||
kind: CallableMemberDescriptor.Kind
|
||||
): PropertyDescriptorImpl {
|
||||
return DeserializedPropertyDescriptor(
|
||||
newOwner, original, annotations, newModality, newVisibility, isVar, name, kind, isLateInit, isConst,
|
||||
newOwner, original, annotations, newModality, newVisibility, isVar, name, kind, isLateInit, isConst, isExternal,
|
||||
proto, nameResolver, typeTable, containerSource
|
||||
)
|
||||
}
|
||||
|
||||
override fun isExternal() = Flags.IS_EXTERNAL_PROPERTY.get(proto.flags)
|
||||
}
|
||||
|
||||
class DeserializedClassConstructorDescriptor(
|
||||
|
||||
+5
-1
@@ -101,7 +101,11 @@ private fun genProperty(
|
||||
Name.identifier(id.name),
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED,
|
||||
sourceElement,
|
||||
false, false, false, false
|
||||
/* lateinit = */ false,
|
||||
/* isConst = */ false,
|
||||
/* isPlatform = */ false,
|
||||
/* isImpl = */ false,
|
||||
/* isExternal = */ false
|
||||
) {
|
||||
override val errorType = errorType
|
||||
override val cacheView = cacheView
|
||||
|
||||
Reference in New Issue
Block a user