Add platform/impl soft keywords, add isPlatform/isImpl to MemberDescriptor
This commit is contained in:
+3
-2
@@ -95,6 +95,9 @@ class LazyJavaClassDescriptor(
|
||||
|
||||
override fun isInner() = isInner
|
||||
override fun isData() = false
|
||||
override fun isCompanionObject() = false
|
||||
override fun isPlatform() = false
|
||||
override fun isImpl() = false
|
||||
|
||||
private val typeConstructor = c.storageManager.createLazyValue { LazyJavaClassTypeConstructor() }
|
||||
override fun getTypeConstructor(): TypeConstructor = typeConstructor()
|
||||
@@ -132,8 +135,6 @@ class LazyJavaClassDescriptor(
|
||||
|
||||
override fun getFunctionTypeForSamInterface(): SimpleType? = functionTypeForSamInterface()
|
||||
|
||||
override fun isCompanionObject() = false
|
||||
|
||||
override fun toString() = "Lazy Java class ${this.fqNameUnsafe}"
|
||||
|
||||
private inner class LazyJavaClassTypeConstructor : AbstractClassTypeConstructor(c.storageManager) {
|
||||
|
||||
+2
@@ -102,6 +102,8 @@ class FunctionClassDescriptor(
|
||||
override fun isCompanionObject() = false
|
||||
override fun isInner() = false
|
||||
override fun isData() = false
|
||||
override fun isPlatform() = false
|
||||
override fun isImpl() = false
|
||||
override val annotations: Annotations get() = Annotations.EMPTY
|
||||
override fun getSource() = SourceElement.NO_SOURCE
|
||||
|
||||
|
||||
@@ -25,4 +25,8 @@ public interface MemberDescriptor extends DeclarationDescriptorNonRoot, Declarat
|
||||
@Override
|
||||
@NotNull
|
||||
Visibility getVisibility();
|
||||
|
||||
boolean isPlatform();
|
||||
|
||||
boolean isImpl();
|
||||
}
|
||||
|
||||
+4
@@ -65,6 +65,10 @@ abstract class AbstractTypeAliasDescriptor(
|
||||
|
||||
override fun getVisibility() = visibilityImpl
|
||||
|
||||
override fun isPlatform(): Boolean = false
|
||||
|
||||
override fun isImpl(): Boolean = false
|
||||
|
||||
override fun getTypeConstructor(): TypeConstructor =
|
||||
typeConstructor
|
||||
|
||||
|
||||
@@ -113,6 +113,16 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlatform() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImpl() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassConstructorDescriptor getUnsubstitutedPrimaryConstructor() {
|
||||
return primaryConstructor;
|
||||
|
||||
+10
@@ -154,6 +154,16 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlatform() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImpl() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ClassConstructorDescriptor getUnsubstitutedPrimaryConstructor() {
|
||||
|
||||
+22
@@ -43,6 +43,8 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
private boolean isExternal = false;
|
||||
private boolean isInline = false;
|
||||
private boolean isTailrec = false;
|
||||
private boolean isPlatform = false;
|
||||
private boolean isImpl = false;
|
||||
// Difference between these hidden kinds:
|
||||
// 1. isHiddenToOvercomeSignatureClash prohibit calling such functions even in super-call context
|
||||
// 2. isHiddenForResolutionEverywhereBesideSupercalls propagates to it's overrides descriptors while isHiddenToOvercomeSignatureClash does not
|
||||
@@ -134,6 +136,14 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
this.isTailrec = isTailrec;
|
||||
}
|
||||
|
||||
public void setPlatform(boolean isPlatform) {
|
||||
this.isPlatform = isPlatform;
|
||||
}
|
||||
|
||||
public void setImpl(boolean isImpl) {
|
||||
this.isImpl = isImpl;
|
||||
}
|
||||
|
||||
public void setHiddenToOvercomeSignatureClash(boolean hiddenToOvercomeSignatureClash) {
|
||||
isHiddenToOvercomeSignatureClash = hiddenToOvercomeSignatureClash;
|
||||
}
|
||||
@@ -247,6 +257,16 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
return isSuspend;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlatform() {
|
||||
return isPlatform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImpl() {
|
||||
return isImpl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <V> V getUserData(UserDataKey<V> key) {
|
||||
if (userDataMap == null) return null;
|
||||
@@ -631,6 +651,8 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
substitutedDescriptor.setInline(isInline);
|
||||
substitutedDescriptor.setTailrec(isTailrec);
|
||||
substitutedDescriptor.setSuspend(isSuspend);
|
||||
substitutedDescriptor.setPlatform(isPlatform);
|
||||
substitutedDescriptor.setImpl(isImpl);
|
||||
substitutedDescriptor.setHasStableParameterNames(hasStableParameterNames);
|
||||
substitutedDescriptor.setHiddenToOvercomeSignatureClash(configuration.isHiddenToOvercomeSignatureClash);
|
||||
substitutedDescriptor.setHiddenForResolutionEverywhereBesideSupercalls(configuration.isHiddenForResolutionEverywhereBesideSupercalls);
|
||||
|
||||
+10
@@ -221,6 +221,16 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
|
||||
return original.isCompanionObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlatform() {
|
||||
return original.isPlatform();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImpl() {
|
||||
return original.isImpl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, D> R accept(DeclarationDescriptorVisitor<R, D> visitor, D data) {
|
||||
return visitor.visitClassDescriptor(this, data);
|
||||
|
||||
+10
@@ -102,6 +102,16 @@ public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescript
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlatform() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImpl() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FunctionDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
|
||||
+12
@@ -355,6 +355,18 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
return kind;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlatform() {
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImpl() {
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOverriddenDescriptors(@NotNull Collection<? extends CallableMemberDescriptor> overriddenDescriptors) {
|
||||
//noinspection unchecked
|
||||
|
||||
@@ -263,8 +263,9 @@ enum class DescriptorRendererModifier(val includeByDefault: Boolean) {
|
||||
ANNOTATIONS(false),
|
||||
INNER(true),
|
||||
MEMBER_KIND(true),
|
||||
DATA(true)
|
||||
|
||||
DATA(true),
|
||||
PLATFORM(true),
|
||||
IMPL(true),
|
||||
;
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -461,6 +461,20 @@ internal class DescriptorRendererImpl(
|
||||
builder.append(renderKeyword(keyword)).append(" ")
|
||||
}
|
||||
|
||||
private fun renderPlatform(isPlatform: Boolean, builder: StringBuilder) {
|
||||
if (DescriptorRendererModifier.PLATFORM !in modifiers) return
|
||||
if (isPlatform) {
|
||||
builder.append(renderKeyword("platform")).append(" ")
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderImpl(isImpl: Boolean, builder: StringBuilder) {
|
||||
if (DescriptorRendererModifier.IMPL !in modifiers) return
|
||||
if (isImpl) {
|
||||
builder.append(renderKeyword("impl")).append(" ")
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderInner(isInner: Boolean, builder: StringBuilder) {
|
||||
if (DescriptorRendererModifier.INNER !in modifiers) return
|
||||
if (isInner) {
|
||||
@@ -526,6 +540,12 @@ internal class DescriptorRendererImpl(
|
||||
if (functionDescriptor.isSuspend) {
|
||||
builder.append("suspend ")
|
||||
}
|
||||
if (functionDescriptor.isPlatform) {
|
||||
builder.append("platform ")
|
||||
}
|
||||
if (functionDescriptor.isImpl) {
|
||||
builder.append("impl ")
|
||||
}
|
||||
}
|
||||
|
||||
override fun render(declarationDescriptor: DeclarationDescriptor): String {
|
||||
@@ -882,6 +902,8 @@ internal class DescriptorRendererImpl(
|
||||
klass.kind.isSingleton && klass.modality == Modality.FINAL)) {
|
||||
renderModality(klass.modality, builder)
|
||||
}
|
||||
renderPlatform(klass.isPlatform, builder)
|
||||
renderImpl(klass.isImpl, builder)
|
||||
renderInner(klass.isInner, builder)
|
||||
renderData(klass.isData, builder)
|
||||
renderClassKindPrefix(klass, builder)
|
||||
|
||||
+2
@@ -100,6 +100,8 @@ class NotFoundClasses(private val storageManager: StorageManager, private val mo
|
||||
|
||||
override fun isCompanionObject() = false
|
||||
override fun isData() = false
|
||||
override fun isPlatform() = false
|
||||
override fun isImpl() = false
|
||||
override val annotations: Annotations get() = Annotations.EMPTY
|
||||
|
||||
override fun getUnsubstitutedMemberScope() = MemberScope.Empty
|
||||
|
||||
+4
@@ -95,6 +95,10 @@ class DeserializedClassDescriptor(
|
||||
|
||||
override fun isData() = Flags.IS_DATA.get(classProto.flags)
|
||||
|
||||
override fun isPlatform() = false
|
||||
|
||||
override fun isImpl() = false
|
||||
|
||||
override fun getUnsubstitutedMemberScope(): MemberScope = memberScope
|
||||
|
||||
override fun getStaticScope() = staticScope
|
||||
|
||||
Reference in New Issue
Block a user