Minor: refactoring
This commit is contained in:
+7
-6
@@ -54,18 +54,19 @@ interface SyntheticJavaPropertyDescriptor : PropertyDescriptor {
|
|||||||
val identifier = name.identifier
|
val identifier = name.identifier
|
||||||
if (!identifier.startsWith("get") && !identifier.startsWith("is") && !identifier.startsWith("set")) return null // optimization
|
if (!identifier.startsWith("get") && !identifier.startsWith("is") && !identifier.startsWith("set")) return null // optimization
|
||||||
|
|
||||||
val owner = getterOrSetter.containingDeclaration as? ClassDescriptor ?: return null
|
val classDescriptorOwner = getterOrSetter.containingDeclaration as? ClassDescriptor ?: return null
|
||||||
|
|
||||||
val originalGetterOrSetter = getterOrSetter.original
|
val originalGetterOrSetter = getterOrSetter.original
|
||||||
return syntheticScopes.collectSyntheticExtensionProperties(listOf(owner.defaultType))
|
return syntheticScopes.collectSyntheticExtensionProperties(listOf(classDescriptorOwner.defaultType))
|
||||||
.filterIsInstance<SyntheticJavaPropertyDescriptor>()
|
.filterIsInstance<SyntheticJavaPropertyDescriptor>()
|
||||||
.firstOrNull { originalGetterOrSetter == it.getMethod || originalGetterOrSetter == it.setMethod }
|
.firstOrNull { originalGetterOrSetter == it.getMethod || originalGetterOrSetter == it.setMethod }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findByGetterOrSetter(getterOrSetter: FunctionDescriptor, syntheticScope: SyntheticScope)
|
fun findByGetterOrSetter(getterOrSetter: FunctionDescriptor, syntheticScope: SyntheticScope) =
|
||||||
= findByGetterOrSetter(getterOrSetter, object : SyntheticScopes {
|
findByGetterOrSetter(getterOrSetter,
|
||||||
override val scopes: Collection<SyntheticScope> = listOf(syntheticScope)
|
object : SyntheticScopes {
|
||||||
})
|
override val scopes: Collection<SyntheticScope> = listOf(syntheticScope)
|
||||||
|
})
|
||||||
|
|
||||||
fun propertyNameByGetMethodName(methodName: Name): Name?
|
fun propertyNameByGetMethodName(methodName: Name): Name?
|
||||||
= org.jetbrains.kotlin.load.java.propertyNameByGetMethodName(methodName)
|
= org.jetbrains.kotlin.load.java.propertyNameByGetMethodName(methodName)
|
||||||
|
|||||||
Reference in New Issue
Block a user