Method: CSquare::Function#locals_and_types

Defined in:
lib/csquare/function.rb

#locals_and_types(blueprint) ⇒ Object

Return a list of local variables, function names, parameters, etc; hashed to type (string).



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/csquare/function.rb', line 112

def locals_and_types blueprint
  vars_and_types = blueprint.generator.externs.merge(blueprint.externs).
                      merge(params).
                      merge(locals)

  # Go through and remove const indicators, as these will only get in the way
  vars_and_types.each_pair do |var, type|
    if type.is_a?(C::DirectType)
      vars_and_types[var].const = false
      vars_and_types[var] = vars_and_types[var].to_s
    end
  end

  vars_and_types
end