Skip to content

Commit

Permalink
irb:rdbg cleanups (#697)
Browse files Browse the repository at this point in the history
* Remove unused method and constant from IRB::Debug

* Update comments
  • Loading branch information
st0012 authored Aug 29, 2023
1 parent 036ec31 commit 98914a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
7 changes: 3 additions & 4 deletions lib/irb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,9 @@ def initialize(workspace = nil, input_method = nil)
@scanner = RubyLex.new(@context)
end

# A hook point for `debug` command's TracePoint after :IRB_EXIT as well as its clean-up
# A hook point for `debug` command's breakpoint after :IRB_EXIT as well as its clean-up
def debug_break
# it means the debug command is executed
# it means the debug integration has been activated
if defined?(DEBUGGER__) && DEBUGGER__.respond_to?(:capture_frames_without_irb)
# after leaving this initial breakpoint, revert the capture_frames patch
DEBUGGER__.singleton_class.send(:alias_method, :capture_frames, :capture_frames_without_irb)
Expand Down Expand Up @@ -547,14 +547,13 @@ def eval_input
each_top_level_statement do |statement, line_no|
signal_status(:IN_EVAL) do
begin
# If the integration with debugger is activated, we need to handle certain input differently
# If the integration with debugger is activated, we return certain input if it should be dealt with by debugger
if @context.with_debugger && statement.should_be_handled_by_debugger?
return statement.code
end

@context.evaluate(statement.evaluable_code, line_no)

# Don't echo if the line ends with a semicolon
if @context.echo? && !statement.suppresses_echo?
if statement.is_assignment?
if @context.echo_on_assignment?
Expand Down
12 changes: 0 additions & 12 deletions lib/irb/debug.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

module IRB
module Debug
BINDING_IRB_FRAME_REGEXPS = [
'<internal:prelude>',
binding.method(:irb).source_location.first,
].map { |file| /\A#{Regexp.escape(file)}:\d+:in `irb'\z/ }
IRB_DIR = File.expand_path('..', __dir__)

class << self
Expand Down Expand Up @@ -76,14 +72,6 @@ def configure_irb_for_debugger(irb)
irb.context.irb_name += ":rdbg"
end

def binding_irb?
caller.any? do |frame|
BINDING_IRB_FRAME_REGEXPS.any? do |regexp|
frame.match?(regexp)
end
end
end

module SkipPathHelperForIRB
def skip_internal_path?(path)
# The latter can be removed once https://github.com/ruby/debug/issues/866 is resolved
Expand Down

0 comments on commit 98914a9

Please sign in to comment.