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.
267 268 269 270 271 |
# File 'lib/adlint/ld/object.rb', line 267 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.
273 274 275 |
# File 'lib/adlint/ld/object.rb', line 273 def composing_fpaths @composing_fpaths end |
Instance Method Details
#add_function(fun) ⇒ Object
275 276 277 278 |
# File 'lib/adlint/ld/object.rb', line 275 def add_function(fun) @def_index[fun.name].add(fun) @composing_fpaths.add(fun.location.fpath) end |
#add_function_declaration(fun_dcl) ⇒ Object
280 281 282 283 |
# File 'lib/adlint/ld/object.rb', line 280 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
289 290 291 |
# File 'lib/adlint/ld/object.rb', line 289 def all_function_declarations @dcl_index.values.reduce(Set.new) { |all, dcls| all + dcls }.to_a end |
#all_functions ⇒ Object
285 286 287 |
# File 'lib/adlint/ld/object.rb', line 285 def all_functions @def_index.values.reduce(Set.new) { |all, funs| all + funs }.to_a end |
#lookup_function_declarations(fun_name) ⇒ Object
297 298 299 |
# File 'lib/adlint/ld/object.rb', line 297 def lookup_function_declarations(fun_name) @dcl_index[fun_name].to_a end |
#lookup_functions(fun_name) ⇒ Object
293 294 295 |
# File 'lib/adlint/ld/object.rb', line 293 def lookup_functions(fun_name) @def_index[fun_name].to_a end |