From 1f780132580e1d8497f278b90265d5b28dcf3edf Mon Sep 17 00:00:00 2001 From: mkrueger <> Date: Wed, 12 Sep 2012 10:49:03 +0200 Subject: [PATCH] [Ast] GetTypes now includes delegate declarations as well. --- ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs b/ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs index 2906696b36..dfe4357ec5 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs @@ -105,14 +105,20 @@ namespace ICSharpCode.NRefactory.CSharp { } - public IEnumerable GetTypes(bool includeInnerTypes = false) + /// + /// Gets all defined types in this syntax tree. + /// + /// + /// A list containing or nodes. + /// + public IEnumerable GetTypes(bool includeInnerTypes = false) { Stack nodeStack = new Stack (); nodeStack.Push(this); while (nodeStack.Count > 0) { var curNode = nodeStack.Pop(); - if (curNode is TypeDeclaration) { - yield return (TypeDeclaration)curNode; + if (curNode is TypeDeclaration || curNode is DelegateDeclaration) { + yield return (EntityDeclaration)curNode; } foreach (var child in curNode.Children) { if (!(child is Statement || child is Expression) && @@ -121,6 +127,7 @@ namespace ICSharpCode.NRefactory.CSharp } } } + protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) {