Pre-count line numbers
(cherry picked from commit 5412723e023768d308190f43edd5378476ad35c4)
This commit is contained in:
+8
-5
@@ -62,6 +62,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
|||||||
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCallImpl
|
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCallImpl
|
||||||
import org.jetbrains.kotlin.resolve.inline.InlineUtil
|
import org.jetbrains.kotlin.resolve.inline.InlineUtil
|
||||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||||
|
import org.jetbrains.kotlin.utils.keysToMap
|
||||||
|
|
||||||
class KotlinSteppingCommandProvider : JvmSteppingCommandProvider() {
|
class KotlinSteppingCommandProvider : JvmSteppingCommandProvider() {
|
||||||
override fun getStepOverCommand(
|
override fun getStepOverCommand(
|
||||||
@@ -322,18 +323,22 @@ fun getStepOverAction(
|
|||||||
frameProxy: StackFrameProxyImpl,
|
frameProxy: StackFrameProxyImpl,
|
||||||
isDexDebug: Boolean
|
isDexDebug: Boolean
|
||||||
): Action {
|
): Action {
|
||||||
val computedReferenceType = location.declaringType() ?: return Action.STEP_OVER()
|
location.declaringType() ?: return Action.STEP_OVER()
|
||||||
|
|
||||||
val project = file.project
|
val project = file.project
|
||||||
|
|
||||||
fun Location.ktLineNumber() = noStrataLineNumber(this, isDexDebug, project, true)
|
val methodLocations = location.method().allLineLocations()
|
||||||
|
val ktLineNumbers = methodLocations.keysToMap { noStrataLineNumber(it, isDexDebug, project, true) }
|
||||||
|
|
||||||
|
fun Location.ktLineNumber(): Int = ktLineNumbers[this] ?: noStrataLineNumber(this, isDexDebug, project, true)
|
||||||
|
|
||||||
fun isLocationSuitable(nextLocation: Location): Boolean {
|
fun isLocationSuitable(nextLocation: Location): Boolean {
|
||||||
if (nextLocation.method() != location.method()) {
|
if (nextLocation.method() != location.method()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextLocation.ktLineNumber() !in range) {
|
val ktLineNumber = nextLocation.ktLineNumber()
|
||||||
|
if (ktLineNumber !in range) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,8 +350,6 @@ fun getStepOverAction(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val methodLocations = location.method().allLineLocations()
|
|
||||||
|
|
||||||
fun isBackEdgeLocation(): Boolean {
|
fun isBackEdgeLocation(): Boolean {
|
||||||
val previousSuitableLocation = methodLocations.reversed()
|
val previousSuitableLocation = methodLocations.reversed()
|
||||||
.dropWhile { it != location }
|
.dropWhile { it != location }
|
||||||
|
|||||||
Reference in New Issue
Block a user