[FIR] KTIJ-24156: Add test data

This commit is contained in:
aleksandrina-streltsova
2023-01-09 13:26:13 +02:00
committed by Space Team
parent af414cfb5e
commit 3a6e3290aa
9 changed files with 65 additions and 2 deletions
@@ -50,6 +50,13 @@ sealed class SymbolData {
}
}
data class TypeAliasData(val classId: ClassId) : SymbolData() {
override fun KtAnalysisSession.toSymbols(): List<KtSymbol> {
val symbol = getTypeAliasByClassId(classId) ?: error("Type alias $classId is not found")
return listOf(symbol)
}
}
data class CallableData(val callableId: CallableId) : SymbolData() {
override fun KtAnalysisSession.toSymbols(): List<KtSymbol> {
val classId = callableId.classId
@@ -71,10 +78,11 @@ sealed class SymbolData {
}
companion object {
val identifiers = arrayOf("callable:", "class:")
val identifiers = arrayOf("callable:", "class:", "typealias:")
fun create(data: String): SymbolData = when {
data.startsWith("class:") -> ClassData(ClassId.fromString(data.removePrefix("class:").trim()))
data.startsWith("typealias:") -> TypeAliasData(ClassId.fromString(data.removePrefix("typealias:").trim()))
data.startsWith("callable:") -> {
val fullName = data.removePrefix("callable:").trim()
val name = if ('.' in fullName) fullName.substringAfterLast(".") else fullName.substringAfterLast('/')