Class: C::Declarator

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

Instance Method Summary collapse

Instance Method Details

#to_h(declaration) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cast-to-yaml/to_yaml.rb', line 4

def to_h(declaration)
  res = {}
  res["name"] = name.dup
  res["type"] = if indirect_type
      indirect_type.to_h(declaration)
    else
      declaration.type.to_h
    end
  if init
    res["init"] = init.to_s
  end
  if num_bits
    res["num_bits"] = num_bits.to_s
  end
  res
end