Skip to content

Commit

Permalink
store test code
Browse files Browse the repository at this point in the history
    * ridlbe/c++11/config/cxx_type.rb:
    * ridlbe/c++11/visitors/attribute.rb:
    * ridlbe/c++11/visitors/enum.rb:
    * ridlbe/c++11/visitors/struct.rb:
    * ridlbe/c++11/visitors/union.rb:
  • Loading branch information
jwillemsen committed Jan 17, 2024
1 parent eec7f04 commit e3272d8
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
18 changes: 18 additions & 0 deletions ridlbe/c++11/config/cxx_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,24 @@ def value_to_s(v, scope = nil)
def is_pod?
true
end

def value_initializer
# When we have an annotation directly applied to this node we are using it
# unless node.annotations[:default].first.nil?
# "{#{node.annotations[:default].first.fields[:value]}}"
# else
# # Check whether it is a typedef, if so, we need to see if there is an annotation applied to the typedef (or its typedef)
# res_idl_type = _idltype
# while res_idl_type.is_a?(IDL::Type::ScopedName)
# unless res_idl_type.node.annotations[:default].first.nil?
# return "{#{res_idl_type.node.annotations[:default].first.fields[:value]}}"
# end
# res_idl_type = res_idl_type.node.idltype
# end
# _resolved_idltype.zero_initializer
# end
return "FOO"
end
end

class Bitmask
Expand Down
2 changes: 1 addition & 1 deletion ridlbe/c++11/visitors/attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def value_initializer
end
res_idl_type = res_idl_type.node.idltype
end
_resolved_idltype.zero_initializer
_resolved_idltype.value_initializer
end
end

Expand Down
20 changes: 19 additions & 1 deletion ridlbe/c++11/visitors/enum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,26 @@ def bitbound
def bitbound_bits
node.bitbound_bits
end
# template mapping

def value_initializer
# # When we have an annotation directly applied to this node we are using it
# unless node.annotations[:default].first.nil?
# "{#{node.annotations[:default].first.fields[:value]}}"
# else
# # Check whether it is a typedef, if so, we need to see if there is an annotation applied to the typedef (or its typedef)
# res_idl_type = _idltype
# while res_idl_type.is_a?(IDL::Type::ScopedName)
# unless res_idl_type.node.annotations[:default].first.nil?
# return "{#{res_idl_type.node.annotations[:default].first.fields[:value]}}"
# end
# res_idl_type = res_idl_type.node.idltype
# end
# _resolved_idltype.zero_initializer
# end
return "FOO"
end

# template mapping
map_template :enum, :enum
map_template :typecode, :typecode
map_template :tao_typecode, :enum_typecode
Expand Down
2 changes: 1 addition & 1 deletion ridlbe/c++11/visitors/struct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def value_initializer
end
res_idl_type = res_idl_type.node.idltype
end
_resolved_idltype.zero_initializer
_resolved_idltype.value_initializer
end
end

Expand Down
2 changes: 1 addition & 1 deletion ridlbe/c++11/visitors/union.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def value_initializer
end
res_idl_type = res_idl_type.node.idltype
end
_resolved_idltype.zero_initializer
_resolved_idltype.value_initializer
end
end
end
Expand Down

0 comments on commit e3272d8

Please sign in to comment.