File tree Expand file tree Collapse file tree
IDisposableAnalyzers/Helpers/Pooled Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,23 +123,15 @@ private bool AddRecursiveValues(ExpressionSyntax assignedValue)
123123 case TypeOfExpressionSyntax _:
124124 this . values . Add ( assignedValue ) ;
125125 return true ;
126-
127- case BinaryExpressionSyntax binaryExpression :
128- switch ( binaryExpression . Kind ( ) )
129- {
130- case SyntaxKind . CoalesceExpression :
131- var left = this . AddRecursiveValues ( binaryExpression . Left ) ;
132- var right = this . AddRecursiveValues ( binaryExpression . Right ) ;
133- return left || right ;
134- case SyntaxKind . AsExpression :
135- return this . AddRecursiveValues ( binaryExpression . Left ) ;
136- default :
137- return false ;
138- }
139-
126+ case BinaryExpressionSyntax { Left : { } , OperatorToken : { ValueText : "as" } } binary :
127+ return this . AddRecursiveValues ( binary . Left ) ;
128+ case BinaryExpressionSyntax { Left : { } , OperatorToken : { ValueText : "??" } , Right : { } } binary :
129+ var left = this . AddRecursiveValues ( binary . Left ) ;
130+ var right = this . AddRecursiveValues ( binary . Right ) ;
131+ return left || right ;
140132 case CastExpressionSyntax cast :
141133 return this . AddRecursiveValues ( cast . Expression ) ;
142- case ConditionalExpressionSyntax conditional :
134+ case ConditionalExpressionSyntax { WhenTrue : { } , WhenFalse : { } } conditional :
143135 var whenTrue = this . AddRecursiveValues ( conditional . WhenTrue ) ;
144136 var whenFalse = this . AddRecursiveValues ( conditional . WhenFalse ) ;
145137 return whenTrue || whenFalse ;
You can’t perform that action at this time.
0 commit comments