Skip to content

Commit

Permalink
Support C# Statement queries using await when targeting executable
Browse files Browse the repository at this point in the history
Closes #10
  • Loading branch information
atifaziz committed Mar 18, 2017
1 parent b62ccb8 commit 46b0feb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,20 @@ static void GenerateExecutable(string cscPath, string queryFilePath,
" }",
source,
"}")
: CSharpSyntaxTree.ParseText("void Main() {" + source + "}")
.GetRoot()
.DescendantNodes()
.OfType<AwaitExpressionSyntax>()
.Any()
? Seq.Return(
"class UserQuery {",
" static int Main(string[] args) {",
" new UserQuery().Main().Wait(); return 0;",
" }",
" async Task Main() {",
source,
" }",
"}")
: Seq.Return(
"class UserQuery {",
" static int Main(string[] args) {",
Expand Down

0 comments on commit 46b0feb

Please sign in to comment.