[SLC] replace lazy with lazyPub
^KT-54051
This commit is contained in:
committed by
Space Team
parent
815d324a4a
commit
ef9412e0aa
+2
-1
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.analysis.providers.KotlinPsiDeclarationProvider
|
||||
import org.jetbrains.kotlin.analysis.providers.KotlinPsiDeclarationProviderFactory
|
||||
import org.jetbrains.kotlin.analysis.providers.createPackagePartProvider
|
||||
import org.jetbrains.kotlin.asJava.builder.ClsWrapperStubPsiFactory
|
||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartProvider
|
||||
import org.jetbrains.kotlin.name.CallableId
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
@@ -31,7 +32,7 @@ private class KotlinStaticPsiDeclarationFromBinaryModuleProvider(
|
||||
private val binaryModules: Collection<KtBinaryModule>,
|
||||
override val jarFileSystem: CoreJarFileSystem,
|
||||
) : KotlinPsiDeclarationProvider(), AbstractDeclarationFromBinaryModuleProvider {
|
||||
private val psiManager by lazy { PsiManager.getInstance(project) }
|
||||
private val psiManager by lazyPub { PsiManager.getInstance(project) }
|
||||
|
||||
private fun clsClassImplsByFqName(
|
||||
fqName: FqName,
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ private class SymbolNameValuePairForAnnotationArgument(
|
||||
|
||||
override fun setValue(p0: PsiAnnotationMemberValue) = cannotModify()
|
||||
|
||||
private val _nameIdentifier: PsiIdentifier by lazy {
|
||||
private val _nameIdentifier: PsiIdentifier by lazyPub {
|
||||
LightIdentifier(parent.manager, constantValue.name.asString())
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@ import com.intellij.psi.PsiAnnotationParameterList
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.impl.PsiImplUtil
|
||||
import org.jetbrains.kotlin.analysis.api.annotations.KtAnnotationApplication
|
||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||
import org.jetbrains.kotlin.light.classes.symbol.basicIsEquivalentTo
|
||||
import org.jetbrains.kotlin.psi.KtCallElement
|
||||
|
||||
@@ -25,7 +26,7 @@ internal class SymbolLightAnnotationForAnnotationCall(
|
||||
override fun findDeclaredAttributeValue(attributeName: String?) =
|
||||
PsiImplUtil.findDeclaredAttributeValue(this, attributeName)
|
||||
|
||||
private val _parameterList: PsiAnnotationParameterList by lazy {
|
||||
private val _parameterList: PsiAnnotationParameterList by lazyPub {
|
||||
SymbolAnnotationParameterList(this, annotationCall.arguments)
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@ import com.intellij.psi.PsiAnnotationParameterList
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.impl.PsiImplUtil
|
||||
import org.jetbrains.kotlin.analysis.api.annotations.KtNamedAnnotationValue
|
||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||
import org.jetbrains.kotlin.psi.KtCallElement
|
||||
|
||||
internal class SymbolLightSimpleAnnotation(
|
||||
@@ -35,7 +36,7 @@ internal class SymbolLightSimpleAnnotation(
|
||||
override fun findDeclaredAttributeValue(attributeName: String?) =
|
||||
PsiImplUtil.findDeclaredAttributeValue(this, attributeName)
|
||||
|
||||
private val _parameterList: PsiAnnotationParameterList by lazy {
|
||||
private val _parameterList: PsiAnnotationParameterList by lazyPub {
|
||||
SymbolAnnotationParameterList(this, arguments)
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@ import com.intellij.psi.PsiClass
|
||||
import org.jetbrains.kotlin.asJava.classes.KtFakeLightClass
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClass
|
||||
import org.jetbrains.kotlin.asJava.classes.LightClassInheritanceHelper
|
||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||
import org.jetbrains.kotlin.light.classes.symbol.analyzeForLightClasses
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
|
||||
@@ -16,7 +17,7 @@ import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
|
||||
class SymbolBasedFakeLightClass(kotlinOrigin: KtClassOrObject) : KtFakeLightClass(kotlinOrigin) {
|
||||
override fun copy(): KtFakeLightClass = SymbolBasedFakeLightClass(kotlinOrigin)
|
||||
|
||||
private val _containingClass: KtFakeLightClass? by lazy {
|
||||
private val _containingClass: KtFakeLightClass? by lazyPub {
|
||||
kotlinOrigin.containingClassOrObject?.let { SymbolBasedFakeLightClass(it) }
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -62,49 +62,49 @@ abstract class SymbolLightClassForClassLike<SType : KtClassOrObjectSymbol> prote
|
||||
protected fun <T> withClassOrObjectSymbol(action: KtAnalysisSession.(SType) -> T): T =
|
||||
classOrObjectSymbolPointer.withSymbol(ktModule, action)
|
||||
|
||||
override val isTopLevel: Boolean by lazy {
|
||||
override val isTopLevel: Boolean by lazyPub {
|
||||
classOrObjectDeclaration?.isTopLevel() ?: withClassOrObjectSymbol { it.symbolKind == KtSymbolKind.TOP_LEVEL }
|
||||
}
|
||||
|
||||
internal val isCompanionObject: Boolean by lazy {
|
||||
internal val isCompanionObject: Boolean by lazyPub {
|
||||
classOrObjectDeclaration?.let { it is KtObjectDeclaration && it.isCompanion() } ?: withClassOrObjectSymbol {
|
||||
it.classKind == KtClassKind.COMPANION_OBJECT
|
||||
}
|
||||
}
|
||||
|
||||
internal val isLocal: Boolean by lazy {
|
||||
internal val isLocal: Boolean by lazyPub {
|
||||
classOrObjectDeclaration?.isLocal ?: withClassOrObjectSymbol { it.symbolKind == KtSymbolKind.LOCAL }
|
||||
}
|
||||
|
||||
internal val isNamedObject: Boolean by lazy {
|
||||
internal val isNamedObject: Boolean by lazyPub {
|
||||
classOrObjectDeclaration?.let { it is KtObjectDeclaration && !it.isCompanion() } ?: withClassOrObjectSymbol {
|
||||
it.classKind == KtClassKind.OBJECT
|
||||
}
|
||||
}
|
||||
|
||||
internal val isObject: Boolean by lazy {
|
||||
internal val isObject: Boolean by lazyPub {
|
||||
classOrObjectDeclaration?.let { it is KtObjectDeclaration } ?: withClassOrObjectSymbol { it.classKind.isObject }
|
||||
}
|
||||
|
||||
internal val isInterface: Boolean by lazy {
|
||||
internal val isInterface: Boolean by lazyPub {
|
||||
classOrObjectDeclaration?.let { it is KtClass && it.isInterface() } ?: withClassOrObjectSymbol {
|
||||
it.classKind == KtClassKind.INTERFACE
|
||||
}
|
||||
}
|
||||
|
||||
internal val isAnnotation: Boolean by lazy {
|
||||
internal val isAnnotation: Boolean by lazyPub {
|
||||
classOrObjectDeclaration?.let { it is KtClass && it.isAnnotation() } ?: withClassOrObjectSymbol {
|
||||
it.classKind == KtClassKind.ANNOTATION_CLASS
|
||||
}
|
||||
}
|
||||
|
||||
internal val isEnum: Boolean by lazy {
|
||||
internal val isEnum: Boolean by lazyPub {
|
||||
classOrObjectDeclaration?.let { it is KtClass && it.isEnum() } ?: withClassOrObjectSymbol {
|
||||
it.classKind == KtClassKind.ENUM_CLASS
|
||||
}
|
||||
}
|
||||
|
||||
private val _isDeprecated: Boolean by lazy {
|
||||
private val _isDeprecated: Boolean by lazyPub {
|
||||
withClassOrObjectSymbol { it.hasDeprecatedAnnotation() }
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ abstract class SymbolLightClassForClassLike<SType : KtClassOrObjectSymbol> prote
|
||||
abstract override fun getOwnFields(): List<KtLightField>
|
||||
abstract override fun getOwnMethods(): List<PsiMethod>
|
||||
|
||||
private val _identifier: PsiIdentifier by lazy {
|
||||
private val _identifier: PsiIdentifier by lazyPub {
|
||||
KtLightIdentifier(this, classOrObjectDeclaration)
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ abstract class SymbolLightClassForClassLike<SType : KtClassOrObjectSymbol> prote
|
||||
abstract override fun getExtendsList(): PsiReferenceList?
|
||||
abstract override fun getImplementsList(): PsiReferenceList?
|
||||
|
||||
private val _typeParameterList: PsiTypeParameterList? by lazy {
|
||||
private val _typeParameterList: PsiTypeParameterList? by lazyPub {
|
||||
hasTypeParameters().ifTrue {
|
||||
SymbolLightTypeParameterList(
|
||||
owner = this,
|
||||
|
||||
+2
-2
@@ -85,8 +85,8 @@ internal open class SymbolLightClassForClassOrObject : SymbolLightClassForNamedC
|
||||
manager = manager,
|
||||
)
|
||||
|
||||
private val _modifierList: PsiModifierList? by lazy {
|
||||
val lazyModifiers = lazy {
|
||||
private val _modifierList: PsiModifierList? by lazyPub {
|
||||
val lazyModifiers = lazyPub {
|
||||
withClassOrObjectSymbol { classOrObjectSymbol ->
|
||||
buildSet {
|
||||
add(classOrObjectSymbol.toPsiVisibilityForClass(isNested = !isTopLevel))
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ internal class SymbolLightClassForEnumEntry(
|
||||
|
||||
override fun toString(): String = "SymbolLightClassForEnumEntry:$name"
|
||||
|
||||
private val _modifierList: PsiModifierList by lazy {
|
||||
private val _modifierList: PsiModifierList by lazyPub {
|
||||
SymbolLightClassModifierList(
|
||||
containingDeclaration = this,
|
||||
lazyModifiers = lazyOf(setOf(PsiModifier.STATIC, PsiModifier.FINAL)),
|
||||
|
||||
+4
-4
@@ -62,11 +62,11 @@ class SymbolLightClassForFacade(
|
||||
action(files.map { it.getFileSymbol() })
|
||||
}
|
||||
|
||||
private val firstFileInFacade by lazy { files.first() }
|
||||
private val firstFileInFacade by lazyPub { files.first() }
|
||||
|
||||
private val _modifierList: PsiModifierList by lazy {
|
||||
private val _modifierList: PsiModifierList by lazyPub {
|
||||
if (multiFileClass)
|
||||
return@lazy LightModifierList(manager, KotlinLanguage.INSTANCE, PsiModifier.PUBLIC, PsiModifier.FINAL)
|
||||
return@lazyPub LightModifierList(manager, KotlinLanguage.INSTANCE, PsiModifier.PUBLIC, PsiModifier.FINAL)
|
||||
|
||||
val lazyModifiers = lazyOf(setOf(PsiModifier.PUBLIC, PsiModifier.FINAL))
|
||||
|
||||
@@ -111,7 +111,7 @@ class SymbolLightClassForFacade(
|
||||
}
|
||||
}
|
||||
|
||||
private val multiFileClass: Boolean by lazy {
|
||||
private val multiFileClass: Boolean by lazyPub {
|
||||
files.size > 1 || firstFileInFacade.isJvmMultifileClassFile
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.light.classes.symbol.classes
|
||||
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.util.IncorrectOperationException
|
||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||
import org.jetbrains.kotlin.light.classes.symbol.modifierLists.SymbolLightClassModifierList
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
|
||||
@@ -32,7 +33,7 @@ internal class SymbolLightClassForInterfaceDefaultImpls(private val containingCl
|
||||
override fun getTypeParameterList(): PsiTypeParameterList? = null
|
||||
override fun getTypeParameters(): Array<PsiTypeParameter> = emptyArray()
|
||||
|
||||
private val _modifierList: PsiModifierList? by lazy {
|
||||
private val _modifierList: PsiModifierList? by lazyPub {
|
||||
val lazyModifiers = lazyOf(setOf(PsiModifier.PUBLIC, PsiModifier.STATIC, PsiModifier.FINAL))
|
||||
val lazyAnnotations = lazyOf(emptyList<PsiAnnotation>())
|
||||
SymbolLightClassModifierList(this, lazyModifiers, lazyAnnotations)
|
||||
|
||||
+2
-2
@@ -64,8 +64,8 @@ internal abstract class SymbolLightClassForInterfaceOrAnnotationClass : SymbolLi
|
||||
manager = manager,
|
||||
)
|
||||
|
||||
private val _modifierList: PsiModifierList? by lazy {
|
||||
val lazyModifiers = lazy {
|
||||
private val _modifierList: PsiModifierList? by lazyPub {
|
||||
val lazyModifiers = lazyPub {
|
||||
withClassOrObjectSymbol { classOrObjectSymbol ->
|
||||
buildSet {
|
||||
add(classOrObjectSymbol.toPsiVisibilityForClass(isNested = !isTopLevel))
|
||||
|
||||
+2
-1
@@ -14,6 +14,7 @@ import com.intellij.util.PlatformIcons
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin
|
||||
import org.jetbrains.kotlin.asJava.classes.cannotModify
|
||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightField
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightIdentifier
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
@@ -36,7 +37,7 @@ internal abstract class SymbolLightField protected constructor(
|
||||
|
||||
override fun hasInitializer(): Boolean = initializer !== null
|
||||
|
||||
private val _identifier: PsiIdentifier by lazy {
|
||||
private val _identifier: PsiIdentifier by lazyPub {
|
||||
KtLightIdentifier(this, kotlinOrigin)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ internal class SymbolLightFieldForEnumEntry(
|
||||
action(enumEntry.getEnumEntrySymbol())
|
||||
}
|
||||
|
||||
private val _modifierList by lazy {
|
||||
private val _modifierList by lazyPub {
|
||||
SymbolLightMemberModifierList(
|
||||
containingDeclaration = this@SymbolLightFieldForEnumEntry,
|
||||
lazyModifiers = lazyOf(setOf(PsiModifier.STATIC, PsiModifier.FINAL, PsiModifier.PUBLIC)),
|
||||
@@ -54,7 +54,7 @@ internal class SymbolLightFieldForEnumEntry(
|
||||
|
||||
private val hasBody: Boolean get() = enumEntry.body != null
|
||||
|
||||
private val _initializingClass: PsiEnumConstantInitializer? by lazy {
|
||||
private val _initializingClass: PsiEnumConstantInitializer? by lazyPub {
|
||||
hasBody.ifTrue {
|
||||
SymbolLightClassForEnumEntry(
|
||||
enumConstant = this@SymbolLightFieldForEnumEntry,
|
||||
|
||||
+4
-4
@@ -49,14 +49,14 @@ internal class SymbolLightFieldForObject private constructor(
|
||||
|
||||
override fun getName(): String = name
|
||||
|
||||
private val _modifierList: PsiModifierList by lazy {
|
||||
val lazyModifiers = lazy {
|
||||
private val _modifierList: PsiModifierList by lazyPub {
|
||||
val lazyModifiers = lazyPub {
|
||||
withObjectDeclarationSymbol { objectSymbol ->
|
||||
setOf(objectSymbol.toPsiVisibilityForMember(), PsiModifier.STATIC, PsiModifier.FINAL)
|
||||
}
|
||||
}
|
||||
|
||||
val lazyAnnotations = lazy {
|
||||
val lazyAnnotations = lazyPub {
|
||||
val notNullAnnotation = SymbolLightSimpleAnnotation(NotNull::class.java.name, this)
|
||||
listOf(notNullAnnotation)
|
||||
}
|
||||
@@ -64,7 +64,7 @@ internal class SymbolLightFieldForObject private constructor(
|
||||
SymbolLightMemberModifierList(this, lazyModifiers, lazyAnnotations)
|
||||
}
|
||||
|
||||
private val _isDeprecated: Boolean by lazy {
|
||||
private val _isDeprecated: Boolean by lazyPub {
|
||||
withObjectDeclarationSymbol { objectSymbol ->
|
||||
objectSymbol.hasDeprecatedAnnotation()
|
||||
}
|
||||
|
||||
+2
-2
@@ -76,7 +76,7 @@ internal class SymbolLightFieldForProperty private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private val _isDeprecated: Boolean by lazy {
|
||||
private val _isDeprecated: Boolean by lazyPub {
|
||||
withPropertySymbol { propertySymbol ->
|
||||
propertySymbol.hasDeprecatedAnnotation(AnnotationUseSiteTarget.FIELD)
|
||||
}
|
||||
@@ -131,7 +131,7 @@ internal class SymbolLightFieldForProperty private constructor(
|
||||
)
|
||||
}
|
||||
|
||||
private val _modifierList: PsiModifierList by lazy {
|
||||
private val _modifierList: PsiModifierList by lazyPub {
|
||||
val lazyModifiers = lazyPub { computeModifiers() }
|
||||
val lazyAnnotations = lazyPub { computeAnnotations() }
|
||||
SymbolLightMemberModifierList(this, lazyModifiers, lazyAnnotations)
|
||||
|
||||
+4
-4
@@ -103,7 +103,7 @@ internal class SymbolLightAccessorMethod private constructor(
|
||||
|
||||
override fun getName(): String = _name
|
||||
|
||||
private val _typeParameterList: PsiTypeParameterList? by lazy {
|
||||
private val _typeParameterList: PsiTypeParameterList? by lazyPub {
|
||||
hasTypeParameters().ifTrue {
|
||||
SymbolLightTypeParameterList(
|
||||
owner = this,
|
||||
@@ -183,7 +183,7 @@ internal class SymbolLightAccessorMethod private constructor(
|
||||
modifiers
|
||||
}
|
||||
|
||||
private val _modifierList: PsiModifierList by lazy {
|
||||
private val _modifierList: PsiModifierList by lazyPub {
|
||||
val lazyModifiers = lazyPub { computeModifiers() }
|
||||
val lazyAnnotations = lazyPub { computeAnnotations(PsiModifier.PRIVATE in lazyModifiers.value) }
|
||||
SymbolLightMemberModifierList(this, lazyModifiers, lazyAnnotations)
|
||||
@@ -193,7 +193,7 @@ internal class SymbolLightAccessorMethod private constructor(
|
||||
|
||||
override fun isConstructor(): Boolean = false
|
||||
|
||||
private val _isDeprecated: Boolean by lazy {
|
||||
private val _isDeprecated: Boolean by lazyPub {
|
||||
analyzeForLightClasses(ktModule) {
|
||||
propertySymbol().hasDeprecatedAnnotation(accessorSite)
|
||||
}
|
||||
@@ -201,7 +201,7 @@ internal class SymbolLightAccessorMethod private constructor(
|
||||
|
||||
override fun isDeprecated(): Boolean = _isDeprecated
|
||||
|
||||
private val _identifier: PsiIdentifier by lazy {
|
||||
private val _identifier: PsiIdentifier by lazyPub {
|
||||
KtLightIdentifier(this, containingPropertyDeclaration)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ internal class SymbolLightConstructor(
|
||||
override fun getTypeParameterList(): PsiTypeParameterList? = null
|
||||
override fun getTypeParameters(): Array<PsiTypeParameter> = PsiTypeParameter.EMPTY_ARRAY
|
||||
|
||||
private val _modifierList: PsiModifierList by lazy {
|
||||
private val _modifierList: PsiModifierList by lazyPub {
|
||||
val lazyAnnotations: Lazy<List<PsiAnnotation>> = lazyPub {
|
||||
withFunctionSymbol { constructorSymbol ->
|
||||
constructorSymbol.computeAnnotations(
|
||||
@@ -54,7 +54,7 @@ internal class SymbolLightConstructor(
|
||||
}
|
||||
}
|
||||
|
||||
val lazyModifiers: Lazy<Set<String>> = lazy {
|
||||
val lazyModifiers: Lazy<Set<String>> = lazyPub {
|
||||
// FIR treats an enum entry as an anonymous object w/ its own ctor (not default one).
|
||||
// On the other hand, FE 1.0 doesn't add anything; then ULC adds default ctor w/ package local visibility.
|
||||
// Technically, an enum entry should not be instantiated anywhere else, and thus FIR's modeling makes sense.
|
||||
|
||||
+4
-4
@@ -63,7 +63,7 @@ internal abstract class SymbolLightMethod<FType : KtFunctionLikeSymbol> private
|
||||
|
||||
protected fun <T> withFunctionSymbol(action: KtAnalysisSession.(FType) -> T): T = functionSymbolPointer.withSymbol(ktModule, action)
|
||||
|
||||
private val _isVarArgs: Boolean by lazy {
|
||||
private val _isVarArgs: Boolean by lazyPub {
|
||||
functionDeclaration?.valueParameters?.any { it.isVarArg } ?: withFunctionSymbol { functionSymbol ->
|
||||
functionSymbol.valueParameters.any { it.isVararg }
|
||||
}
|
||||
@@ -103,11 +103,11 @@ internal abstract class SymbolLightMethod<FType : KtFunctionLikeSymbol> private
|
||||
}
|
||||
}
|
||||
|
||||
private val _identifier: PsiIdentifier by lazy {
|
||||
KtLightIdentifier(this@SymbolLightMethod, functionDeclaration)
|
||||
private val _identifier: PsiIdentifier by lazyPub {
|
||||
KtLightIdentifier(this, functionDeclaration)
|
||||
}
|
||||
|
||||
private val _isDeprecated: Boolean by lazy {
|
||||
private val _isDeprecated: Boolean by lazyPub {
|
||||
withFunctionSymbol { functionSymbol ->
|
||||
functionSymbol.hasDeprecatedAnnotation()
|
||||
}
|
||||
|
||||
+4
-3
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.light.classes.symbol.methods
|
||||
|
||||
import com.intellij.psi.*
|
||||
import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin
|
||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightIdentifier
|
||||
import org.jetbrains.kotlin.light.classes.symbol.classes.SymbolLightClassForClassLike
|
||||
import org.jetbrains.kotlin.light.classes.symbol.modifierLists.SymbolLightMemberModifierList
|
||||
@@ -26,7 +27,7 @@ internal class SymbolLightNoArgConstructor(
|
||||
override fun getTypeParameterList(): PsiTypeParameterList? = null
|
||||
override fun getTypeParameters(): Array<PsiTypeParameter> = PsiTypeParameter.EMPTY_ARRAY
|
||||
|
||||
private val _identifier: PsiIdentifier by lazy {
|
||||
private val _identifier: PsiIdentifier by lazyPub {
|
||||
KtLightIdentifier(this, ktDeclaration = null)
|
||||
}
|
||||
|
||||
@@ -34,13 +35,13 @@ internal class SymbolLightNoArgConstructor(
|
||||
|
||||
override fun isDeprecated(): Boolean = false
|
||||
|
||||
private val _modifierList: PsiModifierList by lazy {
|
||||
private val _modifierList: PsiModifierList by lazyPub {
|
||||
SymbolLightMemberModifierList(this, lazyOf(setOf(visibility)), lazyOf(emptyList()))
|
||||
}
|
||||
|
||||
override fun getModifierList(): PsiModifierList = _modifierList
|
||||
|
||||
private val _parameterList: PsiParameterList by lazy {
|
||||
private val _parameterList: PsiParameterList by lazyPub {
|
||||
SymbolLightParameterList(parent = this)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ internal class SymbolLightSimpleMethod(
|
||||
return modifiers
|
||||
}
|
||||
|
||||
private val _modifierList: PsiModifierList by lazy {
|
||||
private val _modifierList: PsiModifierList by lazyPub {
|
||||
val lazyModifiers = lazyPub {
|
||||
withFunctionSymbol { functionSymbol ->
|
||||
computeModifiers(functionSymbol)
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.light.classes.symbol.modifierLists
|
||||
|
||||
import com.intellij.psi.PsiAnnotation
|
||||
import com.intellij.psi.PsiModifierListOwner
|
||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightAbstractAnnotation
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightElement
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightElementBase
|
||||
@@ -18,7 +19,7 @@ internal class SymbolLightClassModifierList<T : KtLightElement<KtModifierListOwn
|
||||
private val lazyModifiers: Lazy<Set<String>>,
|
||||
lazyAnnotations: Lazy<List<PsiAnnotation>>,
|
||||
) : SymbolLightModifierList<T>(containingDeclaration) {
|
||||
private val lazyAnnotations: Lazy<List<PsiAnnotation>> = lazy {
|
||||
private val lazyAnnotations: Lazy<List<PsiAnnotation>> = lazyPub {
|
||||
lazyAnnotations.value.onEach { (it as? KtLightElementBase)?.parent = this }
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.light.classes.symbol.modifierLists
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiAnnotation
|
||||
import com.intellij.psi.PsiModifier
|
||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightAbstractAnnotation
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightElementBase
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightMember
|
||||
@@ -22,7 +23,7 @@ internal class SymbolLightMemberModifierList<T : KtLightMember<*>>(
|
||||
private val lazyModifiers: Lazy<Set<String>>,
|
||||
lazyAnnotations: Lazy<List<PsiAnnotation>>
|
||||
) : SymbolLightModifierList<T>(containingDeclaration) {
|
||||
private val lazyAnnotations: Lazy<List<PsiAnnotation>> = lazy {
|
||||
private val lazyAnnotations: Lazy<List<PsiAnnotation>> = lazyPub {
|
||||
lazyAnnotations.value.onEach { (it as? KtLightElementBase)?.parent = this }
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ internal class SymbolLightParameter(
|
||||
|
||||
override fun getModifierList(): PsiModifierList = _modifierList
|
||||
|
||||
private val _modifierList: PsiModifierList by lazy {
|
||||
private val _modifierList: PsiModifierList by lazyPub {
|
||||
val lazyAnnotations: Lazy<List<PsiAnnotation>> = lazyPub {
|
||||
val annotationSite = isConstructorParameterSymbol.ifTrue {
|
||||
AnnotationUseSiteTarget.CONSTRUCTOR_PARAMETER
|
||||
@@ -48,7 +48,7 @@ internal class SymbolLightParameter(
|
||||
SymbolLightClassModifierList(this, lazyOf(emptySet()), lazyAnnotations)
|
||||
}
|
||||
|
||||
private val isVararg: Boolean by lazy {
|
||||
private val isVararg: Boolean by lazyPub {
|
||||
parameterSymbolPointer.withSymbol(ktModule) { it.isVararg }
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -35,7 +35,7 @@ internal abstract class SymbolLightParameterCommon(
|
||||
kotlinOrigin = parameterSymbol.psiSafe(),
|
||||
)
|
||||
|
||||
private val _name: String by lazy {
|
||||
private val _name: String by lazyPub {
|
||||
parameterSymbolPointer.withSymbol(ktModule) {
|
||||
it.name.asString()
|
||||
}
|
||||
@@ -47,7 +47,7 @@ internal abstract class SymbolLightParameterCommon(
|
||||
|
||||
abstract override fun getModifierList(): PsiModifierList
|
||||
|
||||
private val _identifier: PsiIdentifier by lazy {
|
||||
private val _identifier: PsiIdentifier by lazyPub {
|
||||
KtLightIdentifier(this, parameterDeclaration)
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ internal abstract class SymbolLightParameterCommon(
|
||||
|
||||
override fun getNameIdentifier(): PsiIdentifier = _identifier
|
||||
|
||||
private val _type by lazy {
|
||||
private val _type by lazyPub {
|
||||
parameterSymbolPointer.withSymbol(ktModule) { parameterSymbol ->
|
||||
val convertedType = run {
|
||||
val ktType = parameterSymbol.returnType
|
||||
|
||||
+3
-3
@@ -53,7 +53,7 @@ internal class SymbolLightParameterForReceiver private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private val _name: String by lazy {
|
||||
private val _name: String by lazyPub {
|
||||
AsmUtil.getLabeledThisName(methodName, AsmUtil.LABELED_THIS_PARAMETER, AsmUtil.RECEIVER_PARAMETER_NAME)
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ internal class SymbolLightParameterForReceiver private constructor(
|
||||
|
||||
override fun getModifierList(): PsiModifierList = _modifierList
|
||||
|
||||
private val _modifierList: PsiModifierList by lazy {
|
||||
private val _modifierList: PsiModifierList by lazyPub {
|
||||
val lazyAnnotations: Lazy<List<SymbolLightAbstractAnnotation>> = lazyPub {
|
||||
withReceiverSymbol { receiver ->
|
||||
buildList {
|
||||
@@ -83,7 +83,7 @@ internal class SymbolLightParameterForReceiver private constructor(
|
||||
SymbolLightClassModifierList(this, lazyOf(emptySet()), lazyAnnotations)
|
||||
}
|
||||
|
||||
private val _type: PsiType by lazy {
|
||||
private val _type: PsiType by lazyPub {
|
||||
withReceiverSymbol { receiver ->
|
||||
receiver.type.asPsiType(this@SymbolLightParameterForReceiver)
|
||||
} ?: nonExistentType()
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@ import com.intellij.psi.PsiParameterList
|
||||
import com.intellij.psi.impl.light.LightParameterListBuilder
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtCallableSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer
|
||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightElement
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightElementBase
|
||||
import org.jetbrains.kotlin.light.classes.symbol.methods.SymbolLightMethodBase
|
||||
@@ -29,7 +30,7 @@ internal class SymbolLightParameterList(
|
||||
override val kotlinOrigin: KtParameterList?
|
||||
get() = (parent.kotlinOrigin as? KtFunction)?.valueParameterList
|
||||
|
||||
private val clsDelegate: PsiParameterList by lazy {
|
||||
private val clsDelegate: PsiParameterList by lazyPub {
|
||||
val builder = LightParameterListBuilder(manager, language)
|
||||
|
||||
callableWithReceiverSymbolPointer?.let {
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ internal class SymbolLightSetterParameter(
|
||||
return super.getName()
|
||||
}
|
||||
|
||||
private val isDefaultSetterParameter: Boolean by lazy {
|
||||
private val isDefaultSetterParameter: Boolean by lazyPub {
|
||||
containingPropertySymbolPointer.withSymbol(ktModule) {
|
||||
it.setter?.isDefault != false
|
||||
}
|
||||
@@ -41,7 +41,7 @@ internal class SymbolLightSetterParameter(
|
||||
|
||||
override fun getModifierList(): PsiModifierList = _modifierList
|
||||
|
||||
private val _modifierList: PsiModifierList by lazy {
|
||||
private val _modifierList: PsiModifierList by lazyPub {
|
||||
val lazyAnnotations: Lazy<List<PsiAnnotation>> = lazyPub {
|
||||
analyzeForLightClasses(ktModule) {
|
||||
val annotationsFromSetter = parameterSymbolPointer.restoreSymbolOrThrowIfDisposed().computeAnnotations(
|
||||
|
||||
+2
-2
@@ -49,8 +49,8 @@ internal class SymbolLightSuspendContinuationParameter(
|
||||
|
||||
override fun getModifierList(): PsiModifierList = _modifierList
|
||||
|
||||
private val _modifierList: PsiModifierList by lazy {
|
||||
val lazyAnnotations = lazy {
|
||||
private val _modifierList: PsiModifierList by lazyPub {
|
||||
val lazyAnnotations = lazyPub {
|
||||
if (withFunctionSymbol { it.visibility.isPrivateOrPrivateToThis() })
|
||||
emptyList()
|
||||
else
|
||||
|
||||
+1
-1
@@ -158,7 +158,7 @@ internal class SymbolLightTypeParameter private constructor(
|
||||
override fun addAnnotation(qualifiedName: String): PsiAnnotation = cannotModify()
|
||||
//End of PsiClass simple implementation
|
||||
|
||||
private val _name: String by lazy {
|
||||
private val _name: String by lazyPub {
|
||||
typeParameterDeclaration?.name ?: withTypeParameterSymbol { it.name.asString() }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user