Class: TypeProf::Core::Source
- Inherits:
-
BasicVertex
- Object
- BasicVertex
- TypeProf::Core::Source
- Defined in:
- lib/typeprof/core/graph/vertex.rb
Instance Attribute Summary
Attributes inherited from BasicVertex
Instance Method Summary collapse
- #add_edge(genv, nvtx) ⇒ Object
-
#initialize(*tys) ⇒ Source
constructor
A new instance of Source.
- #new_vertex(genv, origin) ⇒ Object
- #on_type_added(genv, src_var, added_types) ⇒ Object
- #on_type_removed(genv, src_var, removed_types) ⇒ Object
- #remove_edge(genv, nvtx) ⇒ Object
- #show ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Methods inherited from BasicVertex
Constructor Details
Instance Method Details
#add_edge(genv, nvtx) ⇒ Object
112 113 114 |
# File 'lib/typeprof/core/graph/vertex.rb', line 112 def add_edge(genv, nvtx) nvtx.on_type_added(genv, self, @types.keys) end |
#new_vertex(genv, origin) ⇒ Object
106 107 108 109 110 |
# File '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) ⇒ Object
99 100 101 |
# File '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) ⇒ Object
103 104 |
# File 'lib/typeprof/core/graph/vertex.rb', line 103 def on_type_removed(genv, src_var, removed_types) end |
#remove_edge(genv, nvtx) ⇒ Object
116 117 118 |
# File 'lib/typeprof/core/graph/vertex.rb', line 116 def remove_edge(genv, nvtx) nvtx.on_type_removed(genv, self, @types.keys) end |
#show ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File '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 ⇒ Object Also known as: inspect
134 135 136 |
# File 'lib/typeprof/core/graph/vertex.rb', line 134 def to_s "<src:#{ show }>" end |