-
Notifications
You must be signed in to change notification settings - Fork 22
LFT-1728 - Add support for CollectionExpression in async generator #963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "sdk": { | ||
| "version": "7.0.300", | ||
| "version": "9.0.101", | ||
| "rollForward": "latestFeature" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -258,6 +258,9 @@ private ExpressionSyntax Transform( ExpressionSyntax expr ) | |
| .WithLeft( Transform( binExpr.Left ) ) | ||
| .WithRight( Transform( binExpr.Right ) ), | ||
|
|
||
| CollectionExpressionSyntax collectionExpr => | ||
| collectionExpr.WithElements( Transform( collectionExpr.Elements ) ), | ||
|
|
||
| ConditionalExpressionSyntax condExpr => condExpr | ||
| .WithCondition( Transform( condExpr.Condition ) ) | ||
| .WithWhenTrue( Transform( condExpr.WhenTrue ) ) | ||
|
|
@@ -352,6 +355,17 @@ private VariableDesignationSyntax Transform( VariableDesignationSyntax des ) | |
| _ => UnhandledSyntax( des ) | ||
| }; | ||
|
|
||
| private SeparatedSyntaxList<CollectionElementSyntax> Transform( | ||
| SeparatedSyntaxList<CollectionElementSyntax> original | ||
| ) => SyntaxFactory.SeparatedList( | ||
| original.Select( elem => elem switch { | ||
| ExpressionElementSyntax ee => ee.WithExpression( Transform( ee.Expression ) ), | ||
| SpreadElementSyntax sp => sp.WithExpression( Transform( sp.Expression ) ), | ||
| _ => UnhandledSyntax( elem ) | ||
| } ), | ||
|
Comment on lines
+361
to
+365
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Particular reason this isn't just
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah -- what I have currently on my desktop has that, with the move to TransformAll. I'll get to it. |
||
| original.GetSeparators() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're not passing the original separators for the other cases in the transformer, so perhaps something to correct later
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah -- see note below. One other reason we're not doing it in the other ones is TransformAll supports the "maybe transform" e.g. so we can delete cancellation token arguments. There needs to be some accounting for that otherwise .GetSeparators() will possibly insert extra separators/commas, so it needs a bit more thought. |
||
| ); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually part of this is already in place with the TransformAll combinator. I'll do a follow-up PR to switch to that, but also add the separators. That will incur some noise because we will have to fix up the whitespace in unrelated tests. |
||
|
|
||
| private StatementSyntax Transform( ExpressionStatementSyntax exprStmt ) { | ||
| var result = Transform( exprStmt.Expression ); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update for new C# 12 syntax