Minor, remove unused stuff from MutableClassDescriptor
This commit is contained in:
+3
-53
@@ -20,9 +20,7 @@ import com.google.common.collect.Sets;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.descriptors.*;
|
import org.jetbrains.kotlin.descriptors.*;
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
|
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationsImpl;
|
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.*;
|
import org.jetbrains.kotlin.resolve.scopes.*;
|
||||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||||
@@ -37,20 +35,16 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
|
|||||||
private final ClassKind kind;
|
private final ClassKind kind;
|
||||||
private final boolean isInner;
|
private final boolean isInner;
|
||||||
|
|
||||||
private Annotations annotations;
|
|
||||||
private Modality modality;
|
private Modality modality;
|
||||||
private Visibility visibility;
|
private Visibility visibility;
|
||||||
private TypeConstructor typeConstructor;
|
private TypeConstructor typeConstructor;
|
||||||
private List<TypeParameterDescriptor> typeParameters;
|
private List<TypeParameterDescriptor> typeParameters;
|
||||||
private Collection<JetType> supertypes = new ArrayList<JetType>();
|
private Collection<JetType> supertypes = new ArrayList<JetType>();
|
||||||
|
|
||||||
private MutableClassDescriptor companionObjectDescriptor;
|
|
||||||
|
|
||||||
private final Set<ConstructorDescriptor> constructors = Sets.newLinkedHashSet();
|
private final Set<ConstructorDescriptor> constructors = Sets.newLinkedHashSet();
|
||||||
private ConstructorDescriptor primaryConstructor;
|
private ConstructorDescriptor primaryConstructor;
|
||||||
|
|
||||||
private final Set<CallableMemberDescriptor> declaredCallableMembers = Sets.newLinkedHashSet();
|
private final Set<CallableMemberDescriptor> declaredCallableMembers = Sets.newLinkedHashSet();
|
||||||
private final Set<CallableMemberDescriptor> allCallableMembers = Sets.newLinkedHashSet(); // includes fake overrides
|
|
||||||
private final Set<PropertyDescriptor> properties = Sets.newLinkedHashSet();
|
private final Set<PropertyDescriptor> properties = Sets.newLinkedHashSet();
|
||||||
private final Set<SimpleFunctionDescriptor> functions = Sets.newLinkedHashSet();
|
private final Set<SimpleFunctionDescriptor> functions = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
@@ -95,28 +89,13 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public MutableClassDescriptor getCompanionObjectDescriptor() {
|
public MutableClassDescriptor getCompanionObjectDescriptor() {
|
||||||
return companionObjectDescriptor;
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
public void setCompanionObjectDescriptor(@NotNull MutableClassDescriptor classObjectDescriptor) {
|
|
||||||
assert this.companionObjectDescriptor == null : "classObjectDescriptor already assigned in " + this;
|
|
||||||
this.companionObjectDescriptor = classObjectDescriptor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Annotations getAnnotations() {
|
public Annotations getAnnotations() {
|
||||||
if (annotations == null) {
|
return Annotations.EMPTY;
|
||||||
annotations = new AnnotationsImpl(new ArrayList<AnnotationDescriptor>(0));
|
|
||||||
}
|
|
||||||
return annotations;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addAnnotations(@NotNull Iterable<AnnotationDescriptor> annotationsToAdd) {
|
|
||||||
List<AnnotationDescriptor> annotations = ((AnnotationsImpl) getAnnotations()).getAnnotationDescriptors();
|
|
||||||
for (AnnotationDescriptor annotationDescriptor : annotationsToAdd) {
|
|
||||||
annotations.add(annotationDescriptor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModality(@NotNull Modality modality) {
|
public void setModality(@NotNull Modality modality) {
|
||||||
@@ -152,7 +131,6 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCompanionObject() {
|
public boolean isCompanionObject() {
|
||||||
//TODO:
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,13 +175,6 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addConstructorParametersToInitializersScope(@NotNull Collection<? extends VariableDescriptor> variables) {
|
|
||||||
WritableScope scope = getWritableScopeForInitializers();
|
|
||||||
for (VariableDescriptor variable : variables) {
|
|
||||||
scope.addVariableDescriptor(variable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<ConstructorDescriptor> getConstructors() {
|
public Set<ConstructorDescriptor> getConstructors() {
|
||||||
@@ -232,11 +203,6 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
|
|||||||
return declaredCallableMembers;
|
return declaredCallableMembers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public Set<CallableMemberDescriptor> getAllCallableMembers() {
|
|
||||||
return allCallableMembers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTypeParameterDescriptors(@NotNull List<TypeParameterDescriptor> typeParameters) {
|
public void setTypeParameterDescriptors(@NotNull List<TypeParameterDescriptor> typeParameters) {
|
||||||
if (this.typeParameters != null) {
|
if (this.typeParameters != null) {
|
||||||
throw new IllegalStateException("Type parameters are already set for " + getName());
|
throw new IllegalStateException("Type parameters are already set for " + getName());
|
||||||
@@ -252,7 +218,7 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
|
|||||||
assert typeConstructor == null : typeConstructor;
|
assert typeConstructor == null : typeConstructor;
|
||||||
this.typeConstructor = TypeConstructorImpl.createForClass(
|
this.typeConstructor = TypeConstructorImpl.createForClass(
|
||||||
this,
|
this,
|
||||||
Annotations.EMPTY, // TODO : pass annotations from the class?
|
Annotations.EMPTY,
|
||||||
!getModality().isOverridable(),
|
!getModality().isOverridable(),
|
||||||
getName().asString(),
|
getName().asString(),
|
||||||
typeParameters,
|
typeParameters,
|
||||||
@@ -305,28 +271,12 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
|
|||||||
return scopeForMemberLookup;
|
return scopeForMemberLookup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private WritableScope getScopeForMemberLookupAsWritableScope() {
|
|
||||||
// hack
|
|
||||||
return (WritableScope) scopeForMemberLookup;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public JetScope getStaticScope() {
|
public JetScope getStaticScope() {
|
||||||
return staticScope;
|
return staticScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void lockScopes() {
|
|
||||||
getScopeForMemberLookupAsWritableScope().changeLockLevel(WritableScope.LockLevel.READING);
|
|
||||||
if (companionObjectDescriptor != null) {
|
|
||||||
companionObjectDescriptor.lockScopes();
|
|
||||||
}
|
|
||||||
scopeForSupertypeResolution.changeLockLevel(WritableScope.LockLevel.READING);
|
|
||||||
scopeForMemberResolution.changeLockLevel(WritableScope.LockLevel.READING);
|
|
||||||
getWritableScopeForInitializers().changeLockLevel(WritableScope.LockLevel.READING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return DeclarationDescriptorImpl.toString(this);
|
return DeclarationDescriptorImpl.toString(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user