Add external property to class and property descriptors

This commit is contained in:
Alexey Andreev
2016-11-24 19:37:13 +03:00
parent 43948a0170
commit ba2443bcb3
42 changed files with 120 additions and 47 deletions
@@ -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(
@@ -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)
}