Class: C::Function

Inherits:
Object
  • Object
show all
Defined in:
lib/cast-to-yaml/to_yaml.rb

Instance Method Summary collapse

Instance Method Details

#to_h(declaration, no_types = false) ⇒ Object



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/cast-to-yaml/to_yaml.rb', line 240

def to_h(declaration, no_types=false)
  res = {}
  res["kind"] = "function"
  if type
    res["type"] = type.to_h(declaration)
  else
    res["type"] = declaration.type.to_h
  end
  if !params.nil?
    res["params"] = if no_types
        params.collect{|p| p.name }
      else
        params.collect{|p| p.to_h }
      end
  end
  res
end