Skip to content

Commit 98914a9

Browse files
authored
irb:rdbg cleanups (#697)
* Remove unused method and constant from IRB::Debug * Update comments
1 parent 036ec31 commit 98914a9

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

lib/irb.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,9 @@ def initialize(workspace = nil, input_method = nil)
439439
@scanner = RubyLex.new(@context)
440440
end
441441

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

555555
@context.evaluate(statement.evaluable_code, line_no)
556556

557-
# Don't echo if the line ends with a semicolon
558557
if @context.echo? && !statement.suppresses_echo?
559558
if statement.is_assignment?
560559
if @context.echo_on_assignment?

lib/irb/debug.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

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

117
class << self
@@ -76,14 +72,6 @@ def configure_irb_for_debugger(irb)
7672
irb.context.irb_name += ":rdbg"
7773
end
7874

79-
def binding_irb?
80-
caller.any? do |frame|
81-
BINDING_IRB_FRAME_REGEXPS.any? do |regexp|
82-
frame.match?(regexp)
83-
end
84-
end
85-
end
86-
8775
module SkipPathHelperForIRB
8876
def skip_internal_path?(path)
8977
# The latter can be removed once https://github.com/ruby/debug/issues/866 is resolved

0 commit comments

Comments
 (0)