[Analysis API] Fix 'getContainingDeclaration()' for foreign values
Foreign values (such as '_DebugLabel' properties contributed by the debugger) don't have a parent (or a valid source element in general). ^KTIJ-27382 Fixed
This commit is contained in:
+1
-1
@@ -189,7 +189,7 @@ private class CodeFragmentCapturedValueVisitor(
|
||||
if (symbol.isLocal) {
|
||||
val isCrossingInlineBounds = isCrossingInlineBounds(element, symbol)
|
||||
val capturedValue = when {
|
||||
symbol.fir.foreignValueMarker == true -> CodeFragmentCapturedValue.ForeignValue(symbol.name, isCrossingInlineBounds)
|
||||
symbol.isForeignValue -> CodeFragmentCapturedValue.ForeignValue(symbol.name, isCrossingInlineBounds)
|
||||
symbol.hasDelegate -> CodeFragmentCapturedValue.LocalDelegate(symbol.name, symbol.isMutated, isCrossingInlineBounds)
|
||||
else -> CodeFragmentCapturedValue.Local(symbol.name, symbol.isMutated, isCrossingInlineBounds)
|
||||
}
|
||||
|
||||
+4
-1
@@ -37,7 +37,10 @@ val FirSession.codeFragmentScopeProvider: CodeFragmentScopeProvider by FirSessio
|
||||
|
||||
private object ForeignValueMarkerDataKey : FirDeclarationDataKey()
|
||||
|
||||
var FirProperty.foreignValueMarker: Boolean? by FirDeclarationDataRegistry.data(ForeignValueMarkerDataKey)
|
||||
private var FirProperty.foreignValueMarker: Boolean? by FirDeclarationDataRegistry.data(ForeignValueMarkerDataKey)
|
||||
|
||||
val FirPropertySymbol.isForeignValue: Boolean
|
||||
get() = fir.foreignValueMarker == true
|
||||
|
||||
class CodeFragmentScopeProvider(private val session: FirSession) : FirSessionComponent {
|
||||
private val foreignValueProvider = ForeignValueProviderService.getInstance()
|
||||
|
||||
Reference in New Issue
Block a user