-
-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66a998f
commit 0e6adfc
Showing
4 changed files
with
76 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# frozen_string_literal: true | ||
|
||
require "byebug/command" | ||
require "byebug/helpers/parse" | ||
|
||
module Byebug | ||
# | ||
# Allows the user to continue execution until the next breakpoint, if | ||
# the breakpoint file or line be different, stop again | ||
# | ||
class ContinueBreakpointCommand < Command | ||
include Helpers::ParseHelper | ||
|
||
class << self | ||
attr_writer :file_line, :file_path | ||
|
||
def file_line | ||
@file_line ||= 0 | ||
end | ||
|
||
def file_path | ||
@file_path ||= "" | ||
end | ||
end | ||
|
||
def self.regexp | ||
/^\s* c(?:ont(?:inue)?_)?(?:b(?:reak(?:point)?)?) \s*$/x | ||
end | ||
|
||
def self.description | ||
<<-DESCRIPTION | ||
c[ont[inue]_]b[reak[point]] | ||
#{short_description} | ||
DESCRIPTION | ||
end | ||
|
||
def self.short_description | ||
"Runs until the same breakpoint, if breakpoint change stop again" | ||
end | ||
|
||
def keep_execution(file, line) | ||
[self.class.file_path, self.class.file_line] == [file, line] | ||
end | ||
|
||
def reset_attributes | ||
self.class.always_run = 0 | ||
end | ||
|
||
def auto_run(frame) | ||
return false unless self.class.always_run == 2 | ||
|
||
keep_execution(frame.file, frame.line) ? processor.proceed! : reset_attributes | ||
true | ||
end | ||
|
||
def execute | ||
return if auto_run frame | ||
|
||
self.class.always_run = 2 | ||
self.class.file_path = frame.file | ||
self.class.file_line = frame.line | ||
|
||
processor.proceed! | ||
Byebug.stop if Byebug.stoppable? | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters