This commit is contained in:
Valentin Kipyatkov
2015-10-25 12:03:29 +03:00
parent e1b8b21abb
commit 5f06f53bfd
45 changed files with 187 additions and 193 deletions
@@ -56,7 +56,7 @@ interface SyntheticJavaPropertyDescriptor : PropertyDescriptor {
val owner = getterOrSetter.getContainingDeclaration() as? ClassDescriptor ?: return null
val originalGetterOrSetter = getterOrSetter.original
return resolutionScope.collectAllFromImportingScopes { it.getSyntheticExtensionProperties(listOf(owner.defaultType)) }
return resolutionScope.collectAllFromImportingScopes { it.getContributedSyntheticExtensionProperties(listOf(owner.defaultType)) }
.filterIsInstance<SyntheticJavaPropertyDescriptor>()
.firstOrNull { originalGetterOrSetter == it.getMethod || originalGetterOrSetter == it.setMethod }
}
@@ -130,7 +130,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager) : ImportingSc
return null
}
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<PropertyDescriptor> {
override fun getContributedSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<PropertyDescriptor> {
//TODO: use location parameter!
var result: SmartList<PropertyDescriptor>? = null
@@ -162,7 +162,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager) : ImportingSc
return result
}
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor> {
override fun getContributedSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor> {
val result = ArrayList<PropertyDescriptor>()
val processedTypes = HashSet<TypeConstructor>()
receiverTypes.forEach { result.collectSyntheticProperties(it.constructor, processedTypes) }
@@ -53,7 +53,7 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : ImportingScope
return MyFunctionDescriptor.create(enhancedFunction)
}
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
override fun getContributedSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
var result: SmartList<FunctionDescriptor>? = null
for (type in receiverTypes) {
for (function in type.memberScope.getFunctions(name, location)) {
@@ -73,7 +73,7 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : ImportingScope
}
}
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor> {
override fun getContributedSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor> {
return receiverTypes.flatMapTo(LinkedHashSet<FunctionDescriptor>()) { type ->
type.memberScope.getDescriptors(DescriptorKindFilter.FUNCTIONS)
.filterIsInstance<FunctionDescriptor>()