use of kotlin.jvm.functions.Function1 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;
}
use of kotlin.jvm.functions.Function1 in project kotlin by JetBrains.
the class MavenPluginLogMessageCollector method throwKotlinCompilerException.
public void throwKotlinCompilerException() throws KotlinCompilationFailureException {
throw new KotlinCompilationFailureException(CollectionsKt.map(getCollectedErrors(), new Function1<Pair<CompilerMessageLocation, String>, CompilerMessage>() {
@Override
public CompilerMessage invoke(Pair<CompilerMessageLocation, String> pair) {
CompilerMessageLocation location = pair.getFirst();
String message = pair.getSecond();
String lineContent = location.getLineContent();
int lineContentLength = lineContent == null ? 0 : lineContent.length();
return new CompilerMessage(location.getPath(), CompilerMessage.Kind.ERROR, fixLocation(location.getLine()), fixLocation(location.getColumn()), fixLocation(location.getLine()), Math.min(fixLocation(location.getColumn()), lineContentLength), message);
}
}));
}
Aggregations