use of org.jetbrains.kotlin.resolve.scopes.ChainedMemberScope in project kotlin by JetBrains.
the class KotlinBuiltIns method createPackage.
@NotNull
private PackageFragmentDescriptor createPackage(@NotNull PackageFragmentProvider fragmentProvider, @Nullable Map<FqName, PackageFragmentDescriptor> packageNameToPackageFragment, @NotNull final FqName packageFqName) {
final List<PackageFragmentDescriptor> packageFragments = fragmentProvider.getPackageFragments(packageFqName);
PackageFragmentDescriptor result = packageFragments.isEmpty() ? new EmptyPackageFragmentDescriptor(builtInsModule, packageFqName) : packageFragments.size() == 1 ? packageFragments.iterator().next() : new PackageFragmentDescriptorImpl(builtInsModule, packageFqName) {
@NotNull
@Override
public MemberScope getMemberScope() {
return new ChainedMemberScope("built-in package " + packageFqName, CollectionsKt.map(packageFragments, new Function1<PackageFragmentDescriptor, MemberScope>() {
@Override
public MemberScope invoke(PackageFragmentDescriptor descriptor) {
return descriptor.getMemberScope();
}
}));
}
};
if (packageNameToPackageFragment != null)
packageNameToPackageFragment.put(packageFqName, result);
return result;
}
Aggregations