From 81e08ade79952459b489e1270728f9cbae4bb894 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sun, 20 Feb 2011 00:09:37 +0100 Subject: [PATCH] Add some documentation comments. --- .../ConvertConstructorCallIntoInitializer.cs | 3 +++ .../Ast/Transforms/DelegateConstruction.cs | 1 + .../Ast/Transforms/UsingStatementTransform.cs | 2 +- .../ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs | 13 +++++++++++++ .../CSharp/Ast/PatternMatching/Backreference.cs | 3 +++ .../CSharp/Ast/PatternMatching/Match.cs | 5 ++++- .../CSharp/Ast/PatternMatching/Pattern.cs | 3 +++ 7 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ICSharpCode.Decompiler/Ast/Transforms/ConvertConstructorCallIntoInitializer.cs b/ICSharpCode.Decompiler/Ast/Transforms/ConvertConstructorCallIntoInitializer.cs index 67ed5bf34..4ffa69c9c 100644 --- a/ICSharpCode.Decompiler/Ast/Transforms/ConvertConstructorCallIntoInitializer.cs +++ b/ICSharpCode.Decompiler/Ast/Transforms/ConvertConstructorCallIntoInitializer.cs @@ -8,6 +8,9 @@ using Mono.Cecil; namespace Decompiler.Transforms { + /// + /// If the first element of a constructor is a chained constructor call, convert it into a constructor initializer. + /// public class ConvertConstructorCallIntoInitializer : DepthFirstAstVisitor, IAstTransform { public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) diff --git a/ICSharpCode.Decompiler/Ast/Transforms/DelegateConstruction.cs b/ICSharpCode.Decompiler/Ast/Transforms/DelegateConstruction.cs index 4906cc97c..a124786b7 100644 --- a/ICSharpCode.Decompiler/Ast/Transforms/DelegateConstruction.cs +++ b/ICSharpCode.Decompiler/Ast/Transforms/DelegateConstruction.cs @@ -14,6 +14,7 @@ namespace Decompiler.Transforms /// /// Converts "new Action(obj, ldftn(func))" into "new Action(obj.func)". /// For anonymous methods, creates an AnonymousMethodExpression. + /// Also gets rid of any "Display Classes" left over after inlining an anonymous method. /// public class DelegateConstruction : ContextTrackingVisitor { diff --git a/ICSharpCode.Decompiler/Ast/Transforms/UsingStatementTransform.cs b/ICSharpCode.Decompiler/Ast/Transforms/UsingStatementTransform.cs index c2b5a31ae..453c7a84a 100644 --- a/ICSharpCode.Decompiler/Ast/Transforms/UsingStatementTransform.cs +++ b/ICSharpCode.Decompiler/Ast/Transforms/UsingStatementTransform.cs @@ -10,7 +10,7 @@ using ICSharpCode.NRefactory.CSharp.PatternMatching; namespace Decompiler.Transforms { /// - /// Description of UsingStatementTransform. + /// Finds the expanded form of using statements using pattern matching and replaces it with a UsingStatement. /// public class UsingStatementTransform : IAstTransform { diff --git a/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs b/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs index d33ae9f18..a5361ef4f 100644 --- a/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs +++ b/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs @@ -578,6 +578,19 @@ namespace ICSharpCode.NRefactory.CSharp public abstract S AcceptVisitor (IAstVisitor visitor, T data); #region Pattern Matching + /// + /// Performs a pattern matching operation. + /// this is the pattern, is the AST that is being matched. + /// + /// + /// If successful, a match object containing the matched groups. + /// If the match failed, returns null. + /// + /// + /// Patterns are ASTs that contain special pattern nodes (from the PatternMatching namespace). + /// However, it is also possible to match two ASTs without any pattern nodes - doing so will produce an empty match object + /// if the two ASTs are structurally identical; or will return null if the ASTs are not identical. + /// public Match Match(AstNode other) { Match match = new Match(); diff --git a/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Backreference.cs b/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Backreference.cs index afa73f46e..c5573f01a 100644 --- a/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Backreference.cs +++ b/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Backreference.cs @@ -6,6 +6,9 @@ using System.Linq; namespace ICSharpCode.NRefactory.CSharp.PatternMatching { + /// + /// Matches the last entry in the specified named group. + /// public class Backreference : Pattern { readonly string referencedGroupName; diff --git a/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Match.cs b/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Match.cs index fe9b1bd9c..94a4d4832 100644 --- a/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Match.cs +++ b/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Match.cs @@ -7,7 +7,10 @@ using System.Linq; namespace ICSharpCode.NRefactory.CSharp.PatternMatching { - public class Match + /// + /// Represents the result of a pattern matching operation. + /// + public sealed class Match { List> results = new List>(); diff --git a/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Pattern.cs b/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Pattern.cs index f4f2470d9..794806a86 100644 --- a/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Pattern.cs +++ b/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Pattern.cs @@ -5,6 +5,9 @@ using System; namespace ICSharpCode.NRefactory.CSharp.PatternMatching { + /// + /// Base class for all patterns. + /// public abstract class Pattern : AstNode { public override NodeType NodeType {