using System;
namespace Vellum.Generator
{
///
/// Says where in a shape the type arguments of one generic class in a type's chain of base classes are, as plain
/// data an incremental generator step can compare between runs.
///
public sealed class BaseArguments : IEquatable
{
///
/// Holds the name of the generic type the class is made from.
///
public readonly string Name;
///
/// Holds where the arguments start in the shape, which keeps them next to each other.
///
public readonly int FirstChild;
public readonly int ChildCount;
public BaseArguments(string name, int firstChild, int childCount)
{
Name = name;
FirstChild = firstChild;
ChildCount = childCount;
}
public bool Equals(BaseArguments other)
{
return other != null
&& Name == other.Name
&& FirstChild == other.FirstChild
&& ChildCount == other.ChildCount;
}
public override bool Equals(object obj)
{
return Equals(obj as BaseArguments);
}
public override int GetHashCode()
{
return (Name.GetHashCode() * 31 + FirstChild) * 31 + ChildCount;
}
}
}