using System; namespace Vellum.Generator { /// /// Describes a saved member of a [Saveable] type as plain data, which is all it takes to check its type can be /// saved. /// public sealed class MemberCheck : IEquatable { public readonly string Key; public readonly TypeShape Type; public readonly SourcePlace Place; /// /// Holds the name of the [Saveable] base class that already saves something under this member's key, or null /// if none does. /// public readonly string HiddenIn; public MemberCheck(string key, TypeShape type, SourcePlace place, string hiddenIn) { Key = key; Type = type; Place = place; HiddenIn = hiddenIn; } public bool Equals(MemberCheck other) { return other != null && Key == other.Key && Type.Equals(other.Type) && Place.Equals(other.Place) && HiddenIn == other.HiddenIn; } public override bool Equals(object obj) { return Equals(obj as MemberCheck); } public override int GetHashCode() { return Key.GetHashCode() * 31 + Type.GetHashCode(); } } }