Skip to content

Commit 4a3fbbc

Browse files
BlaBlaHumanSpace Team
authored andcommitted
[Analysis API] Add org.jetbrains.kotlin.analysis.api.components.KaSymbolInformationProvider.isInline
Shows whether a property is inline, see https://kotlinlang.org/docs/inline-functions.html#inline-properties. ^KT-74475 fixed
1 parent e7ae4c9 commit 4a3fbbc

File tree

223 files changed

+2078
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+2078
-104
lines changed

analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/symbols/Fe10IdeNormalAnalysisSourceModuleSingleSymbolByPsiTestGenerated.java

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/symbols/FirIdeNormalAnalysisSourceModuleSingleSymbolByPsiTestGenerated.java

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

analysis/analysis-api-impl-base/src/org/jetbrains/kotlin/analysis/api/impl/base/components/KaBaseSymbolInformationProvider.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ package org.jetbrains.kotlin.analysis.api.impl.base.components
88
import org.jetbrains.kotlin.analysis.api.KaImplementationDetail
99
import org.jetbrains.kotlin.analysis.api.KaSession
1010
import org.jetbrains.kotlin.analysis.api.components.KaSymbolInformationProvider
11+
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
12+
import org.jetbrains.kotlin.analysis.api.symbols.KaKotlinPropertySymbol
1113

1214
@KaImplementationDetail
13-
abstract class KaBaseSymbolInformationProvider<T : KaSession> : KaBaseSessionComponent<T>(), KaSymbolInformationProvider
15+
abstract class KaBaseSymbolInformationProvider<T : KaSession> : KaBaseSessionComponent<T>(), KaSymbolInformationProvider {
16+
override val KaKotlinPropertySymbol.isInline: Boolean
17+
get() = withValidityAssertion {
18+
getter?.isInline == true && (isVal || setter?.isInline == true)
19+
}
20+
}

analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/symbols/FirStandaloneNormalAnalysisSourceModuleSingleSymbolByPsiTestGenerated.java

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

analysis/analysis-api/src/org/jetbrains/kotlin/analysis/api/components/KaSymbolInformationProvider.kt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
package org.jetbrains.kotlin.analysis.api.components
77

88
import org.jetbrains.kotlin.analysis.api.KaExperimentalApi
9-
import org.jetbrains.kotlin.analysis.api.symbols.KaClassSymbol
10-
import org.jetbrains.kotlin.analysis.api.symbols.KaNamedFunctionSymbol
11-
import org.jetbrains.kotlin.analysis.api.symbols.KaPropertySymbol
12-
import org.jetbrains.kotlin.analysis.api.symbols.KaSymbol
9+
import org.jetbrains.kotlin.analysis.api.symbols.*
1310
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
1411
import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget
1512
import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo
@@ -72,4 +69,13 @@ public interface KaSymbolInformationProvider : KaSessionComponent {
7269
*/
7370
@KaExperimentalApi
7471
public val KaClassSymbol.annotationApplicableTargets: Set<KotlinTarget>?
72+
73+
74+
/**
75+
* Whether the property is an [inline property](https://kotlinlang.org/docs/inline-functions.html#inline-properties).
76+
* A property is considered `inline` when both of its accessors are `inline` or when it has the `inline` keyword.
77+
* The `inline` keyword on a property is syntactic sugar for marking both accessors as `inline`.
78+
*/
79+
@KaExperimentalApi
80+
public val KaKotlinPropertySymbol.isInline: Boolean
7581
}

analysis/analysis-api/src/org/jetbrains/kotlin/analysis/api/symbols/DebugSymbolRenderer.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ public class DebugSymbolRenderer(
102102
renderComputedValue("setterDeprecationStatus", printer, currentSymbolStack) { symbol.setterDeprecationStatus }
103103
}
104104

105+
if (symbol is KaKotlinPropertySymbol) {
106+
renderComputedValue("isInline", printer, currentSymbolStack) { symbol.isInline }
107+
}
108+
105109
if (renderIsPublicApi) {
106110
if (symbol is KaDeclarationSymbol) {
107111
renderComputedValue("isPublicApi", printer, currentSymbolStack) { isPublicApi(symbol) }

analysis/analysis-api/testData/components/scopeProvider/combinedDeclaredMemberScope/class.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ KaKotlinPropertySymbol:
140140
javaGetterName: getBar
141141
javaSetterName: null
142142
setterDeprecationStatus: null
143+
isInline: false
143144

144145
KaNamedClassSymbol:
145146
annotations: []

analysis/analysis-api/testData/components/scopeProvider/combinedDeclaredMemberScope/classWithJavaSuperclass.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ KaKotlinPropertySymbol:
140140
javaGetterName: getBar
141141
javaSetterName: null
142142
setterDeprecationStatus: null
143+
isInline: false
143144

144145
KaNamedClassSymbol:
145146
annotations: []

analysis/analysis-api/testData/components/scopeProvider/combinedDeclaredMemberScope/enumClass.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ KaKotlinPropertySymbol:
238238
javaGetterName: getEntries
239239
javaSetterName: null
240240
setterDeprecationStatus: null
241+
isInline: false
241242

242243
KaConstructorSymbol:
243244
annotations: []

analysis/analysis-api/testData/components/scopeProvider/combinedDeclaredMemberScope/enumClassWithAbstractMembers.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ KaKotlinPropertySymbol:
148148
javaGetterName: getFoo
149149
javaSetterName: null
150150
setterDeprecationStatus: null
151+
isInline: false
151152

152153
KaNamedFunctionSymbol:
153154
annotations: []
@@ -381,6 +382,7 @@ KaKotlinPropertySymbol:
381382
javaGetterName: getEntries
382383
javaSetterName: null
383384
setterDeprecationStatus: null
385+
isInline: false
384386

385387
KaConstructorSymbol:
386388
annotations: []

0 commit comments

Comments
 (0)