From 4136fd1dbbf7c5946609e1a171b68022325073fc Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 26 Oct 2018 18:47:23 +0200 Subject: [PATCH] Minor, remove unused parameter of LazyImportResolver.collectFromImports --- .../kotlin/resolve/lazy/LazyImportScope.kt | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt index 32999c15133..0fa3fa0937c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt @@ -99,20 +99,16 @@ open class LazyImportResolver( } } - fun collectFromImports( - name: Name, - descriptorsSelector: (ImportingScope, Name) -> Collection - ): Collection { - return components.storageManager.compute { + fun collectFromImports(name: Name, descriptorsSelector: (ImportingScope) -> Collection): Collection = + components.storageManager.compute { var descriptors: Collection? = null for (directive in indexedImports.importsForName(name)) { - val descriptorsForImport = descriptorsSelector(getImportScope(directive), name) + val descriptorsForImport = descriptorsSelector(getImportScope(directive)) descriptors = descriptors.concat(descriptorsForImport) } - descriptors ?: emptySet() + descriptors.orEmpty() } - } fun getImportScope(directive: KtImportInfo): ImportingScope { return importedScopesProvider(directive) ?: ImportingScope.Empty @@ -257,15 +253,15 @@ class LazyImportScope( override fun getContributedVariables(name: Name, location: LookupLocation): Collection { if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf() - return importResolver.collectFromImports(name) { scope, _ -> scope.getContributedVariables(name, location) }.ifEmpty { - secondaryImportResolver?.collectFromImports(name) { scope, _ -> scope.getContributedVariables(name, location) }.orEmpty() + return importResolver.collectFromImports(name) { scope -> scope.getContributedVariables(name, location) }.ifEmpty { + secondaryImportResolver?.collectFromImports(name) { scope -> scope.getContributedVariables(name, location) }.orEmpty() } } override fun getContributedFunctions(name: Name, location: LookupLocation): Collection { if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf() - return importResolver.collectFromImports(name) { scope, _ -> scope.getContributedFunctions(name, location) }.ifEmpty { - secondaryImportResolver?.collectFromImports(name) { scope, _ -> scope.getContributedFunctions(name, location) }.orEmpty() + return importResolver.collectFromImports(name) { scope -> scope.getContributedFunctions(name, location) }.ifEmpty { + secondaryImportResolver?.collectFromImports(name) { scope -> scope.getContributedFunctions(name, location) }.orEmpty() } }