Skip to content

Commit

Permalink
Merge pull request #340 from jwillemsen/jwi-valueidentattribute
Browse files Browse the repository at this point in the history
Provide value_initializer to return the default possible set for defa…
  • Loading branch information
jwillemsen authored Jan 16, 2024
2 parents cc799e3 + 53c33f6 commit 7b3f82e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ridlbe/c++11/visitors/attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,23 @@ def sendc_prefix_set
sendc_prefix(false)
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
end

# template mapping

map_template :attribute, :attribute
Expand Down

0 comments on commit 7b3f82e

Please sign in to comment.