Class: AdLint::Cpp::MacroReplacementContext

Inherits:
Object
  • Object
show all
Defined in:
lib/adlint/cpp/macro.rb

Instance Method Summary collapse

Constructor Details

#initializeMacroReplacementContext

Returns a new instance of MacroReplacementContext.



647
648
649
# File 'lib/adlint/cpp/macro.rb', line 647

def initialize
  @hide_sets = Hash.new { |hash, key| hash[key] = Set.new }
end

Instance Method Details

#add_to_hide_set(orig_tok, new_toks, macro_name) ⇒ Object



651
652
653
654
655
656
# File 'lib/adlint/cpp/macro.rb', line 651

def add_to_hide_set(orig_tok, new_toks, macro_name)
  new_toks.each do |new_tok|
    @hide_sets[new_tok].merge(@hide_sets[orig_tok])
    @hide_sets[new_tok].add(macro_name)
  end
end

#hidden?(tok, macro_name) ⇒ Boolean

Returns:

  • (Boolean)


658
659
660
# File 'lib/adlint/cpp/macro.rb', line 658

def hidden?(tok, macro_name)
  @hide_sets[tok].include?(macro_name)
end