Class: C::Pointer

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

Overview

IndirectTypes

Instance Method Summary collapse

Instance Method Details

#to_h(declaration = nil) ⇒ Object



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/cast-to-yaml/to_yaml.rb', line 202

def to_h(declaration = nil)
  res = {}
  res["kind"] = "pointer"
  res["const"] = true if const?
  res["restrict"] = true if restrict?
  res["volatile"] = true if volatile?
  if type
    if declaration
      res["type"] = type.to_h(declaration)
    else
      res["type"] = type.to_h
    end
  else
    res["type"] = declaration.type.to_h
  end
  res
end