class Bpl::Selection
Public Instance Methods
run!(program)
click to toggle source
# File lib/bpl/passes/utility/selection.rb, line 12 def run! program program.declarations.each do |d| names = d.names if names.empty? names = d.map {|id| id.name if id.is_a?(Identifier)}.compact end if names.any? {|n| n.match(/#{pattern}/)} if d.instance_variable_defined? "@names" d.instance_variable_set "@names", d.names.select{|n| n.match(/#{pattern}/)} end else d.remove end end end