AA/LC: introduce an API to find script files

This commit is contained in:
Jinseong Jeon
2023-04-21 22:50:13 -07:00
committed by Dmitrii Gridin
parent f9086daf4d
commit 5298abf2d6
11 changed files with 50 additions and 13 deletions
@@ -45,6 +45,8 @@ abstract class KotlinAsJavaSupport {
abstract fun findFilesForFacadeByPackage(packageFqName: FqName, searchScope: GlobalSearchScope): Collection<KtFile>
abstract fun findFilesForScript(scriptFqName: FqName, searchScope: GlobalSearchScope): Collection<KtScript>
abstract fun findClassOrObjectDeclarations(fqName: FqName, searchScope: GlobalSearchScope): Collection<KtClassOrObject>
abstract fun packageExists(fqName: FqName, scope: GlobalSearchScope): Boolean
@@ -207,9 +207,7 @@ abstract class KotlinAsJavaSupportBase<TModule>(protected val project: Project)
return emptyList()
}
return findFilesForPackage(scriptFqName.parent(), scope).mapNotNull { file ->
file.script?.takeIf { it.fqName == scriptFqName }?.let { getLightClassForScript(it) }
}
return findFilesForScript(scriptFqName, scope).mapNotNull { getLightClassForScript(it) }
}
}