We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Before:
internal static bool FindSingle(IFieldSymbol field, SemanticModel semanticModel, CancellationToken cancellationToken, [NotNullWhen(true)] out ExpressionSyntax? expression) { expression = null; if (field.IsReadOnly && field.TrySingleDeclaration(cancellationToken, out VariableDeclarationSyntax? declaration) && declaration.Variables.TrySingle(out var variable)) { using var walker = MutationWalker.For(field, semanticModel, cancellationToken); if (walker.IsEmpty) { expression = variable.Initializer?.Value; return expression != null; } if (variable.Initializer is null && walker.TrySingle(out var node) && node.Parent is AssignmentExpressionSyntax assignment) { expression = assignment.Right; return expression != null; } return false; } return false; }
After
internal static ExpressionSyntax? FindSingle(IFieldSymbol field, SemanticModel semanticModel, CancellationToken cancellationToken) { if (field.IsReadOnly && field.TrySingleDeclaration(cancellationToken, out VariableDeclarationSyntax? declaration) && declaration.Variables.TrySingle(out var variable)) { using var walker = MutationWalker.For(field, semanticModel, cancellationToken); if (walker.IsEmpty) { return variable.Initializer?.Value; } if (variable.Initializer is null && walker.TrySingle(out var node) && node.Parent is AssignmentExpressionSyntax assignment) { return assignment.Right; } return null; } return null; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Before:
After
The text was updated successfully, but these errors were encountered: