Parsing for using and foreach await#23866
Parsing for using and foreach await#23866jcouv merged 2 commits intodotnet:features/async-streamsfrom
Conversation
|
test please |
|
|
||
| // C# 7.2 features. | ||
| case MessageID.IDS_FeatureAsyncStreams: // PROTOTYPE(async-streams) | ||
| case MessageID.IDS_FeatureNonTrailingNamedArguments: // semantic check |
There was a problem hiding this comment.
It will become 8.0. But since I started work in a branch with 7.2 only, I stuck with 7.2 with a PROTOTYPE. #Resolved
| return _syntaxFactory.UsingStatement(@using, awaitToken, openParen, declaration, expression, closeParen, statement); | ||
| } | ||
|
|
||
| private SyntaxToken ParseAwaitTokenInUsingOrForEach() |
There was a problem hiding this comment.
ParseAwaitTokenInUsingOrForEach [](start = 28, length = 31)
Please name it for what it does rather than where it is used, e.g. ParseOptionalAwaitKeywordForAsyncStreams
|
|
||
| protected override SyntaxTree ParseTree(string text, CSharpParseOptions options) | ||
| { | ||
| return SyntaxFactory.ParseSyntaxTree(text, options: (options ?? TestOptions.Regular).WithLanguageVersion(LanguageVersion.CSharp7_2)); // PROTOTYPE(async-streams) |
There was a problem hiding this comment.
CSharp7_2 [](start = 133, length = 9)
Can be 7.3 now. #Resolved
|
|
||
| protected override CSharpSyntaxNode ParseNode(string text, CSharpParseOptions options = null) | ||
| { | ||
| return SyntaxFactory.ParseExpression(text, options: (options ?? TestOptions.Regular).WithLanguageVersion(LanguageVersion.CSharp7_2)); // PROTOTYPE(async-streams) |
There was a problem hiding this comment.
CSharp7_2 [](start = 133, length = 9)
Ditto. #Resolved
| // foreach await (var i in collection) | ||
| Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7_1, "await").WithArguments("async streams", "7.2").WithLocation(6, 17) | ||
| ); | ||
| } |
There was a problem hiding this comment.
Might as well verify nodes as well.
| // foreach await (var (i, j) in collection) | ||
| Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7_1, "await").WithArguments("async streams", "7.2").WithLocation(6, 17) | ||
| ); | ||
| } |
gafter
left a comment
There was a problem hiding this comment.
Please test the nodes in error cases in the parser tests, as noted.
|
@dotnet/roslyn-compiler for a second review. Thanks |
Relative to baseline