123456789_123456789_123456789_123456789_123456789_

Class: TypeProf::Scratch::VarTable

Relationships & Source Files
Namespace Children
Classes:
Inherits: Object
Defined in: lib/typeprof/analyzer.rb

Class Method Summary

Instance Method Summary

Constructor Details

.newVarTable

[ GitHub ]

  
# File 'lib/typeprof/analyzer.rb', line 852

def initialize
  @tbl = {}
end

Instance Method Details

#add_read!(site, ep, &ctn)

[ GitHub ]

  
# File 'lib/typeprof/analyzer.rb', line 856

def add_read!(site, ep, &ctn)
  entry = @tbl[site] ||= Entry.new(false, {}, Type.bot, Utils::MutableSet.new, 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, entry.write_eps]
end

#add_write!(site, ty, ep, scratch)

[ GitHub ]

  
# File 'lib/typeprof/analyzer.rb', line 865

def add_write!(site, ty, ep, scratch)
  entry = @tbl[site] ||= Entry.new(!ep, {}, Type.bot, Utils::MutableSet.new, 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
    entry.write_eps << ep
  end
  entry.type = entry.type.union(ty)
  entry.read_continuations.each do |read_ep, ctn|
    ctn[ty, read_ep, ep ? [ep] : []]
  end
end

#dump

[ GitHub ]

  
# File 'lib/typeprof/analyzer.rb', line 883

def dump
  @tbl
end