Fix enum member trait parsing

The clearPendingDocs call was made after consuming traits that follow
a previous enum member. Fixed by calling it in the right order.
This commit is contained in:
Michael Dowling 2022-08-05 12:32:27 -07:00 committed by Michael Dowling
parent ec76181ebd
commit 919d547bb2
3 changed files with 37 additions and 3 deletions

View File

@ -621,11 +621,11 @@ final class IdlModelParser extends SimpleParser {
sp();
Node value = IdlNodeParser.parseNode(this);
memberBuilder.addTrait(new EnumValueTrait.Provider().createTrait(memberBuilder.getId(), value));
clearPendingDocs();
br();
} else {
ws();
}
clearPendingDocs();
ws();
}
expect('}');

View File

@ -0,0 +1,24 @@
{
"smithy": "2.0",
"shapes": {
"smithy.example#Foo": {
"type": "enum",
"members": {
"BAR": {
"target": "smithy.api#Unit",
"traits": {
"smithy.api#documentation": "Hello1",
"smithy.api#enumValue": "hi"
}
},
"BAZ": {
"target": "smithy.api#Unit",
"traits": {
"smithy.api#documentation": "Hello2",
"smithy.api#enumValue": "there"
}
}
}
}
}
}

View File

@ -0,0 +1,10 @@
$version: "2.0"
namespace smithy.example
enum Foo {
/// Hello1
BAR = "hi"
/// Hello2
BAZ = "there"
}