コード例 #1
0
ファイル: DocumentHelpers.cs プロジェクト: manojdjoshi/dnSpy
		public static SyntaxTree GetSyntaxTreeSynchronously(Document document, CancellationToken cancellationToken) {
			//TODO: Roslyn 2.0: use document.GetSyntaxTreeSynchronously()
			SyntaxTree syntaxTree;
			if (document.TryGetSyntaxTree(out syntaxTree))
				return syntaxTree;
			return document.GetSyntaxTreeAsync(cancellationToken).GetAwaiter().GetResult();
		}
コード例 #2
0
        static void ProcessDocument(Document document)
        {
            SyntaxTree syntaxTree;
            if (!document.TryGetSyntaxTree(out syntaxTree))
                return;

            SyntaxNode rootNode = syntaxTree.GetRoot();
            var throwClauses = rootNode.DescendantNodesAndSelf().OfType<ThrowStatementSyntax>();
            var semanticModel = document.GetSemanticModelAsync().Result;
            foreach (var throwClause in throwClauses)
            {
                ProcessThrowClause(semanticModel, throwClause);
            }
        }