FIR IDE: do not use FE1.0 compiler jars in frontend-independent-modules

This commit is contained in:
Ilya Kirillov
2021-09-12 19:18:24 +02:00
parent da962895a8
commit a8d321db63
5 changed files with 42 additions and 23 deletions
@@ -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.
*/
@@ -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
}
}
@@ -75,11 +75,8 @@ interface SyntheticJavaPropertyDescriptor : PropertyDescriptor, SyntheticPropert
.firstOrNull { originalGetterOrSetter == it.getMethod || originalGetterOrSetter == it.setMethod }
}
fun propertyNamesByAccessorName(name: Name): List<Name> = listOfNotNull(
propertyNameByGetMethodName(name),
propertyNameBySetMethodName(name, withIsPrefix = true),
propertyNameBySetMethodName(name, withIsPrefix = false)
)
fun propertyNamesByAccessorName(name: Name): List<Name> =
org.jetbrains.kotlin.load.java.propertyNamesByAccessorName(name)
fun findByGetterOrSetter(getterOrSetter: FunctionDescriptor, syntheticScope: SyntheticScope) =
findByGetterOrSetter(getterOrSetter,
@@ -28,25 +28,11 @@ import org.jetbrains.kotlin.util.OperatorNameConventions
object DataClassDescriptorResolver {
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 = 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 isComponentLike(name: Name): Boolean = DataClassResolver.isComponentLike(name)
fun createComponentFunctionDescriptor(
parameterIndex: Int,
@@ -18,6 +18,12 @@ fun propertyNameBySetMethodName(methodName: Name, withIsPrefix: Boolean): Name?
fun propertyNamesBySetMethodName(methodName: Name): List<Name> =
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(
methodName: Name,
prefix: String,