Fix empty body methods

This commit is contained in:
2024-09-23 10:59:25 +02:00
parent 6b2dd46856
commit a2060a7c45
3 changed files with 9 additions and 2 deletions
+7 -1
View File
@@ -34,6 +34,8 @@ public sealed class TestClass<T> : BaseTestClass, IInterface where T : new(), cl
this.fieldString = 0;
return this.fieldString;
}
public string GetSomething();
}";
[TestMethod]
@@ -95,7 +97,11 @@ public sealed class TestClass<T> : BaseTestClass, IInterface where T : new(), cl
.WithTypeParameter(SyntaxBuilder.CreateTypeParameter("T"))
.WithAttribute(SyntaxBuilder.CreateAttribute("SomeAttribute4")
.WithArgument(0.5f))
.WithBody("this.fieldString = 0;\r\nreturn this.fieldString;"))))
.WithBody("this.fieldString = 0;\r\nreturn this.fieldString;"))
.WithMethod(
SyntaxBuilder.CreateMethod("string", "GetSomething")
.WithModifier("public")
.WithNoBody())))
.Build();
var compilationUnit = compilationUnitSyntax.ToFullString();
+1
View File
@@ -169,6 +169,7 @@ namespace Sybil
}
return this.MethodDeclarationSyntax
.WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken))
.NormalizeWhitespace();
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>0.8.2</Version>
<Version>0.8.3</Version>
</PropertyGroup>
<PropertyGroup>