Class: Ikra::TypeInference::ObjectTracer::RootsFinder
- Inherits:
-
Symbolic::Visitor
- Object
- Symbolic::Visitor
- Ikra::TypeInference::ObjectTracer::RootsFinder
- Defined in:
- lib/types/inference/object_tracer.rb
Overview
Finds all roots (including dependent commands) of a command.
Instance Attribute Summary collapse
-
#roots ⇒ Object
readonly
Returns the value of attribute roots.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ RootsFinder
constructor
A new instance of RootsFinder.
- #visit_array_command(command) ⇒ Object
- #visit_array_identity_command(command) ⇒ Object
Methods inherited from Symbolic::Visitor
#visit_array_combine_command, #visit_array_host_section_command, #visit_array_in_host_section_command, #visit_array_index_command, #visit_array_reduce_command, #visit_array_select_command, #visit_array_stencil_command, #visit_array_zip_command, #visit_fixed_size_array_in_host_section_command
Constructor Details
#initialize ⇒ RootsFinder
Returns a new instance of RootsFinder.
146 147 148 |
# File 'lib/types/inference/object_tracer.rb', line 146 def initialize @roots = Set.new end |
Instance Attribute Details
#roots ⇒ Object (readonly)
Returns the value of attribute roots.
138 139 140 |
# File 'lib/types/inference/object_tracer.rb', line 138 def roots @roots end |
Class Method Details
.process(command) ⇒ Object
140 141 142 143 144 |
# File 'lib/types/inference/object_tracer.rb', line 140 def self.process(command) instance = self.new command.accept(instance) instance.roots end |
Instance Method Details
#visit_array_command(command) ⇒ Object
150 151 152 |
# File 'lib/types/inference/object_tracer.rb', line 150 def visit_array_command(command) @roots.merge(command.lexical_externals.values) end |
#visit_array_identity_command(command) ⇒ Object
154 155 156 157 |
# File 'lib/types/inference/object_tracer.rb', line 154 def visit_array_identity_command(command) super @roots.merge(command.target) end |