Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IDE
Browse files Browse the repository at this point in the history
tmat committed May 26, 2022

Verified

This commit was signed with the committer’s verified signature.
jpkrohling Juraci Paixão Kröhling
1 parent fe2be23 commit ada4c19
Showing 12 changed files with 518 additions and 206 deletions.
Original file line number Diff line number Diff line change
@@ -13,12 +13,12 @@ internal static class SyntaxBindingUtilities
public static bool BindsToResumableStateMachineState(SyntaxNode node)
=> node.IsKind(SyntaxKind.YieldReturnStatement) ||
node.IsKind(SyntaxKind.AwaitExpression) ||
node is CommonForEachStatementSyntax { AwaitKeyword.IsMissing: false }
or VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { AwaitKeyword.IsMissing: false } or LocalDeclarationStatementSyntax { AwaitKeyword.IsMissing: false } }
or UsingStatementSyntax { Expression: not null, AwaitKeyword.IsMissing: false };
node is CommonForEachStatementSyntax { AwaitKeyword.RawKind: not 0 }
or VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { AwaitKeyword.RawKind: not 0 } or LocalDeclarationStatementSyntax { AwaitKeyword.RawKind: not 0 } }
or UsingStatementSyntax { Expression: not null, AwaitKeyword.RawKind: not 0 };

public static bool BindsToTryStatement(SyntaxNode node)
=> node is VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { } or LocalDeclarationStatementSyntax { UsingKeyword.IsMissing: false } }
=> node is VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { } or LocalDeclarationStatementSyntax { UsingKeyword.RawKind: not 0 } }
or UsingStatementSyntax { Expression: not null }
or CommonForEachStatementSyntax
or TryStatementSyntax
Original file line number Diff line number Diff line change
@@ -9418,7 +9418,7 @@ static IEnumerable<int> F()
var active = GetActiveStatements(src1, src2);

edits.VerifySemanticDiagnostics(active,
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "yield return 1;", CSharpFeaturesResources.yield_return_statement));
Diagnostic(RudeEditKind.UpdatingStateMachineMethodAroundActiveStatement, "static IEnumerable<int> F()"));
}

[Fact]
@@ -9512,7 +9512,7 @@ static async Task<int> F()
var active = GetActiveStatements(src1, src2);

edits.VerifySemanticDiagnostics(active,
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "await", CSharpFeaturesResources.await_expression));
Diagnostic(RudeEditKind.UpdatingStateMachineMethodAroundActiveStatement, "static async Task<int> F()"));
}

[Fact]
@@ -9544,7 +9544,7 @@ static async Task<int> F()
var active = GetActiveStatements(src1, src2);

edits.VerifySemanticDiagnostics(active,
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "await foreach (var x in AsyncIter())", CSharpFeaturesResources.asynchronous_foreach_statement));
Diagnostic(RudeEditKind.UpdatingStateMachineMethodAroundActiveStatement, "static async Task<int> F()"));
}

[Fact]
@@ -9576,8 +9576,7 @@ static async Task<int> F()
var active = GetActiveStatements(src1, src2);

edits.VerifySemanticDiagnostics(active,
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "x = new AsyncDisposable()", CSharpFeaturesResources.asynchronous_using_declaration),
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "y = new AsyncDisposable()", CSharpFeaturesResources.asynchronous_using_declaration));
Diagnostic(RudeEditKind.UpdatingStateMachineMethodAroundActiveStatement, "static async Task<int> F()"));
}

[Fact]
@@ -9825,7 +9824,7 @@ static void F()
var active = GetActiveStatements(src1, src2);

edits.VerifySemanticDiagnostics(active,
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "await", CSharpFeaturesResources.await_expression));
Diagnostic(RudeEditKind.UpdatingStateMachineMethodAroundActiveStatement, "()"));
}

[Fact]
@@ -9922,7 +9921,7 @@ async Task<int> f()
var active = GetActiveStatements(src1, src2);

edits.VerifySemanticDiagnostics(active,
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "await", CSharpFeaturesResources.await_expression));
Diagnostic(RudeEditKind.UpdatingStateMachineMethodAroundActiveStatement, "f"));
}

[Fact]
@@ -9951,7 +9950,7 @@ static void F()
var active = GetActiveStatements(src1, src2);

edits.VerifySemanticDiagnostics(active,
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "await", CSharpFeaturesResources.await_expression));
Diagnostic(RudeEditKind.UpdatingStateMachineMethodAroundActiveStatement, "f"));
}

[Fact]
Loading

0 comments on commit ada4c19

Please sign in to comment.