/// <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>(); }
public Roslyn2TypeDependencyEnumeratorSyntaxVisitor(SemanticModel semanticModel, ISyntaxNodeAnalyzer syntaxNodeAnalyzer) : base(semanticModel, syntaxNodeAnalyzer) { }
internal ConditionalExpressionSyntaxAnalyzer() { _analyzer = new SyntaxNodeAnalyzer(); }
/// <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()); }
internal BinaryExpressionSyntaxAnalyzer() { _analyzer = new SyntaxNodeAnalyzer(); }
internal InvocationExpressionSyntaxAnalyzer(ISanitizedSourceAnalyzer sanitizedSourceAnalyzer, IIsArgumentOnlyExpression argsOnlyInvocationExpression, ISyntaxNodeAnalyzer <SyntaxNode> syntaxNodeAnalyzer) { _sanitizedSourceAnalyzer = sanitizedSourceAnalyzer; _argsOnlyInvocationExpression = argsOnlyInvocationExpression; _analyzer = syntaxNodeAnalyzer; }
/// <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);