Light classes: analyzeFully() --> analyzeWithDeclarations()

This commit is contained in:
Mikhail Glukhikh
2018-02-14 13:49:22 +03:00
parent eabc7c9ba8
commit cd1745d354
4 changed files with 5 additions and 4 deletions
@@ -162,7 +162,7 @@ class CliLightClassGenerationSupport(project: Project) : LightClassGenerationSup
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> {
val filesForFacade = findFilesForFacade(facadeFqName, scope)
@@ -67,7 +67,7 @@ abstract class LightClassGenerationSupport {
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>
@@ -24,6 +24,7 @@ import com.intellij.psi.PsiReferenceList.Role
import org.jetbrains.kotlin.asJava.LightClassGenerationSupport
import org.jetbrains.kotlin.asJava.classes.KtLightClass
import org.jetbrains.kotlin.asJava.classes.lazyPub
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtPsiFactory
import org.jetbrains.kotlin.psi.KtSuperTypeList
import org.jetbrains.kotlin.psi.KtSuperTypeListEntry
@@ -42,7 +43,7 @@ class KtLightPsiReferenceList (
override val kotlinOrigin by lazyPub {
val superTypeList = this@KtLightPsiReferenceList.kotlinOrigin ?: 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 {
val referencedType = context[BindingContext.TYPE, it.typeReference]
referencedType?.constructor?.declarationDescriptor?.fqNameUnsafe?.asString() == fqNameToFind
@@ -237,7 +237,7 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG
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> {
val facadeFilesInPackage = runReadAction {