class TypeProf::Core::Vertex
Attributes
Public Class Methods
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/graph/vertex.rb, line 125 def initialize(origin) # Note that origin is just for debug. # When an AST node is reused, the value of the origin will be invalid. case origin when AST::Node when RBS::AST::Declarations::Base when ValueEntity when ActualArguments when Array when Symbol else raise "unknown class: #{ origin.class }" end @next_vtxs = Set[] super({}) end
Calls superclass method
TypeProf::Core::BasicVertex::new
Public Instance Methods
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/graph/vertex.rb, line 190 def add_edge(genv, nvtx) @next_vtxs << nvtx nvtx.on_type_added(genv, self, @types.keys) unless @types.empty? end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/graph/vertex.rb, line 184 def new_vertex(genv, origin) nvtx = Vertex.new(origin) add_edge(genv, nvtx) nvtx end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/graph/vertex.rb, line 144 def on_type_added(genv, src_var, added_types) new_added_types = [] added_types.each do |ty| if @types[ty] @types[ty] << src_var else set = Set[] begin @types[ty] = set rescue @types_to_be_added[ty] = set end set << src_var new_added_types << ty end end unless new_added_types.empty? @next_vtxs.each do |nvtx| nvtx.on_type_added(genv, self, new_added_types) end end end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/graph/vertex.rb, line 167 def on_type_removed(genv, src_var, removed_types) new_removed_types = [] removed_types.each do |ty| raise "!!! not implemented" if @types_to_be_added[ty] @types[ty].delete(src_var) || raise if @types[ty].empty? @types.delete(ty) || raise new_removed_types << ty end end unless new_removed_types.empty? @next_vtxs.each do |nvtx| nvtx.on_type_removed(genv, self, new_removed_types) end end end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/graph/vertex.rb, line 195 def remove_edge(genv, nvtx) @next_vtxs.delete(nvtx) || raise nvtx.on_type_removed(genv, self, @types.keys) unless @types.empty? end