class TypeProf::Core::NilFilter
Attributes
allow_nil[R]
next_vtx[R]
Public Class Methods
new(genv, node, prev_vtx, allow_nil)
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/graph/filter.rb, line 9 def initialize(genv, node, prev_vtx, allow_nil) @node = node @next_vtx = Vertex.new(node) @allow_nil = allow_nil prev_vtx.add_edge(genv, self) end
Public Instance Methods
filter(types, nil_type)
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/graph/filter.rb, line 18 def filter(types, nil_type) types.select {|ty| (ty == nil_type) == @allow_nil } end
on_type_added(genv, src_var, added_types)
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/graph/filter.rb, line 22 def on_type_added(genv, src_var, added_types) types = filter(added_types, genv.nil_type) @next_vtx.on_type_added(genv, self, types) unless types.empty? end
on_type_removed(genv, src_var, removed_types)
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/graph/filter.rb, line 27 def on_type_removed(genv, src_var, removed_types) types = filter(removed_types, genv.nil_type) @next_vtx.on_type_removed(genv, self, types) unless types.empty? end
to_s()
click to toggle source
@@new_id = 0
# File typeprof-0.30.1/lib/typeprof/core/graph/filter.rb, line 34 def to_s "NF#{ @id ||= $new_id += 1 } -> #{ @next_vtx }" end