Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ project(reframework
CSharp
)

include(CSharpUtilities)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")

Expand Down
12 changes: 12 additions & 0 deletions csharp-api/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*.cs]
indent_style = space
indent_size = 4
csharp_new_line_before_open_brace = none
csharp_new_line_before_else = false
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_members_in_anonymous_types = false
csharp_new_line_between_query_expression_clauses = false
873 changes: 302 additions & 571 deletions csharp-api/AssemblyGenerator/ClassGenerator.cs

Large diffs are not rendered by default.

20 changes: 4 additions & 16 deletions csharp-api/AssemblyGenerator/EnumGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,6 @@ public void Update(EnumDeclarationSyntax? typeDeclaration) {
enumDeclaration = SyntaxFactory.EnumDeclaration(enumName)
.AddModifiers(SyntaxFactory.Token(SyntaxKind.PublicKeyword));

// Check if we need to add the new keyword to this.
if (AssemblyGenerator.NestedTypeExistsInParent(t)) {
enumDeclaration = enumDeclaration.AddModifiers(SyntaxFactory.Token(SyntaxKind.NewKeyword));
} else {
var declaringType = t.DeclaringType;

if (declaringType != null) {
var existingField = declaringType.FindField(t.Name);

if (existingField != null && AssemblyGenerator.validTypes.Contains(existingField.DeclaringType.FullName)) {
enumDeclaration = enumDeclaration.AddModifiers(SyntaxFactory.Token(SyntaxKind.NewKeyword));
}
}
}

if (t.HasAttribute(s_FlagsAttribute, true)) {
enumDeclaration = enumDeclaration.AddAttributeLists(SyntaxFactory.AttributeList().AddAttributes(SyntaxFactory.Attribute(SyntaxFactory.ParseName("System.FlagsAttribute"))));
}
Expand All @@ -75,7 +60,10 @@ public void Update(EnumDeclarationSyntax? typeDeclaration) {
continue;
}

var underlyingType = field.Type.GetUnderlyingType();
var underlyingType = field.Type?.GetUnderlyingType();
if (underlyingType is null) {
continue;
}

SyntaxToken literalToken;
bool foundRightType = true;
Expand Down
Loading