class AdLint::Ld::VariableMap
Attributes
composing_fpaths[R]
Public Class Methods
new()
click to toggle source
# File lib/adlint/ld/object.rb, line 108 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
Public Instance Methods
add_variable(var)
click to toggle source
# File lib/adlint/ld/object.rb, line 116 def add_variable(var) @def_index[var.name].add(var) @composing_fpaths.add(var.location.fpath) end
add_variable_declaration(var_dcl)
click to toggle source
# File lib/adlint/ld/object.rb, line 121 def add_variable_declaration(var_dcl) @dcl_index[var_dcl.name].add(var_dcl) @composing_fpaths.add(var_dcl.location.fpath) end
all_variable_declarations()
click to toggle source
# File lib/adlint/ld/object.rb, line 130 def all_variable_declarations @dcl_index.values.reduce(Set.new) { |all, dcls| all + dcls }.to_a end
all_variables()
click to toggle source
# File lib/adlint/ld/object.rb, line 126 def all_variables @def_index.values.reduce(Set.new) { |all, vars| all + vars }.to_a end
lookup_variable_declarations(var_name)
click to toggle source
# File lib/adlint/ld/object.rb, line 138 def lookup_variable_declarations(var_name) @dcl_index[var_name].to_a end
lookup_variables(var_name)
click to toggle source
# File lib/adlint/ld/object.rb, line 134 def lookup_variables(var_name) @def_index[var_name].to_a end