FIR IDE: fix building of local declaration symbols
This commit is contained in:
+4
@@ -97,6 +97,10 @@ internal class FirModuleResolveStateImpl(
|
||||
rootModuleSession.firIdeProvider.symbolProvider,
|
||||
sessionProvider.getModuleCache(ktDeclaration.getModuleInfo() as ModuleSourceInfo)
|
||||
)
|
||||
if (container.resolvePhase < FirResolvePhase.BODY_RESOLVE) {
|
||||
val cache = (container.session as FirIdeSourcesSession).cache
|
||||
firLazyDeclarationResolver.lazyResolveDeclaration(container, cache, FirResolvePhase.BODY_RESOLVE, checkPCE = false /*TODO*/)
|
||||
}
|
||||
val firDeclaration = FirElementFinder.findElementIn<FirDeclaration>(container) { firDeclaration ->
|
||||
firDeclaration.psi == ktDeclaration
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
fun yyy() {
|
||||
val q = 10
|
||||
fun aaa() {}
|
||||
|
||||
class F {}
|
||||
}
|
||||
|
||||
// SYMBOLS:
|
||||
/*
|
||||
KtFirLocalVariableSymbol:
|
||||
isVal: true
|
||||
name: q
|
||||
origin: SOURCE
|
||||
symbolKind: LOCAL
|
||||
type: kotlin/Int
|
||||
|
||||
KtFirFunctionSymbol:
|
||||
annotations: []
|
||||
callableIdIfNonLocal: null
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: aaa
|
||||
origin: SOURCE
|
||||
receiverType: null
|
||||
symbolKind: LOCAL
|
||||
type: kotlin/Unit
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: LOCAL
|
||||
|
||||
KtFirClassOrObjectSymbol:
|
||||
annotations: []
|
||||
classIdIfNonLocal: null
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: F
|
||||
origin: SOURCE
|
||||
primaryConstructor: KtFirConstructorSymbol(<constructor>)
|
||||
superTypes: [kotlin/Any]
|
||||
symbolKind: LOCAL
|
||||
typeParameters: []
|
||||
visibility: LOCAL
|
||||
|
||||
KtFirFunctionSymbol:
|
||||
annotations: []
|
||||
callableIdIfNonLocal: yyy
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isSuspend: false
|
||||
modality: FINAL
|
||||
name: yyy
|
||||
origin: SOURCE
|
||||
receiverType: null
|
||||
symbolKind: TOP_LEVEL
|
||||
type: kotlin/Unit
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: PUBLIC
|
||||
*/
|
||||
+5
@@ -67,4 +67,9 @@ public class SymbolsByPsiBuildingTestGenerated extends AbstractSymbolsByPsiBuild
|
||||
public void testImplicitReturn() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByPsi/implicitReturn.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localDeclarations.kt")
|
||||
public void testLocalDeclarations() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByPsi/localDeclarations.kt");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user