class DEBUGGER__::SourceRepository

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/debug/source_repository.rbs

class DEBUGGER__::SourceRepository
  def add: (RubyVM::InstructionSequence iseq, nil src) -> Array[String]
  def add: (RubyVM::InstructionSequence iseq, nil src) -> Array[String]
end

def add iseq, src

Experimental RBS support (using type sampling data from the type_fusion project).

def add: (RubyVM::InstructionSequence iseq, nil src) -> TrueClass

This signature was generated using 2 samples from 1 application.

def add iseq, src
  # only manage loaded file names
  if (path = (iseq.absolute_path || iseq.path)) && File.exist?(path)
    if @loaded_file_map.has_key? path
      return path, true # reloaded
    else
      @loaded_file_map[path] = path
      return path, false
    end
  end
end

def add iseq, src

Experimental RBS support (using type sampling data from the type_fusion project).

def add: (RubyVM::InstructionSequence iseq, nil src) -> TrueClass

This signature was generated using 2 samples from 1 application.

def add iseq, src
  path = (iseq.absolute_path || iseq.path)
  if path && File.exist?(path)
    reloaded = @files.has_key? path
    if src
      add_iseq iseq, src
      return path, reloaded
    else
      add_path path
      return path, reloaded
    end
  else
    add_iseq iseq, src
    nil
  end
end

def add_iseq iseq, src

def add_iseq iseq, src
 iseq.first_line
e > 1
= ("\n" * (line - 1)) + src
rcInfo.new(src.each_line.map{|l| l.chomp})
eq(iseq).each{|e|
stance_variable_set(:@debugger_si, si)
eeze

def add_path path

def add_path path
nes = File.readlines(path, chomp: true)
[path] = SrcInfo.new(src_lines)
ystemCallError

def all_iseq iseq, rs = []

def all_iseq iseq, rs = []
iseq
ach_child{|ci|
iseq(ci, rs)

def file_src iseq

def file_src iseq
  if (path = (iseq.absolute_path || iseq.path)) && File.exist?(path)
    File.readlines(path, chomp: true)
  end
end

def get iseq

def get iseq
  return unless iseq
  if CONFIG[:show_evaledsrc]
    orig_src(iseq) || file_src(iseq)
  else
    file_src(iseq) || orig_src(iseq)
  end
end

def get_colored iseq

def get_colored iseq
  if lines = @cmap[iseq]
    lines
  else
    if src_lines = get(iseq)
      @cmap[iseq] = colorize_code(src_lines.join("\n")).lines
    else
      nil
    end
  end
end

def get_colored iseq

def get_colored iseq
  if si = get_si(iseq)
    si.colored || begin
      si.colored = colorize_code(si.src.join("\n")).lines
    end
  end
end

def get_si iseq

def get_si iseq
 unless iseq
q.instance_variable_defined?(:@debugger_si)
.instance_variable_get(:@debugger_si)
@files.has_key?(path = (iseq.absolute_path || iseq.path))
es[path]
path
path(path)

def initialize

def initialize
  # cache
  @cmap = ObjectSpace::WeakMap.new
  @loaded_file_map = {} # path => nil
end

def initialize

def initialize
  @files = {} # filename => SrcInfo
end

def orig_src iseq

def orig_src iseq
  lines = iseq.script_lines&.map(&:chomp)
  line = iseq.first_line
  if line > 1
    [*([''] * (line - 1)), *lines]
  else
    lines
  end
end

def orig_src iseq

def orig_src iseq
  if si = get_si(iseq)
    si.src
  end
end