Skip to content

Commit 5766e9e

Browse files
committed
Removed "partial" keyword from generated enums
1 parent 525f159 commit 5766e9e

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

src/CodeGeneration/CSharpEnum.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Collections.Generic;
55
using System.Linq;
6+
using Microsoft.CodeAnalysis.CSharp;
67
using Microsoft.CodeAnalysis.CSharp.Syntax;
78
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
89

@@ -29,6 +30,7 @@ public CSharpEnum(CSharpIdentifier identifier)
2930
/// <inheritdoc/>
3031
protected override MemberDeclarationSyntax GetMemberDeclaration()
3132
=> EnumDeclaration(Identifier.Name)
33+
.AddModifiers(Token(SyntaxKind.PublicKeyword))
3234
.WithMembers(SeparatedList(Values.Select(value => value.ToSyntax())));
3335

3436
/// <inheritdoc/>

src/CodeGeneration/CSharpInterface.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Collections.Generic;
55
using System.Linq;
6+
using Microsoft.CodeAnalysis.CSharp;
67
using Microsoft.CodeAnalysis.CSharp.Syntax;
78
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
89

@@ -34,7 +35,9 @@ public CSharpInterface(CSharpIdentifier identifier)
3435
/// <inheritdoc/>
3536
protected override MemberDeclarationSyntax GetMemberDeclaration()
3637
{
37-
var declaration = GetTypeDeclaration().WithMembers(List(GetMemberDeclarations()));
38+
var declaration = GetTypeDeclaration()
39+
.AddModifiers(Token(SyntaxKind.PublicKeyword), Token(SyntaxKind.PartialKeyword))
40+
.WithMembers(List(GetMemberDeclarations()));
3841

3942
var baseTypes = GetBaseTypes().ToList();
4043
return baseTypes.Any()

src/CodeGeneration/CSharpType.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public CompilationUnitSyntax ToSyntax()
4242
namespaces.Remove(Identifier.Namespace);
4343

4444
var member = GetMemberDeclaration()
45-
.AddModifiers(Token(SyntaxKind.PublicKeyword), Token(SyntaxKind.PartialKeyword))
4645
.WithAttributeLists(List(Attributes.Select(x => x.ToSyntax())))
4746
.WithDocumentation(Summary);
4847

src/UnitTests/CSharpEnumFacts.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace Namespace1
3838
/// My enum
3939
/// Details
4040
/// </summary>
41-
public partial enum MyEnum
41+
public enum MyEnum
4242
{
4343
/// <summary>
4444
/// My value 1

0 commit comments

Comments
 (0)