36 lines
1.2 KiB
C#
Raw Permalink Normal View History

using System.Collections.Generic;
2019-10-19 13:52:16 +02:00
using System.Linq;
namespace CapnpC.CSharp.Generator.Model
{
class Method: IHasGenericParameters
{
public TypeDefinition DeclaringInterface { get; set; }
public int Id { get; set; }
public string Name { get; set; }
2020-01-30 21:53:08 +01:00
public string CsName { get; set; }
public List<Field> Params { get; } = new List<Field>();
public List<Field> Results { get; } = new List<Field>();
public Type ParamsStruct { get; set; }
public Type ResultStruct { get; set; }
public List<string> GenericParameters { get; } = new List<string>();
2019-10-19 13:52:16 +02:00
public Method Clone()
{
var method = new Method()
{
DeclaringInterface = DeclaringInterface,
Id = Id,
Name = Name,
2020-01-30 21:53:08 +01:00
CsName = CsName,
2019-10-19 13:52:16 +02:00
ParamsStruct = ParamsStruct,
ResultStruct = ResultStruct
};
method.Params.AddRange(Params.Select((p => p.Clone())));
method.Results.AddRange(Results.Select(r => r.Clone()));
method.GenericParameters.AddRange(GenericParameters);
return method;
}
}
}