Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21380] Support setting value to an enumeration literal using annotation @value #379

Merged
merged 5 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ enum_type(ctx, parent, enum) ::= <<
*/
enum class $enum.name$ : int32_t
{
$enum.members:{ member | $member.name$}; separator=",\n"$
$enum.members:{ member | $member.name$$if(member.annotationValue)$ = $member.annotationValueValue$$endif$}; separator=",\n"$
};
>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ TEST(TypeObjectTests, TestEnumTypeObject_$enum.name$)
TypeIdentifierPair type_ids;

// Register specific enum TypeObject
$if(enum.scope)$::$endif$$enum.scope$::register_$enum.name$_type_identifier(type_ids);
$if(!enum.scope.empty)$::$endif$$enum.scope$::register_$enum.name$_type_identifier(type_ids);

$check_type_identifier_consistency(result="type_ids")$
$check_direct_hash_type_identifier(typeid="type_ids")$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ $endif$
enum_literal(literal, parent, name) ::= <<
{
EnumeratedLiteralFlag flags_$literal.name$ = TypeObjectUtils::build_enumerated_literal_flag($literal.annotationDefaultLiteral$);
CommonEnumeratedLiteral common_$literal.name$ = TypeObjectUtils::build_common_enumerated_literal($literal.index$, flags_$literal.name$);
CommonEnumeratedLiteral common_$literal.name$ = TypeObjectUtils::build_common_enumerated_literal($if(literal.annotationValue)$$literal.annotationValueValue$$else$$literal.index$$endif$, flags_$literal.name$);
$empty_ann_builtin_complete_member_detail(member=literal, parent=parent, message=[parent.scopedname, " Enumerated ", literal.name, " literal: only @default_literal and @value builtin annotations apply to literals"], name=name)$
CompleteEnumeratedLiteral literal_$literal.name$ = TypeObjectUtils::build_complete_enumerated_literal(common_$literal.name$, detail_$literal.name$);
TypeObjectUtils::add_complete_enumerated_literal(literal_seq_$parent.name$, literal_$literal.name$);
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/dds-types-test
Loading