[Analysis API] add KDocs for KtTypeScopeProvider
This commit is contained in:
+20
@@ -65,6 +65,26 @@ public interface KtScopeProviderMixIn : KtAnalysisSessionMixIn {
|
|||||||
public fun List<KtScope>.asCompositeScope(): KtScope =
|
public fun List<KtScope>.asCompositeScope(): KtScope =
|
||||||
withValidityAssertion { analysisSession.scopeProvider.getCompositeScope(this) }
|
withValidityAssertion { analysisSession.scopeProvider.getCompositeScope(this) }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a [KtTypeScope] for a given [KtType].
|
||||||
|
* The type scope will include all members which are declared and callable on a given type.
|
||||||
|
*
|
||||||
|
* Comparing to the [KtScope], in the [KtTypeScope] all use-site type parameters are substituted.
|
||||||
|
*
|
||||||
|
* Consider the following code
|
||||||
|
* ```
|
||||||
|
* fun foo(list: List<String>) {
|
||||||
|
* list // get KtTypeScope for it
|
||||||
|
* }
|
||||||
|
*```
|
||||||
|
*
|
||||||
|
* Inside the `LIST_KT_ELEMENT.getKtType().getTypeScope()` would contain the `get(i: Int): String` method with substituted type `T = String`
|
||||||
|
*
|
||||||
|
* @return type scope for the given type if given `KtType` is not error type, `null` otherwise.
|
||||||
|
*
|
||||||
|
* @see KtTypeScope
|
||||||
|
* @see KtTypeProviderMixIn.getKtType
|
||||||
|
*/
|
||||||
public fun KtType.getTypeScope(): KtTypeScope? =
|
public fun KtType.getTypeScope(): KtTypeScope? =
|
||||||
withValidityAssertion { analysisSession.scopeProvider.getTypeScope(this) }
|
withValidityAssertion { analysisSession.scopeProvider.getTypeScope(this) }
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,20 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.analysis.api.scopes
|
package org.jetbrains.kotlin.analysis.api.scopes
|
||||||
|
|
||||||
import org.jetbrains.kotlin.analysis.api.symbols.KtCallableSymbol
|
|
||||||
import org.jetbrains.kotlin.analysis.api.symbols.KtClassifierSymbol
|
import org.jetbrains.kotlin.analysis.api.symbols.KtClassifierSymbol
|
||||||
import org.jetbrains.kotlin.analysis.api.symbols.KtConstructorSymbol
|
import org.jetbrains.kotlin.analysis.api.symbols.KtConstructorSymbol
|
||||||
import org.jetbrains.kotlin.analysis.api.signatures.KtCallableSignature
|
import org.jetbrains.kotlin.analysis.api.signatures.KtCallableSignature
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A scope inside which use-site type-parameters of callable declarations may be substituted. Such declarations are represented as [KtCallableSignature].
|
||||||
|
*
|
||||||
|
* @see org.jetbrains.kotlin.analysis.api.components.KtScopeProviderMixIn.getTypeScope
|
||||||
|
* @see KtCallableSignature
|
||||||
|
*/
|
||||||
public interface KtTypeScope : KtScopeLike {
|
public interface KtTypeScope : KtScopeLike {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a sequence of [KtCallableSymbol] which current scope contain if declaration name matches [nameFilter]
|
* Return a sequence of [KtCallableSignature] which current scope contain if declaration name matches [nameFilter].
|
||||||
*/
|
*/
|
||||||
public fun getCallableSignatures(nameFilter: KtScopeNameFilter = { true }): Sequence<KtCallableSignature<*>>
|
public fun getCallableSignatures(nameFilter: KtScopeNameFilter = { true }): Sequence<KtCallableSignature<*>>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user