Class: AdLint::Ld::TypedefMap

Inherits:
Object
  • Object
show all
Defined in:
lib/adlint/ld/typedef.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTypedefMap

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_fpathsObject (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_typedefsObject



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