Refactoring: call apply method without returning intermediate object
(cherry picked from commit a2f7e00)
This commit is contained in:
committed by
Nikolay Krasko
parent
78525ed7c6
commit
bd2ddbafb3
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.idea.debugger.stepping;
|
|||||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||||
import com.intellij.debugger.engine.SuspendContextImpl;
|
import com.intellij.debugger.engine.SuspendContextImpl;
|
||||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||||
import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
|
|
||||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||||
import com.intellij.debugger.jdi.ThreadReferenceProxyImpl;
|
import com.intellij.debugger.jdi.ThreadReferenceProxyImpl;
|
||||||
@@ -38,7 +37,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.psi.KtFunctionLiteral;
|
import org.jetbrains.kotlin.psi.KtFunctionLiteral;
|
||||||
import org.jetbrains.kotlin.psi.KtNamedFunction;
|
import org.jetbrains.kotlin.psi.KtNamedFunction;
|
||||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -63,14 +61,12 @@ public class DebuggerSteppingHelper {
|
|||||||
kotlinSourcePosition
|
kotlinSourcePosition
|
||||||
);
|
);
|
||||||
|
|
||||||
SuspendContextCommandImpl command = action.createCommand(debugProcess, suspendContext, ignoreBreakpoints);
|
|
||||||
|
|
||||||
createStepRequest(
|
createStepRequest(
|
||||||
suspendContext, getContextThread(),
|
suspendContext, getContextThread(),
|
||||||
debugProcess.getVirtualMachineProxy().eventRequestManager(),
|
debugProcess.getVirtualMachineProxy().eventRequestManager(),
|
||||||
StepRequest.STEP_LINE, StepRequest.STEP_OUT);
|
StepRequest.STEP_LINE, StepRequest.STEP_OUT);
|
||||||
|
|
||||||
command.contextAction();
|
action.apply(debugProcess, suspendContext, ignoreBreakpoints);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,9 +74,6 @@ public class DebuggerSteppingHelper {
|
|||||||
}
|
}
|
||||||
catch (EvaluateException ignored) {
|
catch (EvaluateException ignored) {
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
|
||||||
throw ExceptionUtilsKt.rethrow(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -105,23 +98,18 @@ public class DebuggerSteppingHelper {
|
|||||||
inlineArgument
|
inlineArgument
|
||||||
);
|
);
|
||||||
|
|
||||||
SuspendContextCommandImpl command = action.createCommand(debugProcess, suspendContext, ignoreBreakpoints);
|
|
||||||
createStepRequest(
|
createStepRequest(
|
||||||
suspendContext, getContextThread(),
|
suspendContext, getContextThread(),
|
||||||
debugProcess.getVirtualMachineProxy().eventRequestManager(),
|
debugProcess.getVirtualMachineProxy().eventRequestManager(),
|
||||||
StepRequest.STEP_LINE, StepRequest.STEP_OUT);
|
StepRequest.STEP_LINE, StepRequest.STEP_OUT);
|
||||||
|
|
||||||
command.contextAction();
|
action.apply(debugProcess, suspendContext, ignoreBreakpoints);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
debugProcess.createStepOverCommand(suspendContext, ignoreBreakpoints).contextAction();
|
debugProcess.createStepOverCommand(suspendContext, ignoreBreakpoints).contextAction();
|
||||||
}
|
}
|
||||||
catch (EvaluateException ignored) {
|
catch (EvaluateException ignored) {
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
throw ExceptionUtilsKt.rethrow(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+8
-1
@@ -328,7 +328,14 @@ sealed class Action(val position: XSourcePositionImpl?) {
|
|||||||
class STEP_OUT: Action(null)
|
class STEP_OUT: Action(null)
|
||||||
class RUN_TO_CURSOR(position: XSourcePositionImpl): Action(position)
|
class RUN_TO_CURSOR(position: XSourcePositionImpl): Action(position)
|
||||||
|
|
||||||
fun createCommand(
|
fun apply(debugProcess: DebugProcessImpl,
|
||||||
|
suspendContext: SuspendContextImpl,
|
||||||
|
ignoreBreakpoints: Boolean) {
|
||||||
|
val command = createCommand(debugProcess, suspendContext, ignoreBreakpoints)
|
||||||
|
command.contextAction()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createCommand(
|
||||||
debugProcess: DebugProcessImpl,
|
debugProcess: DebugProcessImpl,
|
||||||
suspendContext: SuspendContextImpl,
|
suspendContext: SuspendContextImpl,
|
||||||
ignoreBreakpoints: Boolean
|
ignoreBreakpoints: Boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user