Light classes: analyzeFully() --> analyzeWithDeclarations()
This commit is contained in:
+1
-1
@@ -162,7 +162,7 @@ class CliLightClassGenerationSupport(project: Project) : LightClassGenerationSup
|
|||||||
|
|
||||||
override fun analyze(element: KtElement) = bindingContext
|
override fun analyze(element: KtElement) = bindingContext
|
||||||
|
|
||||||
override fun analyzeFully(element: KtElement) = bindingContext
|
override fun analyzeWithDeclarations(element: KtClassOrObject) = bindingContext
|
||||||
|
|
||||||
override fun getFacadeClasses(facadeFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass> {
|
override fun getFacadeClasses(facadeFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass> {
|
||||||
val filesForFacade = findFilesForFacade(facadeFqName, scope)
|
val filesForFacade = findFilesForFacade(facadeFqName, scope)
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ abstract class LightClassGenerationSupport {
|
|||||||
|
|
||||||
abstract fun analyze(element: KtElement): BindingContext
|
abstract fun analyze(element: KtElement): BindingContext
|
||||||
|
|
||||||
abstract fun analyzeFully(element: KtElement): BindingContext
|
abstract fun analyzeWithDeclarations(element: KtClassOrObject): BindingContext
|
||||||
|
|
||||||
abstract fun getFacadeClasses(facadeFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass>
|
abstract fun getFacadeClasses(facadeFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass>
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -24,6 +24,7 @@ import com.intellij.psi.PsiReferenceList.Role
|
|||||||
import org.jetbrains.kotlin.asJava.LightClassGenerationSupport
|
import org.jetbrains.kotlin.asJava.LightClassGenerationSupport
|
||||||
import org.jetbrains.kotlin.asJava.classes.KtLightClass
|
import org.jetbrains.kotlin.asJava.classes.KtLightClass
|
||||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||||
|
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||||
import org.jetbrains.kotlin.psi.KtPsiFactory
|
import org.jetbrains.kotlin.psi.KtPsiFactory
|
||||||
import org.jetbrains.kotlin.psi.KtSuperTypeList
|
import org.jetbrains.kotlin.psi.KtSuperTypeList
|
||||||
import org.jetbrains.kotlin.psi.KtSuperTypeListEntry
|
import org.jetbrains.kotlin.psi.KtSuperTypeListEntry
|
||||||
@@ -42,7 +43,7 @@ class KtLightPsiReferenceList (
|
|||||||
override val kotlinOrigin by lazyPub {
|
override val kotlinOrigin by lazyPub {
|
||||||
val superTypeList = this@KtLightPsiReferenceList.kotlinOrigin ?: return@lazyPub null
|
val superTypeList = this@KtLightPsiReferenceList.kotlinOrigin ?: return@lazyPub null
|
||||||
val fqNameToFind = clsDelegate.qualifiedName ?: return@lazyPub null
|
val fqNameToFind = clsDelegate.qualifiedName ?: return@lazyPub null
|
||||||
val context = LightClassGenerationSupport.getInstance(project).analyzeFully(superTypeList)
|
val context = LightClassGenerationSupport.getInstance(project).analyzeWithDeclarations(superTypeList.parent as KtClassOrObject)
|
||||||
superTypeList.entries.firstOrNull {
|
superTypeList.entries.firstOrNull {
|
||||||
val referencedType = context[BindingContext.TYPE, it.typeReference]
|
val referencedType = context[BindingContext.TYPE, it.typeReference]
|
||||||
referencedType?.constructor?.declarationDescriptor?.fqNameUnsafe?.asString() == fqNameToFind
|
referencedType?.constructor?.declarationDescriptor?.fqNameUnsafe?.asString() == fqNameToFind
|
||||||
|
|||||||
+1
-1
@@ -237,7 +237,7 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG
|
|||||||
|
|
||||||
override fun analyze(element: KtElement) = element.analyze(BodyResolveMode.PARTIAL)
|
override fun analyze(element: KtElement) = element.analyze(BodyResolveMode.PARTIAL)
|
||||||
|
|
||||||
override fun analyzeFully(element: KtElement) = element.analyzeFully()
|
override fun analyzeWithDeclarations(element: KtClassOrObject) = element.analyzeWithDeclarations()
|
||||||
|
|
||||||
override fun getFacadeNames(packageFqName: FqName, scope: GlobalSearchScope): Collection<String> {
|
override fun getFacadeNames(packageFqName: FqName, scope: GlobalSearchScope): Collection<String> {
|
||||||
val facadeFilesInPackage = runReadAction {
|
val facadeFilesInPackage = runReadAction {
|
||||||
|
|||||||
Reference in New Issue
Block a user