// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under MIT X11 license (for details please see \doc\license.txt) using System; using ICSharpCode.NRefactory.CSharp; namespace Decompiler { static class NRefactoryExtensions { public static T WithAnnotation(this T node, object annotation) where T : AstNode { if (annotation != null) node.AddAnnotation(annotation); return node; } public static T CopyAnnotationsFrom(this T node, AstNode other) where T : AstNode { foreach (var annotation in other.Annotations()) { node.AddAnnotation(annotation); } return node; } public static T Detach(this T node) where T : AstNode { node.Remove(); return node; } } }