use of org.jetbrains.kotlin.resolve.lazy.declarations.PackageMemberDeclarationProvider in project kotlin by JetBrains.
the class ResolveSession method getTopLevelClassifierDescriptors.
@Override
@NotNull
@ReadOnly
public Collection<ClassifierDescriptor> getTopLevelClassifierDescriptors(@NotNull FqName fqName, @NotNull final LookupLocation location) {
if (fqName.isRoot())
return Collections.emptyList();
PackageMemberDeclarationProvider provider = declarationProviderFactory.getPackageMemberDeclarationProvider(fqName.parent());
if (provider == null)
return Collections.emptyList();
Collection<ClassifierDescriptor> result = new SmartList<ClassifierDescriptor>();
result.addAll(ContainerUtil.mapNotNull(provider.getClassOrObjectDeclarations(fqName.shortName()), new Function<KtClassLikeInfo, ClassifierDescriptor>() {
@Override
public ClassDescriptor fun(KtClassLikeInfo classLikeInfo) {
if (classLikeInfo instanceof KtClassOrObjectInfo) {
//noinspection RedundantCast
return getClassDescriptor(((KtClassOrObjectInfo) classLikeInfo).getCorrespondingClassOrObject(), location);
} else if (classLikeInfo instanceof KtScriptInfo) {
return getScriptDescriptor(((KtScriptInfo) classLikeInfo).getScript());
} else {
throw new IllegalStateException("Unexpected " + classLikeInfo + " of type " + classLikeInfo.getClass().getName());
}
}
}));
result.addAll(ContainerUtil.map(provider.getTypeAliasDeclarations(fqName.shortName()), new Function<KtTypeAlias, ClassifierDescriptor>() {
@Override
public ClassifierDescriptor fun(KtTypeAlias alias) {
return (ClassifierDescriptor) lazyDeclarationResolver.resolveToDescriptor(alias);
}
}));
return result;
}
Aggregations