Migrate LightMemberOriginForCompiledElement from IJ repository
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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.analysis.decompiled.light.classes.origin
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.psi.PsiMember
|
||||
import org.jetbrains.kotlin.analysis.decompiler.psi.file.KtClsFile
|
||||
import org.jetbrains.kotlin.load.kotlin.MemberSignature
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
|
||||
abstract class KotlinDeclarationInCompiledFileSearcher {
|
||||
abstract fun findDeclarationInCompiledFile(file: KtClsFile, member: PsiMember, signature: MemberSignature): KtDeclaration?
|
||||
|
||||
companion object {
|
||||
fun getInstance(): KotlinDeclarationInCompiledFileSearcher =
|
||||
ApplicationManager.getApplication().getService(KotlinDeclarationInCompiledFileSearcher::class.java)
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -47,7 +47,7 @@ data class LightMemberOriginForCompiledField(val psiField: PsiField, val file: K
|
||||
override val originalElement: KtDeclaration? by lazyPub {
|
||||
val desc = MapPsiToAsmDesc.typeDesc(psiField.type)
|
||||
val signature = MemberSignature.fromFieldNameAndDesc(psiField.name, desc)
|
||||
findDeclarationInCompiledFile(file, psiField, signature)
|
||||
KotlinDeclarationInCompiledFileSearcher.getInstance().findDeclarationInCompiledFile(file, psiField, signature)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,6 @@ data class LightMemberOriginForCompiledMethod(val psiMethod: PsiMethod, val file
|
||||
val desc = MapPsiToAsmDesc.methodDesc(psiMethod)
|
||||
val name = if (psiMethod.isConstructor) "<init>" else psiMethod.name
|
||||
val signature = MemberSignature.fromMethodNameAndDesc(name, desc)
|
||||
findDeclarationInCompiledFile(file, psiMethod, signature)
|
||||
KotlinDeclarationInCompiledFileSearcher.getInstance().findDeclarationInCompiledFile(file, psiMethod, signature)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user