Initial implementation of usage search for get/set methods in form of synthetic extension

This commit is contained in:
Valentin Kipyatkov
2015-07-09 18:22:22 +03:00
parent 73dd4a214e
commit 13f0d3ca23
13 changed files with 68 additions and 44 deletions
@@ -39,6 +39,17 @@ import java.util.*
interface SyntheticExtensionPropertyDescriptor : PropertyDescriptor {
val getMethod: FunctionDescriptor
val setMethod: FunctionDescriptor?
companion object {
fun findByGetterOrSetter(getterOrSetter: FunctionDescriptor, resolutionScope: JetScope): SyntheticExtensionPropertyDescriptor? {
val owner = getterOrSetter.getContainingDeclaration()
if (owner !is JavaClassDescriptor) return null
return resolutionScope.getSyntheticExtensionProperties(owner.getDefaultType())
.filterIsInstance<SyntheticExtensionPropertyDescriptor>()
.firstOrNull { getterOrSetter == it.getMethod || getterOrSetter == it.setMethod }
}
}
}
class AdditionalScopesWithSyntheticExtensions(storageManager: StorageManager) : FileScopeProvider.AdditionalScopes() {