Пример #1
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="semanticModel">The semantic model for the document.</param>
        /// <param name="syntaxNodeAnalyzer">Syntax node analyzer logic.</param>
        public TypeDependencyEnumeratorSyntaxVisitor(SemanticModel semanticModel, ISyntaxNodeAnalyzer syntaxNodeAnalyzer)
        {
            _semanticModel      = semanticModel ?? throw new ArgumentNullException(nameof(semanticModel));
            _syntaxNodeAnalyzer = syntaxNodeAnalyzer ?? throw new ArgumentNullException(nameof(syntaxNodeAnalyzer));

            _typeDependencies = new List <TypeDependency>();
        }
Пример #2
0
 public Roslyn2TypeDependencyEnumeratorSyntaxVisitor(SemanticModel semanticModel, ISyntaxNodeAnalyzer syntaxNodeAnalyzer)
     : base(semanticModel, syntaxNodeAnalyzer)
 {
 }
Пример #3
0
 internal ConditionalExpressionSyntaxAnalyzer()
 {
     _analyzer = new SyntaxNodeAnalyzer();
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ApiReplacementForMemberAnalyzer"/> class.
 /// </summary>
 /// <param name="config">Configuration to be used for the analysis, specifying forbidden members on specific types and diagnostic descriptor</param>
 public ApiReplacementForMemberAnalyzer(ApiReplacementConfig config)
 {
     _simpleMemberAccessAnalyzer = new SimpleMemberAccessAnalyzer(config, new MemberAccessDiagnosticFormatter());
     _conditionalAccessAnalyzer  = new ConditionalAccessAnalyzer(config, new ConditionalAccessDiagnosticFormatter());
 }
Пример #5
0
 internal BinaryExpressionSyntaxAnalyzer()
 {
     _analyzer = new SyntaxNodeAnalyzer();
 }
Пример #6
0
 internal InvocationExpressionSyntaxAnalyzer(ISanitizedSourceAnalyzer sanitizedSourceAnalyzer, IIsArgumentOnlyExpression argsOnlyInvocationExpression, ISyntaxNodeAnalyzer <SyntaxNode> syntaxNodeAnalyzer)
 {
     _sanitizedSourceAnalyzer      = sanitizedSourceAnalyzer;
     _argsOnlyInvocationExpression = argsOnlyInvocationExpression;
     _analyzer = syntaxNodeAnalyzer;
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ApiReplacementForMethodAnalyzer"/> class.
 /// </summary>
 /// <param name="config">Configuration to be used for the analysis, specifying forbidden method names on specific types and diagnostic descriptor</param>
 public ApiReplacementForMethodAnalyzer(ApiReplacementConfig config)
 {
     _methodInvocationAnalyzer = new MethodInvocationAnalyzer(config, new MethodInvocationDiagnosticFormatter());
 }
 protected RoslynTypeDependencyEnumeratorBase(ISyntaxNodeAnalyzer syntaxNodeAnalyzer, MessageHandler traceMessageHandler)
 {
     _syntaxNodeAnalyzer  = syntaxNodeAnalyzer ?? throw new ArgumentNullException(nameof(syntaxNodeAnalyzer));
     _traceMessageHandler = traceMessageHandler;
 }
 protected override TypeDependencyEnumeratorSyntaxVisitor CreateSyntaxVisitor(SemanticModel semanticModel, ISyntaxNodeAnalyzer syntaxNodeAnalyzer)
 => new TypeDependencyEnumeratorSyntaxVisitor(semanticModel, syntaxNodeAnalyzer);
        private IEnumerable <TypeDependency> GetTypeDependenciesForSyntaxTree(CSharpCompilation compilation, SyntaxTree syntaxTree, ISyntaxNodeAnalyzer syntaxNodeAnalyzer)
        {
            var documentRootNode = syntaxTree.GetRoot();

            if (documentRootNode == null)
            {
                return(Enumerable.Empty <TypeDependency>());
            }

            var semanticModel = compilation.GetSemanticModel(syntaxTree);
            var syntaxVisitor = CreateSyntaxVisitor(semanticModel, syntaxNodeAnalyzer);

            syntaxVisitor.Visit(documentRootNode);
            return(syntaxVisitor.TypeDependencies);
        }
 protected abstract TypeDependencyEnumeratorSyntaxVisitor CreateSyntaxVisitor(SemanticModel semanticModel, ISyntaxNodeAnalyzer syntaxNodeAnalyzer);