private static ParsedSourceFilesCollection ParseProjectSourceFiles(Project targetProject)
        {
            var results = new ParsedSourceFilesCollection();

            foreach (var document in targetProject.Documents)
            {
                var tree = document.GetSyntaxTreeAsync().Result;
                if (tree.HasCompilationUnitRoot)
                {
                    var root = tree.GetCompilationUnitRoot();
                    var model = document.GetSemanticModelAsync().Result;
                    var semanticInterpreter = new SemanticCache(targetProject, model);

                    var elements =  ParseFileContent(root, semanticInterpreter);
                    var relativePathToFile = targetProject.GetRelativePathToFile(document.FilePath);

                    results[relativePathToFile] = new SourceFileParsingInfo(relativePathToFile, elements);
                }
            }

            return results;
        }
Example #2
0
        private static ParsedSourceFilesCollection ParseProjectSourceFiles(Project targetProject)
        {
            var results = new ParsedSourceFilesCollection();

            foreach (var document in targetProject.Documents)
            {
                var tree = document.GetSyntaxTreeAsync().Result;
                if (tree.HasCompilationUnitRoot)
                {
                    var root  = tree.GetCompilationUnitRoot();
                    var model = document.GetSemanticModelAsync().Result;
                    var semanticInterpreter = new SemanticCache(targetProject, model);

                    var elements           = ParseFileContent(root, semanticInterpreter);
                    var relativePathToFile = targetProject.GetRelativePathToFile(document.FilePath);

                    results[relativePathToFile] = new SourceFileParsingInfo(relativePathToFile, elements);
                }
            }

            return(results);
        }