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
@@ -112,6 +112,13 @@ class CliKotlinAsJavaSupport(project: Project, private val traceHolder: CliTrace
}.orEmpty()
}
override fun findFilesForScript(scriptFqName: FqName, searchScope: GlobalSearchScope): Collection<KtScript> {
return findFilesForPackage(scriptFqName.parent(), searchScope)
.mapNotNull { file ->
file.script?.takeIf { it.fqName == scriptFqName }
}
}
override fun createFacadeForSyntheticFile(file: KtFile): KtLightClassForFacade = error("Should not be called")
override fun declarationLocation(file: KtFile): DeclarationLocation = DeclarationLocation.ProjectSources
override fun createInstanceOfDecompiledLightClass(classOrObject: KtClassOrObject): KtLightClass = error("Should not be called")