-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Extract local functions to members #75837
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
Extract local functions to members #75837
Conversation
| private AssignmentExpressionSyntax ParseAssignmentOperator(SyntaxKind operatorExpressionKind, ExpressionSyntax leftOperand, SyntaxToken operatorToken) | ||
| { | ||
| Debug.Assert(IsExpectedAssignmentOperator(operatorToken.Kind)); | ||
| Debug.Assert(GetPrecedence(operatorExpressionKind) == Precedence.Assignment); |
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.
Instead of passing newPrecedence down thru here, we know it will always be Precedence.Assignment, so we just use that.
| // well as `switch` and `with` clauses. | ||
|
|
||
| var (operatorTokenKind, operatorExpressionKind) = getOperatorTokenAndExpressionKind(); | ||
| var (operatorTokenKind, operatorExpressionKind) = GetOperatorTokenAndExpressionKind(); |
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.
i would change the names as i recommended. the pr will still be small in that case.
| return (SyntaxKind.None, SyntaxKind.None); | ||
| } | ||
|
|
||
| private SyntaxToken EatOperatorToken(SyntaxKind operatorTokenKind) |
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.
EatExpressionOperatorToken
| return _syntaxFactory.AssignmentExpression( | ||
| operatorExpressionKind, leftOperand, operatorToken, rhs); | ||
| } | ||
| return ParseAssignmentOperator(operatorExpressionKind, leftOperand, operatorToken); |
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.
i missed this. we should call this ParseAssignmentExpression.
| } | ||
| } | ||
|
|
||
| private AssignmentExpressionSyntax ParseAssignmentOperator(SyntaxKind operatorExpressionKind, ExpressionSyntax leftOperand, SyntaxToken operatorToken) |
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.
Rename to ParseAssignmentExpression
#75554
Precedes #75821
This PR only extracts local functions and blocks to members, with minimal semantic changes. These members will be reused to implement assignment parsing within the conditional access consequence expression.