Class: OrigenTesters::ATP::Processors::RedundantConditionRemover
- Inherits:
-
OrigenTesters::ATP::Processor
- Object
- OrigenTesters::ATP::Processor
- OrigenTesters::ATP::Processors::RedundantConditionRemover
- Defined in:
- lib/origen_testers/atp/processors/redundant_condition_remover.rb
Overview
Removes any conditions nodes that are nested within other condition nodes that specify the same condition
Instance Method Summary collapse
Methods inherited from OrigenTesters::ATP::Processor
#add_global_flag, #clean_flag, #extract_globals, #extract_volatiles, #global_flag?, #global_flags, #handler_missing, #process, #process_all, #volatile?, #volatile_flags
Instance Method Details
#on_condition_node(node) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/origen_testers/atp/processors/redundant_condition_remover.rb', line 11 def on_condition_node(node) sig = [node.type, node.to_a[0]] if @conditions.include?(sig) flag, *nodes = *node node.updated(:inline, process_all(nodes)) else @conditions << sig node = node.updated(nil, process_all(node.children)) @conditions.pop node end end |
#run(node) ⇒ Object
6 7 8 9 |
# File 'lib/origen_testers/atp/processors/redundant_condition_remover.rb', line 6 def run(node) @conditions = [] process(node) end |