Debugger: Hide call-site 'this' in inline functions in Kotlin variables mode (KT-30610)
This commit is contained in:
@@ -111,6 +111,24 @@ class KotlinStackFrame(frame: StackFrameProxyImpl) : JavaStackFrame(StackFrameDe
|
||||
return true
|
||||
}
|
||||
|
||||
return removeCallSiteThisInInlineFunction(evaluationContext, children)
|
||||
}
|
||||
|
||||
private fun removeCallSiteThisInInlineFunction(evaluationContext: EvaluationContextImpl, children: XValueChildrenList): Boolean {
|
||||
val frameProxy = evaluationContext.frameProxy
|
||||
|
||||
val variables = frameProxy?.safeVisibleVariables() ?: return false
|
||||
val inlineDepth = VariableFinder.getInlineDepth(variables)
|
||||
val declarationSiteThis = variables.firstOrNull { v ->
|
||||
val name = v.name()
|
||||
name.endsWith(INLINE_FUN_VAR_SUFFIX) && name.dropInlineSuffix() == AsmUtil.INLINE_DECLARATION_SITE_THIS
|
||||
}
|
||||
|
||||
if (inlineDepth > 0 && declarationSiteThis != null) {
|
||||
ExistingInstanceThis.find(children)?.remove()
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -75,10 +75,7 @@ class VariableFinder(private val context: ExecutionContext) {
|
||||
return EvaluateExceptionUtil.createEvaluateException(message)
|
||||
}
|
||||
|
||||
// org.jetbrains.kotlin.codegen.inline.MethodInliner.prepareNode
|
||||
private const val OUTER_THIS_FOR_INLINE = AsmUtil.THIS + '_'
|
||||
|
||||
val inlinedThisRegex = getLocalVariableNameRegexInlineAware(OUTER_THIS_FOR_INLINE)
|
||||
val inlinedThisRegex = getLocalVariableNameRegexInlineAware(AsmUtil.INLINE_DECLARATION_SITE_THIS)
|
||||
|
||||
private fun getCapturedVariableNameRegex(capturedName: String): Regex {
|
||||
val escapedName = Regex.escape(capturedName)
|
||||
|
||||
Reference in New Issue
Block a user