| | | 1 | | using System; |
| | | 2 | | |
| | | 3 | | namespace NexusLabs.Needlr.Generators.Models; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// A positional primary-constructor parameter forwarded by a generated record |
| | | 7 | | /// constructor overload. |
| | | 8 | | /// </summary> |
| | | 9 | | internal readonly struct RecordConstructorPrimaryParameter : |
| | | 10 | | IEquatable<RecordConstructorPrimaryParameter> |
| | | 11 | | { |
| | | 12 | | public RecordConstructorPrimaryParameter( |
| | | 13 | | string name, |
| | | 14 | | string escapedName, |
| | | 15 | | string typeName, |
| | | 16 | | string documentation) |
| | | 17 | | { |
| | 29 | 18 | | Name = name; |
| | 29 | 19 | | EscapedName = escapedName; |
| | 29 | 20 | | TypeName = typeName; |
| | 29 | 21 | | Documentation = documentation; |
| | 29 | 22 | | } |
| | | 23 | | |
| | 36 | 24 | | public string Name { get; } |
| | | 25 | | |
| | 62 | 26 | | public string EscapedName { get; } |
| | | 27 | | |
| | 36 | 28 | | public string TypeName { get; } |
| | | 29 | | |
| | 36 | 30 | | public string Documentation { get; } |
| | | 31 | | |
| | | 32 | | public bool Equals(RecordConstructorPrimaryParameter other) |
| | | 33 | | { |
| | 5 | 34 | | return string.Equals(Name, other.Name, StringComparison.Ordinal) && |
| | 5 | 35 | | string.Equals(EscapedName, other.EscapedName, StringComparison.Ordinal) && |
| | 5 | 36 | | string.Equals(TypeName, other.TypeName, StringComparison.Ordinal) && |
| | 5 | 37 | | string.Equals( |
| | 5 | 38 | | Documentation, |
| | 5 | 39 | | other.Documentation, |
| | 5 | 40 | | StringComparison.Ordinal); |
| | | 41 | | } |
| | | 42 | | |
| | | 43 | | public override bool Equals(object? obj) |
| | | 44 | | { |
| | 0 | 45 | | return obj is RecordConstructorPrimaryParameter other && Equals(other); |
| | | 46 | | } |
| | | 47 | | |
| | | 48 | | public override int GetHashCode() |
| | | 49 | | { |
| | | 50 | | unchecked |
| | | 51 | | { |
| | 0 | 52 | | var hash = Name.GetHashCode(); |
| | 0 | 53 | | hash = (hash * 397) ^ EscapedName.GetHashCode(); |
| | 0 | 54 | | hash = (hash * 397) ^ TypeName.GetHashCode(); |
| | 0 | 55 | | hash = (hash * 397) ^ Documentation.GetHashCode(); |
| | 0 | 56 | | return hash; |
| | | 57 | | } |
| | | 58 | | } |
| | | 59 | | |
| | | 60 | | public static bool operator ==( |
| | | 61 | | RecordConstructorPrimaryParameter left, |
| | | 62 | | RecordConstructorPrimaryParameter right) |
| | | 63 | | { |
| | 0 | 64 | | return left.Equals(right); |
| | | 65 | | } |
| | | 66 | | |
| | | 67 | | public static bool operator !=( |
| | | 68 | | RecordConstructorPrimaryParameter left, |
| | | 69 | | RecordConstructorPrimaryParameter right) |
| | | 70 | | { |
| | 0 | 71 | | return !left.Equals(right); |
| | | 72 | | } |
| | | 73 | | } |