class TypeProf::Core::Source

Public Class Methods

new(*tys) click to toggle source
Calls superclass method TypeProf::Core::BasicVertex::new
# File typeprof-0.30.1/lib/typeprof/core/graph/vertex.rb, line 90
def initialize(*tys)
  types = {}
  tys.each do |ty|
    raise ty.inspect unless ty.is_a?(Type)
    types[ty] = true
  end
  super(types)
end

Public Instance Methods

add_edge(genv, nvtx) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/graph/vertex.rb, line 112
def add_edge(genv, nvtx)
  nvtx.on_type_added(genv, self, @types.keys)
end
inspect()
Alias for: to_s
new_vertex(genv, origin) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/graph/vertex.rb, line 106
def new_vertex(genv, origin)
  nvtx = Vertex.new(origin)
  add_edge(genv, nvtx)
  nvtx
end
on_type_added(genv, src_var, added_types) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/graph/vertex.rb, line 99
def on_type_added(genv, src_var, added_types)
  # TODO: need to report error?
end
on_type_removed(genv, src_var, removed_types) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/graph/vertex.rb, line 103
def on_type_removed(genv, src_var, removed_types)
end
remove_edge(genv, nvtx) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/graph/vertex.rb, line 116
def remove_edge(genv, nvtx)
  nvtx.on_type_removed(genv, self, @types.keys)
end
show() click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/graph/vertex.rb, line 120
def show
  Fiber[:show_rec] ||= Set[]
  if Fiber[:show_rec].include?(self)
    "...(recursive)..."
  else
    begin
      Fiber[:show_rec] << self
      @types.empty? ? "untyped" : @types.keys.map {|ty| ty.show }.sort.join(" | ")
    ensure
      Fiber[:show_rec].delete(self) || raise
    end
  end
end
to_s() click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/graph/vertex.rb, line 134
def to_s
  "<src:#{ show }>"
end
Also aliased as: inspect