Renamed methods
This commit is contained in:
+4
-4
@@ -124,7 +124,7 @@ class SyntheticExtensionsScope(storageManager: StorageManager) : JetScope by Jet
|
|||||||
if (classifier is JavaClassDescriptor) {
|
if (classifier is JavaClassDescriptor) {
|
||||||
for (descriptor in classifier.getMemberScope(type.getArguments()).getAllDescriptors()) {
|
for (descriptor in classifier.getMemberScope(type.getArguments()).getAllDescriptors()) {
|
||||||
if (descriptor is FunctionDescriptor) {
|
if (descriptor is FunctionDescriptor) {
|
||||||
val propertyName = fromGetMethodName(descriptor.getName()) ?: continue
|
val propertyName = propertyNameByGetMethodName(descriptor.getName()) ?: continue
|
||||||
addIfNotNull(syntheticPropertyInClass(Triple(classifier, type, propertyName)))
|
addIfNotNull(syntheticPropertyInClass(Triple(classifier, type, propertyName)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,11 +152,11 @@ class SyntheticExtensionsScope(storageManager: StorageManager) : JetScope by Jet
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
public fun fromGetMethodName(methodName: Name): Name? = fromAccessorMethodName(methodName, "get")
|
public fun propertyNameByGetMethodName(methodName: Name): Name? = propertyNameFromAccessorMethodName(methodName, "get")
|
||||||
|
|
||||||
public fun fromSetMethodName(methodName: Name): Name? = fromAccessorMethodName(methodName, "set")
|
public fun propertyNameBySetMethodName(methodName: Name): Name? = propertyNameFromAccessorMethodName(methodName, "set")
|
||||||
|
|
||||||
private fun fromAccessorMethodName(methodName: Name, prefix: String): Name? {
|
private fun propertyNameFromAccessorMethodName(methodName: Name, prefix: String): Name? {
|
||||||
if (methodName.isSpecial()) return null
|
if (methodName.isSpecial()) return null
|
||||||
val identifier = methodName.getIdentifier()
|
val identifier = methodName.getIdentifier()
|
||||||
if (!identifier.startsWith(prefix)) return null
|
if (!identifier.startsWith(prefix)) return null
|
||||||
|
|||||||
+3
-3
@@ -145,9 +145,9 @@ public class JetSimpleNameReference(
|
|||||||
if (Name.isValidIdentifier(newElementName)) {
|
if (Name.isValidIdentifier(newElementName)) {
|
||||||
val newNameAsName = Name.identifier(newElementName)
|
val newNameAsName = Name.identifier(newElementName)
|
||||||
val newName = when (access()) {
|
val newName = when (access()) {
|
||||||
Access.READ -> SyntheticExtensionsScope.fromGetMethodName(newNameAsName)
|
Access.READ -> SyntheticExtensionsScope.propertyNameByGetMethodName(newNameAsName)
|
||||||
Access.WRITE -> SyntheticExtensionsScope.fromSetMethodName(newNameAsName)
|
Access.WRITE -> SyntheticExtensionsScope.propertyNameBySetMethodName(newNameAsName)
|
||||||
Access.READ_WRITE -> SyntheticExtensionsScope.fromGetMethodName(newNameAsName) ?: SyntheticExtensionsScope.fromSetMethodName(newNameAsName)
|
Access.READ_WRITE -> SyntheticExtensionsScope.propertyNameByGetMethodName(newNameAsName) ?: SyntheticExtensionsScope.propertyNameBySetMethodName(newNameAsName)
|
||||||
} ?: return expression //TODO: handle the case when get/set becomes ordinary method
|
} ?: return expression //TODO: handle the case when get/set becomes ordinary method
|
||||||
newElementName = newName.getIdentifier()
|
newElementName = newName.getIdentifier()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user