diff --git a/ICSharpCode.Decompiler/CSharp/Annotations.cs b/ICSharpCode.Decompiler/CSharp/Annotations.cs index 9af04a298..064da15f2 100644 --- a/ICSharpCode.Decompiler/CSharp/Annotations.cs +++ b/ICSharpCode.Decompiler/CSharp/Annotations.cs @@ -99,19 +99,25 @@ namespace ICSharpCode.Decompiler.CSharp } /// - /// Retrieves the symbol associated with this AstNode, or null if no symbol is associated with the node. + /// Retrieves the associated with this AstNode, or null if no symbol is associated with the node. /// public static ISymbol GetSymbol(this AstNode node) { var rr = node.Annotation(); return rr != null ? rr.GetSymbol() : null; } - + + /// + /// Retrieves the associated with this , or if no resolve result is associated with the node. + /// public static ResolveResult GetResolveResult(this AstNode node) { return node.Annotation() ?? ErrorResolveResult.UnknownError; } - + + /// + /// Retrieves the associated with this , or null if no variable is associated with this identifier. + /// public static ILVariable GetILVariable(this IdentifierExpression expr) { var rr = expr.Annotation() as ILVariableResolveResult; @@ -120,7 +126,10 @@ namespace ICSharpCode.Decompiler.CSharp else return null; } - + + /// + /// Retrieves the associated with this , or null if no variable is associated with this initializer. + /// public static ILVariable GetILVariable(this VariableInitializer vi) { var rr = vi.Annotation() as ILVariableResolveResult; @@ -130,6 +139,9 @@ namespace ICSharpCode.Decompiler.CSharp return null; } + /// + /// Retrieves the associated with this , or null if no variable is associated with this foreach statement. + /// public static ILVariable GetILVariable(this ForeachStatement loop) { var rr = loop.Annotation() as ILVariableResolveResult; @@ -139,18 +151,27 @@ namespace ICSharpCode.Decompiler.CSharp return null; } + /// + /// Adds an to this initializer. + /// public static VariableInitializer WithILVariable(this VariableInitializer vi, ILVariable v) { vi.AddAnnotation(new ILVariableResolveResult(v, v.Type)); return vi; } + /// + /// Adds an to this foreach statement. + /// public static ForeachStatement WithILVariable(this ForeachStatement loop, ILVariable v) { loop.AddAnnotation(new ILVariableResolveResult(v, v.Type)); return loop; } + /// + /// Copies all annotations from to . + /// public static T CopyAnnotationsFrom(this T node, AstNode other) where T : AstNode { foreach (object annotation in other.Annotations) { @@ -159,6 +180,9 @@ namespace ICSharpCode.Decompiler.CSharp return node; } + /// + /// Copies all annotations from to . + /// public static T CopyInstructionsFrom(this T node, AstNode other) where T : AstNode { foreach (object annotation in other.Annotations.OfType()) { @@ -168,6 +192,9 @@ namespace ICSharpCode.Decompiler.CSharp } } + /// + /// Represents a reference to a local variable. + /// public class ILVariableResolveResult : ResolveResult { public readonly ILVariable Variable; @@ -183,6 +210,9 @@ namespace ICSharpCode.Decompiler.CSharp } } + /// + /// Annotates a with the instructions for the GetEnumerator, MoveNext and get_Current calls. + /// public class ForeachAnnotation { public readonly ILInstruction GetEnumeratorCall;