Class: OrigenTesters::ATP::Processors::FlagOptimizer::ExtractRunFlagTable
- Inherits:
-
OrigenTesters::ATP::Processor
- Object
- OrigenTesters::ATP::Processor
- OrigenTesters::ATP::Processors::FlagOptimizer::ExtractRunFlagTable
- Defined in:
- lib/origen_testers/atp/processors/flag_optimizer.rb
Instance Attribute Summary collapse
-
#run_flag_table ⇒ Object
readonly
Hash table of run_flag name with number of times used.
Instance Method Summary collapse
-
#initialize ⇒ ExtractRunFlagTable
constructor
Reset hash table.
-
#on_if_flag(node) ⇒ Object
(also: #on_unless_flag)
For run_flag nodes, increment # of occurrences for specified flag.
Methods inherited from OrigenTesters::ATP::Processor
#add_global_flag, #clean_flag, #extract_globals, #extract_volatiles, #global_flag?, #global_flags, #handler_missing, #process, #process_all, #run, #volatile?, #volatile_flags
Constructor Details
#initialize ⇒ ExtractRunFlagTable
Reset hash table
35 36 37 |
# File 'lib/origen_testers/atp/processors/flag_optimizer.rb', line 35 def initialize @run_flag_table = {}.with_indifferent_access end |
Instance Attribute Details
#run_flag_table ⇒ Object (readonly)
Hash table of run_flag name with number of times used
32 33 34 |
# File 'lib/origen_testers/atp/processors/flag_optimizer.rb', line 32 def run_flag_table @run_flag_table end |
Instance Method Details
#on_if_flag(node) ⇒ Object Also known as: on_unless_flag
For run_flag nodes, increment # of occurrences for specified flag
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/origen_testers/atp/processors/flag_optimizer.rb', line 40 def on_if_flag(node) children = node.children.dup names = children.shift state = node.type == :if_flag Array(names).each do |name| if @run_flag_table[name.to_sym].nil? @run_flag_table[name.to_sym] = 1 else @run_flag_table[name.to_sym] += 1 end end process_all(node.children) end |