[slc] cleanup code
^KT-50241
This commit is contained in:
+2
-2
@@ -10,8 +10,8 @@ import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.*
|
||||
|
||||
public object DecompiledPsiDeclarationProvider {
|
||||
public fun findPsi(ktSymbol: KtSymbol, project: Project): PsiElement? {
|
||||
object DecompiledPsiDeclarationProvider {
|
||||
fun findPsi(ktSymbol: KtSymbol, project: Project): PsiElement? {
|
||||
return when (ktSymbol) {
|
||||
is KtConstructorSymbol -> providePsiForConstructor(ktSymbol, project)
|
||||
is KtFunctionLikeSymbol -> providePsiForFunction(ktSymbol, project)
|
||||
|
||||
+7
-7
@@ -16,23 +16,23 @@ import org.jetbrains.kotlin.name.ClassId
|
||||
/**
|
||||
* A [PsiMember] declaration provider for a given scope. Can be created via [KotlinPsiDeclarationProviderFactory].
|
||||
*/
|
||||
public abstract class KotlinPsiDeclarationProvider {
|
||||
abstract class KotlinPsiDeclarationProvider {
|
||||
/**
|
||||
* Gets a collection of [PsiClass] by [ClassId]
|
||||
*
|
||||
* In standalone mode, this is simply [PsiClassStub]-based [PsiClass]
|
||||
*/
|
||||
public abstract fun getClassesByClassId(classId: ClassId): Collection<PsiClass>
|
||||
abstract fun getClassesByClassId(classId: ClassId): Collection<PsiClass>
|
||||
|
||||
public abstract fun getProperties(callableId: CallableId): Collection<PsiMember>
|
||||
public abstract fun getFunctions(callableId: CallableId): Collection<PsiMethod>
|
||||
abstract fun getProperties(callableId: CallableId): Collection<PsiMember>
|
||||
abstract fun getFunctions(callableId: CallableId): Collection<PsiMethod>
|
||||
}
|
||||
|
||||
public abstract class KotlinPsiDeclarationProviderFactory {
|
||||
public abstract fun createPsiDeclarationProvider(searchScope: GlobalSearchScope): KotlinPsiDeclarationProvider
|
||||
abstract class KotlinPsiDeclarationProviderFactory {
|
||||
abstract fun createPsiDeclarationProvider(searchScope: GlobalSearchScope): KotlinPsiDeclarationProvider
|
||||
}
|
||||
|
||||
public fun Project.createPsiDeclarationProvider(searchScope: GlobalSearchScope): KotlinPsiDeclarationProvider? =
|
||||
fun Project.createPsiDeclarationProvider(searchScope: GlobalSearchScope): KotlinPsiDeclarationProvider? =
|
||||
// TODO: avoid using fail-safe service loading once the factory has an easy-to-register ctor.
|
||||
getServiceIfCreated(KotlinPsiDeclarationProviderFactory::class.java)
|
||||
?.createPsiDeclarationProvider(searchScope)
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ private class KotlinStaticPsiDeclarationFromBinaryModuleProvider(
|
||||
|
||||
// TODO: we can't register this in IDE yet due to non-trivial parameters: lib modules and jar file system.
|
||||
// We need a session or facade that maintains such information
|
||||
public class KotlinStaticPsiDeclarationProviderFactory(
|
||||
class KotlinStaticPsiDeclarationProviderFactory(
|
||||
private val project: Project,
|
||||
private val binaryModules: Collection<KtBinaryModule>,
|
||||
private val jarFileSystem: CoreJarFileSystem,
|
||||
|
||||
+1
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2022 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.
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,6 @@ class KotlinAsJavaFirSupport(private val project: Project) : KotlinAsJavaSupport
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
override fun findFilesForPackage(fqName: FqName, searchScope: GlobalSearchScope): Collection<KtFile> =
|
||||
buildSet {
|
||||
addAll(project.createDeclarationProvider(searchScope).getFacadeFilesInPackage(fqName))
|
||||
|
||||
Reference in New Issue
Block a user