fix code gen property never set
This commit is contained in:
parent
bc12158014
commit
d4d1f2f981
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,4 +2,5 @@ bin
|
||||||
obj
|
obj
|
||||||
.idea
|
.idea
|
||||||
client
|
client
|
||||||
|
*.sarif
|
||||||
|
|
||||||
|
|
|
@ -166,6 +166,8 @@ public class StructEndiannessSourceGenerator : ISourceGenerator
|
||||||
name: IdentifierName("ReverseEndianness")
|
name: IdentifierName("ReverseEndianness")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var valueIdentifier = IdentifierName("value");
|
||||||
|
|
||||||
return PropertyDeclaration(ParseTypeName(typeName), propertyName)
|
return PropertyDeclaration(ParseTypeName(typeName), propertyName)
|
||||||
.WithModifiers(TokenList([Token(SyntaxKind.PublicKeyword)]))
|
.WithModifiers(TokenList([Token(SyntaxKind.PublicKeyword)]))
|
||||||
.WithAccessorList(AccessorList(List<AccessorDeclarationSyntax>([
|
.WithAccessorList(AccessorList(List<AccessorDeclarationSyntax>([
|
||||||
|
@ -187,11 +189,11 @@ public class StructEndiannessSourceGenerator : ISourceGenerator
|
||||||
left: fieldIdentifier,
|
left: fieldIdentifier,
|
||||||
right: ConditionalExpression(
|
right: ConditionalExpression(
|
||||||
condition: condition,
|
condition: condition,
|
||||||
whenTrue: fieldIdentifier,
|
whenTrue: valueIdentifier,
|
||||||
whenFalse: InvocationExpression(
|
whenFalse: InvocationExpression(
|
||||||
expression: reverseEndiannessMethod,
|
expression: reverseEndiannessMethod,
|
||||||
argumentList: ArgumentList(SingletonSeparatedList(
|
argumentList: ArgumentList(SingletonSeparatedList(
|
||||||
Argument(IdentifierName("value"))
|
Argument(valueIdentifier)
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue