Skip to content

Commit

Permalink
Fix CI and from review
Browse files Browse the repository at this point in the history
  • Loading branch information
sonndinh committed Apr 11, 2024
1 parent 427ce89 commit 379fe7e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion dds/idl/dds_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,11 @@ bool has_discriminator(AST_Union* u, FieldFilter filter_kind)
|| filter_kind == FieldFilter_All;
}

// TODO: Add more fine-grained control of "const" string for the wrapper type and wrapped type.
// Currently, there is a single bool to control both; that is, either both are "const" or
// none is "const". But sometimes, we want something like "const KeyOnly<SampleType>&", and
// not "const KeyOnly<const SampleType>&" or "KeyOnly<SampleType>&".

/// Handling wrapping and unwrapping references in the wrapper types:
/// NestedKeyOnly, KeyOnly, IDL::DistinctType, and *_forany.
struct RefWrapper {
Expand Down Expand Up @@ -1720,7 +1725,8 @@ std::string key_only_type_name(AST_Type* type, const std::string& type_name,
{
RefWrapper wrapper(type, type_name, "", writing ? true : false);
wrapper.field_filter_ = field_filter;
return wrapper.done().wrapped_type_name();
const bool has_wrapper = field_filter != FieldFilter_All;
return (has_wrapper && !writing ? "const " : "") + wrapper.done().wrapped_type_name();
}

#endif
2 changes: 1 addition & 1 deletion docs/news.d/keyonly_vread_vwrite.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.. news-prs: 4554
.. news-start-section: Fixes
- KeyOnly serialization of union that has no key now has a delimiter for appendable and mutable extensibility.
- XCDR2 KeyOnly serialization of union that has no key now has a delimiter for appendable and mutable extensibility.
.. news-end-section

0 comments on commit 379fe7e

Please sign in to comment.