using ICSharpCode.Decompiler.CSharp.Syntax; using System.Collections.Generic; using System.Linq; namespace Hast.Transformer.Helpers; internal static class MethodDeclarationFactory { public static MethodDeclaration CreateMethod( string name, IEnumerable annotations, AstNodeCollection attributes, IEnumerable parameters, BlockStatement body, AstType returnType) { var method = new MethodDeclaration { Name = name, }; foreach (var annotation in annotations) { method.AddAnnotation(annotation); } method.Attributes.AddRange(attributes.Select(attribute => attribute.Clone())); method.Parameters.AddRange(parameters.Select(parameter => parameter.Clone())); method.Body = body.Clone(); method.ReturnType = returnType.Clone(); return method; } }