FIR IDE: do not use FE1.0 compiler jars in frontend-independent-modules
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.resolve
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
|
object DataClassResolver {
|
||||||
|
private const val COMPONENT_FUNCTION_NAME_PREFIX = "component"
|
||||||
|
|
||||||
|
fun createComponentName(index: Int): Name = Name.identifier(COMPONENT_FUNCTION_NAME_PREFIX + index)
|
||||||
|
|
||||||
|
fun getComponentIndex(componentName: String): Int = componentName.substring(COMPONENT_FUNCTION_NAME_PREFIX.length).toInt()
|
||||||
|
|
||||||
|
fun isComponentLike(name: Name): Boolean = isComponentLike(name.asString())
|
||||||
|
|
||||||
|
private fun isComponentLike(name: String): Boolean {
|
||||||
|
if (!name.startsWith(COMPONENT_FUNCTION_NAME_PREFIX)) return false
|
||||||
|
|
||||||
|
try {
|
||||||
|
getComponentIndex(name)
|
||||||
|
} catch (e: NumberFormatException) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-5
@@ -75,11 +75,8 @@ interface SyntheticJavaPropertyDescriptor : PropertyDescriptor, SyntheticPropert
|
|||||||
.firstOrNull { originalGetterOrSetter == it.getMethod || originalGetterOrSetter == it.setMethod }
|
.firstOrNull { originalGetterOrSetter == it.getMethod || originalGetterOrSetter == it.setMethod }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun propertyNamesByAccessorName(name: Name): List<Name> = listOfNotNull(
|
fun propertyNamesByAccessorName(name: Name): List<Name> =
|
||||||
propertyNameByGetMethodName(name),
|
org.jetbrains.kotlin.load.java.propertyNamesByAccessorName(name)
|
||||||
propertyNameBySetMethodName(name, withIsPrefix = true),
|
|
||||||
propertyNameBySetMethodName(name, withIsPrefix = false)
|
|
||||||
)
|
|
||||||
|
|
||||||
fun findByGetterOrSetter(getterOrSetter: FunctionDescriptor, syntheticScope: SyntheticScope) =
|
fun findByGetterOrSetter(getterOrSetter: FunctionDescriptor, syntheticScope: SyntheticScope) =
|
||||||
findByGetterOrSetter(getterOrSetter,
|
findByGetterOrSetter(getterOrSetter,
|
||||||
|
|||||||
@@ -28,25 +28,11 @@ import org.jetbrains.kotlin.util.OperatorNameConventions
|
|||||||
object DataClassDescriptorResolver {
|
object DataClassDescriptorResolver {
|
||||||
val COPY_METHOD_NAME = Name.identifier("copy")
|
val COPY_METHOD_NAME = Name.identifier("copy")
|
||||||
|
|
||||||
private val COMPONENT_FUNCTION_NAME_PREFIX = "component"
|
fun createComponentName(index: Int): Name = DataClassResolver.createComponentName(index)
|
||||||
|
|
||||||
fun createComponentName(index: Int): Name = Name.identifier(COMPONENT_FUNCTION_NAME_PREFIX + index)
|
fun getComponentIndex(componentName: String): Int = DataClassResolver.getComponentIndex(componentName)
|
||||||
|
|
||||||
fun getComponentIndex(componentName: String): Int = componentName.substring(COMPONENT_FUNCTION_NAME_PREFIX.length).toInt()
|
fun isComponentLike(name: Name): Boolean = DataClassResolver.isComponentLike(name)
|
||||||
|
|
||||||
fun isComponentLike(name: Name): Boolean = isComponentLike(name.asString())
|
|
||||||
|
|
||||||
private fun isComponentLike(name: String): Boolean {
|
|
||||||
if (!name.startsWith(COMPONENT_FUNCTION_NAME_PREFIX)) return false
|
|
||||||
|
|
||||||
try {
|
|
||||||
getComponentIndex(name)
|
|
||||||
} catch (e: NumberFormatException) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
fun createComponentFunctionDescriptor(
|
fun createComponentFunctionDescriptor(
|
||||||
parameterIndex: Int,
|
parameterIndex: Int,
|
||||||
|
|||||||
+6
@@ -18,6 +18,12 @@ fun propertyNameBySetMethodName(methodName: Name, withIsPrefix: Boolean): Name?
|
|||||||
fun propertyNamesBySetMethodName(methodName: Name): List<Name> =
|
fun propertyNamesBySetMethodName(methodName: Name): List<Name> =
|
||||||
listOfNotNull(propertyNameBySetMethodName(methodName, false), propertyNameBySetMethodName(methodName, true))
|
listOfNotNull(propertyNameBySetMethodName(methodName, false), propertyNameBySetMethodName(methodName, true))
|
||||||
|
|
||||||
|
fun propertyNamesByAccessorName(name: Name): List<Name> = listOfNotNull(
|
||||||
|
propertyNameByGetMethodName(name),
|
||||||
|
propertyNameBySetMethodName(name, withIsPrefix = true),
|
||||||
|
propertyNameBySetMethodName(name, withIsPrefix = false)
|
||||||
|
)
|
||||||
|
|
||||||
private fun propertyNameFromAccessorMethodName(
|
private fun propertyNameFromAccessorMethodName(
|
||||||
methodName: Name,
|
methodName: Name,
|
||||||
prefix: String,
|
prefix: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user