Class: AdLint::Ld::FunctionMap

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFunctionMap

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



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_functionsObject



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