Disable async await warnings in empty Execute method.

Also removed a confusing CSharpCodeWriting method.

#28
This commit is contained in:
N. Taylor Mullen 2014-05-08 15:27:32 -07:00
parent 20c91146f1
commit 2800c4938a
3 changed files with 7 additions and 8 deletions

View File

@ -57,9 +57,13 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
// Add space inbetween constructor and method body // Add space inbetween constructor and method body
writer.WriteLine(); writer.WriteLine();
using (writer.BuildMethodDeclaration("public override async", "Task", Host.GeneratedClassContext.ExecuteMethodName)) // 1998 is to not warn about empty async methods.
using (writer.BuildDisableWarningScope(1998))
{ {
new CSharpCodeVisitor(writer, Context).Accept(Tree.Chunks); using (writer.BuildMethodDeclaration("public override async", "Task", Host.GeneratedClassContext.ExecuteMethodName))
{
new CSharpCodeVisitor(writer, Context).Accept(Tree.Chunks);
}
} }
} }
} }

View File

@ -226,11 +226,6 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
return WriteStartMethodInvocation(methodName).Write(string.Join(", ", parameters)).WriteEndMethodInvocation(endLine); return WriteStartMethodInvocation(methodName).Write(string.Join(", ", parameters)).WriteEndMethodInvocation(endLine);
} }
public CSharpDisableWarningScope BuildDisableWarningScope()
{
return new CSharpDisableWarningScope(this, 219);
}
public CSharpDisableWarningScope BuildDisableWarningScope(int warning) public CSharpDisableWarningScope BuildDisableWarningScope(int warning)
{ {
return new CSharpDisableWarningScope(this, warning); return new CSharpDisableWarningScope(this, warning);

View File

@ -17,7 +17,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{ {
using (Writer.BuildMethodDeclaration("private", "void", "@" + DesignTimeHelperMethodName)) using (Writer.BuildMethodDeclaration("private", "void", "@" + DesignTimeHelperMethodName))
{ {
using (Writer.BuildDisableWarningScope()) using (Writer.BuildDisableWarningScope(219))
{ {
Accept(tree.Chunks); Accept(tree.Chunks);
} }