Ejemplo n.º 1
0
        /// <summary>
        /// Gets all type declarations made in the current codebase that is being compiled. 
        /// This is a tool method to be used in more complex achievements.
        /// This method is caching and can be called without discretion, and is thread safe.
        /// </summary>
        /// <param name="staticAnalysisManifest">StaticAnalysisManifest object used to locate the codebase</param>
        /// <returns>Cached collection of DeclarationInfo</returns>
        public IEnumerable<DeclarationInfo> GetCodebaseDeclarations(StaticAnalysisManifest staticAnalysisManifest)
        {
            lock (codebaseTypeDefinitionPadLock)
            {
                if (codebaseDeclarations == null)
                {
                    codebaseDeclarations = new List<DeclarationInfo>();

                    foreach (var filename in staticAnalysisManifest.CodeFiles)
                    {
                        var compilationUnit = GetCompilationUnit(filename);
                        var typeDeclarationInfoVisitor = new CodebaseAnalysisVisitor();
                        compilationUnit.AcceptVisitor(typeDeclarationInfoVisitor, null);

                        codebaseDeclarations.AddRange(typeDeclarationInfoVisitor.TypeDeclarations);
                    }
                }

                return codebaseDeclarations;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets all type declarations made in the current codebase that is being compiled.
        /// This is a tool method to be used in more complex achievements.
        /// This method is caching and can be called without discretion, and is thread safe.
        /// </summary>
        /// <param name="staticAnalysisManifest">StaticAnalysisManifest object used to locate the codebase</param>
        /// <returns>Cached collection of DeclarationInfo</returns>
        public IEnumerable <DeclarationInfo> GetCodebaseDeclarations(StaticAnalysisManifest staticAnalysisManifest)
        {
            lock (codebaseTypeDefinitionPadLock)
            {
                if (codebaseDeclarations == null)
                {
                    codebaseDeclarations = new List <DeclarationInfo>();

                    foreach (var filename in staticAnalysisManifest.CodeFiles)
                    {
                        var compilationUnit            = GetCompilationUnit(filename);
                        var typeDeclarationInfoVisitor = new CodebaseAnalysisVisitor();
                        compilationUnit.AcceptVisitor(typeDeclarationInfoVisitor, null);

                        codebaseDeclarations.AddRange(typeDeclarationInfoVisitor.TypeDeclarations);
                    }
                }

                return(codebaseDeclarations);
            }
        }