Пример #1
0
        public IEnumerable <T> Get <T>(ICompilationDocument document)
        {
            var syntaxTreeAsync = document.SyntaxTree;
            var checkClasses    = Visit <T>(syntaxTreeAsync, document.Compile, this, document);

            foreach (var checkClass in checkClasses)
            {
                yield return(checkClass);
            }
        }
Пример #2
0
 public CheckClasses(ICompilationDocument document, ICompilationInfo compile, string pattern)
     : base(document, compile, pattern, "class")
 {
 }
Пример #3
0
 public CheckFile(ICompilationDocument document, ICompilationInfo compile)
 {
     this.document = document;
     this.compile  = compile;
     this.Name     = document.Name;
 }
Пример #4
0
 protected CheckTypes(ICompilationDocument document, ICompilationInfo compile, string pattern, string typeName)
     : this(compile.Get <T>(document), pattern, typeName)
 {
 }
Пример #5
0
        private static IEnumerable <T> Visit <T>(SyntaxTree syntaxTreeAsync, Microsoft.CodeAnalysis.Compilation compile, ICompilationInfo compilationInfo, ICompilationDocument document)
        {
            CheckClassVisitor visitor;

            if (!CompilationDocumentResult.TryGetValue(document.FullName, out visitor))
            {
                var semanticModel = compile.GetSemanticModel(syntaxTreeAsync);

                visitor = new CheckClassVisitor(document, semanticModel, compilationInfo);

                visitor.Visit(syntaxTreeAsync.GetRoot());

                CompilationDocumentResult.Add(document.FullName, visitor);
            }

            return(visitor.Get <T>());
        }