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
@@ -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
}
}