Class: AdLint::Ld::FunctionMap
- Inherits:
-
Object
- Object
- AdLint::Ld::FunctionMap
- Defined in:
- lib/adlint/ld/object.rb
Instance Attribute Summary collapse
-
#composing_fpaths ⇒ Object
readonly
Returns the value of attribute composing_fpaths.
Instance Method Summary collapse
- #add_function(fun) ⇒ Object
- #add_function_declaration(fun_dcl) ⇒ Object
- #all_function_declarations ⇒ Object
- #all_functions ⇒ Object
-
#initialize ⇒ FunctionMap
constructor
A new instance of FunctionMap.
- #lookup_function_declarations(fun_name) ⇒ Object
- #lookup_functions(fun_name) ⇒ Object
Constructor Details
#initialize ⇒ FunctionMap
Returns a new instance of FunctionMap.
266 267 268 269 270 |
# File 'lib/adlint/ld/object.rb', line 266 def initialize @def_index = Hash.new { |hash, key| hash[key] = Set.new } @dcl_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.
272 273 274 |
# File 'lib/adlint/ld/object.rb', line 272 def composing_fpaths @composing_fpaths end |
Instance Method Details
#add_function(fun) ⇒ Object
274 275 276 277 |
# File 'lib/adlint/ld/object.rb', line 274 def add_function(fun) @def_index[fun.name].add(fun) @composing_fpaths.add(fun.location.fpath) end |
#add_function_declaration(fun_dcl) ⇒ Object
279 280 281 282 |
# File 'lib/adlint/ld/object.rb', line 279 def add_function_declaration(fun_dcl) @dcl_index[fun_dcl.name].add(fun_dcl) @composing_fpaths.add(fun_dcl.location.fpath) end |
#all_function_declarations ⇒ Object
288 289 290 |
# File 'lib/adlint/ld/object.rb', line 288 def all_function_declarations @dcl_index.values.reduce(Set.new) { |all, dcls| all + dcls }.to_a end |
#all_functions ⇒ Object
284 285 286 |
# File 'lib/adlint/ld/object.rb', line 284 def all_functions @def_index.values.reduce(Set.new) { |all, funs| all + funs }.to_a end |
#lookup_function_declarations(fun_name) ⇒ Object
296 297 298 |
# File 'lib/adlint/ld/object.rb', line 296 def lookup_function_declarations(fun_name) @dcl_index[fun_name].to_a end |
#lookup_functions(fun_name) ⇒ Object
292 293 294 |
# File 'lib/adlint/ld/object.rb', line 292 def lookup_functions(fun_name) @def_index[fun_name].to_a end |