Pass LanguageVersionSettings instance to isHiddenInResolution

Unused at the moment, will be used later to check if the API version prohibits
the usage of the element
This commit is contained in:
Alexander Udalov
2016-09-19 14:35:02 +03:00
parent 59b29cf00d
commit 6e0e8c6dc3
7 changed files with 32 additions and 18 deletions
@@ -16,11 +16,18 @@
package org.jetbrains.kotlin.synthetic
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.resolve.scopes.SyntheticScopes
import org.jetbrains.kotlin.storage.StorageManager
class JavaSyntheticScopes(storageManager: StorageManager, lookupTracker: LookupTracker): SyntheticScopes {
override val scopes = listOf(JavaSyntheticPropertiesScope(storageManager, lookupTracker), SamAdapterFunctionsScope(storageManager))
class JavaSyntheticScopes(
storageManager: StorageManager,
lookupTracker: LookupTracker,
languageVersionSettings: LanguageVersionSettings
): SyntheticScopes {
override val scopes = listOf(
JavaSyntheticPropertiesScope(storageManager, lookupTracker),
SamAdapterFunctionsScope(storageManager, languageVersionSettings)
)
}
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.synthetic
import com.intellij.util.SmartList
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
@@ -38,7 +39,10 @@ interface SamAdapterExtensionFunctionDescriptor : FunctionDescriptor, SyntheticM
override val baseDescriptorForSynthetic: FunctionDescriptor
}
class SamAdapterFunctionsScope(storageManager: StorageManager) : SyntheticScope {
class SamAdapterFunctionsScope(
storageManager: StorageManager,
private val languageVersionSettings: LanguageVersionSettings
) : SyntheticScope {
private val extensionForFunction = storageManager.createMemoizedFunctionWithNullableValues<FunctionDescriptor, FunctionDescriptor> { function ->
extensionForFunctionNotCached(function)
}
@@ -48,7 +52,7 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : SyntheticScope
if (!function.hasJavaOriginInHierarchy()) return null //TODO: should we go into base at all?
if (!SingleAbstractMethodUtils.isSamAdapterNecessary(function)) return null
if (function.returnType == null) return null
if (function.isHiddenInResolution()) return null
if (function.isHiddenInResolution(languageVersionSettings)) return null
return MyFunctionDescriptor.create(function)
}