In Files

  • typeprof-0.12.0/lib/typeprof/analyzer.rb

Class/Module Index [+]

Quicksearch

TypeProf::Scratch::VarTable

Constants

Entry

Public Class Methods

new() click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/analyzer.rb, line 705
def initialize
  @tbl = {}
end
            

Public Instance Methods

add_read!(site, ep, &ctn) click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/analyzer.rb, line 709
def add_read!(site, ep, &ctn)
  entry = @tbl[site] ||= Entry.new(false, {}, Type.bot, Utils::MutableSet.new)
  entry.read_continuations[ep] = ctn
  entry.absolute_paths << ep.ctx.iseq.absolute_path if ep.ctx.is_a?(Context)
  ty = entry.type
  ty = Type.nil if ty == Type.bot
  ctn[ty, ep]
end
            
add_write!(site, ty, ep, scratch) click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/analyzer.rb, line 718
def add_write!(site, ty, ep, scratch)
  entry = @tbl[site] ||= Entry.new(!ep, {}, Type.bot, Utils::MutableSet.new)
  if ep
    if entry.rbs_declared
      unless Type.match?(ty, entry.type)
        scratch.warn(ep, "inconsistent assignment to RBS-declared variable")
        return
      end
    end
    entry.absolute_paths << ep.ctx.iseq.absolute_path
  end
  entry.type = entry.type.union(ty)
  entry.read_continuations.each do |ep, ctn|
    ctn[ty, ep]
  end
end
            
dump() click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/analyzer.rb, line 735
def dump
  @tbl
end