Special classes (for Any and Nothing) introduced to Lazy Resolve
This commit is contained in:
@@ -24,6 +24,7 @@ import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
|||||||
import org.jetbrains.jet.lang.psi.*;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
import org.jetbrains.jet.lang.resolve.AnnotationResolver;
|
import org.jetbrains.jet.lang.resolve.AnnotationResolver;
|
||||||
import org.jetbrains.jet.lang.resolve.DescriptorResolver;
|
import org.jetbrains.jet.lang.resolve.DescriptorResolver;
|
||||||
|
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.lazy.data.FilteringClassLikeInfo;
|
import org.jetbrains.jet.lang.resolve.lazy.data.FilteringClassLikeInfo;
|
||||||
import org.jetbrains.jet.lang.resolve.lazy.data.JetClassInfoUtil;
|
import org.jetbrains.jet.lang.resolve.lazy.data.JetClassInfoUtil;
|
||||||
import org.jetbrains.jet.lang.resolve.lazy.data.JetClassLikeInfo;
|
import org.jetbrains.jet.lang.resolve.lazy.data.JetClassLikeInfo;
|
||||||
@@ -275,15 +276,20 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
|||||||
@Override
|
@Override
|
||||||
public Collection<? extends JetType> getSupertypes() {
|
public Collection<? extends JetType> getSupertypes() {
|
||||||
if (supertypes == null) {
|
if (supertypes == null) {
|
||||||
JetClassOrObject classOrObject = declarationProvider.getOwnerInfo().getCorrespondingClassOrObject();
|
if (resolveSession.isClassSpecial(DescriptorUtils.getFQName(LazyClassDescriptor.this))) {
|
||||||
if (classOrObject == null) {
|
|
||||||
this.supertypes = Collections.emptyList();
|
this.supertypes = Collections.emptyList();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.supertypes = resolveSession.getInjector().getDescriptorResolver()
|
JetClassOrObject classOrObject = declarationProvider.getOwnerInfo().getCorrespondingClassOrObject();
|
||||||
.resolveSupertypes(getScopeForClassHeaderResolution(),
|
if (classOrObject == null) {
|
||||||
classOrObject,
|
this.supertypes = Collections.emptyList();
|
||||||
resolveSession.getTrace());
|
}
|
||||||
|
else {
|
||||||
|
this.supertypes = resolveSession.getInjector().getDescriptorResolver()
|
||||||
|
.resolveSupertypes(getScopeForClassHeaderResolution(),
|
||||||
|
classOrObject,
|
||||||
|
resolveSession.getTrace());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return supertypes;
|
return supertypes;
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.resolve.lazy;
|
package org.jetbrains.jet.lang.resolve.lazy;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
@@ -49,17 +51,32 @@ public class ResolveSession {
|
|||||||
private final BindingTrace trace = new BindingTraceContext();
|
private final BindingTrace trace = new BindingTraceContext();
|
||||||
private final DeclarationProviderFactory declarationProviderFactory;
|
private final DeclarationProviderFactory declarationProviderFactory;
|
||||||
|
|
||||||
|
private final Predicate<FqNameUnsafe> specialClasses;
|
||||||
|
|
||||||
|
|
||||||
private final InjectorForLazyResolve injector;
|
private final InjectorForLazyResolve injector;
|
||||||
private final ModuleConfiguration moduleConfiguration;
|
private final ModuleConfiguration moduleConfiguration;
|
||||||
|
|
||||||
private final Map<JetEnumEntry, ClassDescriptor> enumEntryClassDescriptorCache = Maps.newHashMap();
|
private final Map<JetEnumEntry, ClassDescriptor> enumEntryClassDescriptorCache = Maps.newHashMap();
|
||||||
|
|
||||||
|
public ResolveSession(
|
||||||
|
@NotNull Project project,
|
||||||
|
@NotNull ModuleDescriptor rootDescriptor,
|
||||||
|
@NotNull ModuleConfiguration moduleConfiguration,
|
||||||
|
@NotNull DeclarationProviderFactory declarationProviderFactory
|
||||||
|
) {
|
||||||
|
this(project, rootDescriptor, moduleConfiguration, declarationProviderFactory, Predicates.<FqNameUnsafe>alwaysFalse());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated // Internal use only
|
||||||
public ResolveSession(
|
public ResolveSession(
|
||||||
@NotNull Project project,
|
@NotNull Project project,
|
||||||
@NotNull ModuleDescriptor rootDescriptor,
|
@NotNull ModuleDescriptor rootDescriptor,
|
||||||
@NotNull ModuleConfiguration moduleConfiguration,
|
@NotNull ModuleConfiguration moduleConfiguration,
|
||||||
@NotNull DeclarationProviderFactory declarationProviderFactory
|
@NotNull DeclarationProviderFactory declarationProviderFactory,
|
||||||
|
@NotNull Predicate<FqNameUnsafe> specialClasses
|
||||||
) {
|
) {
|
||||||
|
this.specialClasses = specialClasses;
|
||||||
this.injector = new InjectorForLazyResolve(project, this, trace);
|
this.injector = new InjectorForLazyResolve(project, this, trace);
|
||||||
this.module = rootDescriptor;
|
this.module = rootDescriptor;
|
||||||
this.moduleConfiguration = moduleConfiguration;
|
this.moduleConfiguration = moduleConfiguration;
|
||||||
@@ -76,6 +93,10 @@ public class ResolveSession {
|
|||||||
return injector;
|
return injector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*package*/ boolean isClassSpecial(@NotNull FqNameUnsafe fqName) {
|
||||||
|
return specialClasses.apply(fqName);
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ModuleConfiguration getModuleConfiguration() {
|
public ModuleConfiguration getModuleConfiguration() {
|
||||||
return moduleConfiguration;
|
return moduleConfiguration;
|
||||||
|
|||||||
Reference in New Issue
Block a user