Add TypeId attribute to enums.

This commit is contained in:
Kuba Ober 2019-09-18 13:52:34 -04:00
parent 5c961ef2e7
commit de6607ed8a
2 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,7 @@ using System.Threading.Tasks;
namespace Capnproto_test.Capnp.Test
{
[TypeId(0x9c8e9318b29d9cd3UL)]
public enum TestEnum : ushort
{
foo,
@ -4995,6 +4996,7 @@ namespace Capnproto_test.Capnp.Test
}
}
[TypeId(0xb651d2fba42056d4UL)]
public enum NestedEnum : ushort
{
foo,
@ -5077,6 +5079,7 @@ namespace Capnproto_test.Capnp.Test
}
}
[TypeId(0xcfa0d546993a3df3UL)]
public enum NestedEnum : ushort
{
baz,
@ -15757,6 +15760,7 @@ namespace Capnproto_test.Capnp.Test
}
}
[TypeId(0xef428f2f67c4d439UL)]
public enum Tag : ushort
{
testInterface,
@ -16289,6 +16293,7 @@ namespace Capnproto_test.Capnp.Test
}
}
[TypeId(0xf610d1deb4c9e84aUL)]
public enum BadlyNamedEnum : ushort
{
foo,
@ -16370,6 +16375,7 @@ namespace Capnproto_test.Capnp.Test
}
}
[TypeId(0xf6cb3f9c7a4322e0UL)]
public enum DeeplyNestedEnum : ushort
{
quux,

View File

@ -52,6 +52,7 @@ namespace CapnpC.Generator
public EnumDeclarationSyntax MakeEnum(TypeDefinition def)
{
var decl = EnumDeclaration(def.Name)
.WithAttributeLists(MakeTypeIdAttributeLists(def.Id))
.AddModifiers(Public)
.AddBaseListTypes(SimpleBaseType(Type<ushort>()));