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.



686
687
688
# File 'lib/adlint/cpp/macro.rb', line 686

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



690
691
692
693
694
695
# File 'lib/adlint/cpp/macro.rb', line 690

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)


697
698
699
# File 'lib/adlint/cpp/macro.rb', line 697

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