Ejemplo n.º 1
0
            private SyntaxNode SimplifyDefaultExpression(
                DefaultExpressionSyntax node,
                SemanticModel semanticModel,
                CSharpSimplifierOptions options,
                CancellationToken cancellationToken)
            {
                var preferSimpleDefaultExpression = options.PreferSimpleDefaultExpression.Value;

                if (node.CanReplaceWithDefaultLiteral(ParseOptions, preferSimpleDefaultExpression, semanticModel, cancellationToken))
                {
                    return(SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression)
                           .WithTriviaFrom(node));
                }

                return(node);
            }
Ejemplo n.º 2
0
 public override SimplifierOptions GetSimplifierOptions(AnalyzerConfigOptions options, SimplifierOptions?fallbackOptions)
 => CSharpSimplifierOptions.Create(options, (CSharpSimplifierOptions?)fallbackOptions);
 protected abstract bool IsApplicable(CSharpSimplifierOptions options);