Class: AdLint::Ld::TypedefMap
- Inherits:
-
Object
- Object
- AdLint::Ld::TypedefMap
- Defined in:
- lib/adlint/ld/typedef.rb
Instance Attribute Summary collapse
-
#composing_fpaths ⇒ Object
readonly
Returns the value of attribute composing_fpaths.
Instance Method Summary collapse
- #add(typedef) ⇒ Object
- #all_typedefs ⇒ Object
-
#initialize ⇒ TypedefMap
constructor
A new instance of TypedefMap.
- #lookup(typedef_name) ⇒ Object
Constructor Details
#initialize ⇒ TypedefMap
Returns a new instance of TypedefMap.
61 62 63 64 |
# File 'lib/adlint/ld/typedef.rb', line 61 def initialize @name_index = Hash.new { |hash, key| hash[key] = Set.new } @composing_fpaths = Set.new end |
Instance Attribute Details
#composing_fpaths ⇒ Object (readonly)
Returns the value of attribute composing_fpaths.
66 67 68 |
# File 'lib/adlint/ld/typedef.rb', line 66 def composing_fpaths @composing_fpaths end |
Instance Method Details
#add(typedef) ⇒ Object
68 69 70 71 |
# File 'lib/adlint/ld/typedef.rb', line 68 def add(typedef) @name_index[typedef.name].add(typedef) @composing_fpaths.add(typedef.location.fpath) end |
#all_typedefs ⇒ Object
73 74 75 76 77 |
# File 'lib/adlint/ld/typedef.rb', line 73 def all_typedefs @name_index.values.each_with_object([]) do |typedefs, all| all.concat(typedefs.to_a) end end |
#lookup(typedef_name) ⇒ Object
79 80 81 |
# File 'lib/adlint/ld/typedef.rb', line 79 def lookup(typedef_name) @name_index[typedef_name].to_a end |