private SyntaxNode ProcessTypeSyntax(TypeSyntax typeSyntax) { this.CancellationToken.ThrowIfCancellationRequested(); // Only simplify if us, or a parent, was marked as needing simplification. if (!alwaysSimplify && !typeSyntax.HasAnnotation(Simplifier.Annotation)) { return(typeSyntax); } // Definitely do not simplify us if we were told to not simplify. if (typeSyntax.HasAnnotation(SimplificationHelpers.DontSimplifyAnnotation)) { return(typeSyntax); } var typeStyle = CSharpUseImplicitTypeHelper.Instance.AnalyzeTypeName( typeSyntax, this.SemanticModel, this.OptionSet, this.CancellationToken); if (!typeStyle.IsStylePreferred || !typeStyle.CanConvert()) { return(typeSyntax); } return(SyntaxFactory.IdentifierName("var") .WithLeadingTrivia(typeSyntax.GetLeadingTrivia()) .WithTrailingTrivia(typeSyntax.GetTrailingTrivia())); }