mirror of
https://github.com/FabInfra/capnproto-dotnetcore_Runtime.git
synced 2025-03-12 14:51:41 +01:00
Fix setter of enums inside unions
This commit is contained in:
parent
449af92753
commit
e339ac3c8c
Binary file not shown.
17
CapnpC.CSharp.Generator.Tests/No Resources/UnitTest12.capnp
Normal file
17
CapnpC.CSharp.Generator.Tests/No Resources/UnitTest12.capnp
Normal file
@ -0,0 +1,17 @@
|
||||
@0xb7069c462537ddd6;
|
||||
|
||||
enum TestEnum {
|
||||
a @0;
|
||||
b @1;
|
||||
}
|
||||
|
||||
const globalConstant: TestEnum = b;
|
||||
|
||||
struct Struct {
|
||||
const structConstant: TestEnum = a;
|
||||
|
||||
union {
|
||||
enumValue @0: TestEnum;
|
||||
intValue @1: Int64;
|
||||
}
|
||||
}
|
@ -343,10 +343,9 @@ namespace CapnpC.CSharp.Generator.CodeGen
|
||||
return LiteralExpression(SyntaxKind.FalseLiteralExpression);
|
||||
|
||||
case TypeTag.Enum:
|
||||
return MemberAccessExpression(
|
||||
SyntaxKind.SimpleMemberAccessExpression,
|
||||
return CastExpression(
|
||||
_names.MakeTypeSyntax(field.Type, field.DeclaringType, TypeUsage.NotRelevant),
|
||||
_names.UnionDiscriminatorUndefined.IdentifierName);
|
||||
LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0)));
|
||||
|
||||
case TypeTag.F32:
|
||||
return LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0.0f));
|
||||
|
Loading…
x
Reference in New Issue
Block a user