Class HumlNode
Base type for all HUML AST nodes.
public abstract record HumlNode : IEquatable<HumlNode>
- Inheritance
-
HumlNode
- Implements
- Derived
- Inherited Members
Remarks
Line and Column are declared in the record body (not in a
primary constructor). To ensure they are excluded from the auto-generated Equals and
GetHashCode of every derived record, this base record overrides Equals(HumlNode?)
and GetHashCode to ignore these properties. Two nodes representing the same HUML value
parsed from different source positions remain structurally equal — only primary-constructor
parameters of the concrete derived type participate in equality.
Properties
Column
0-based column position in the source document where this node begins, or 0 if unknown.
public int Column { get; init; }
Property Value
Line
1-based line number in the source document where this node begins, or 0 if unknown.
public int Line { get; init; }
Property Value
Methods
Equals(HumlNode?)
Overrides base-record equality to exclude Line and Column
from the equality check. Derived record types synthesise their own
Equals(DerivedType?) that calls this method for the base portion; by returning
true for any two nodes of the same runtime type, we ensure only the
derived type's primary-constructor parameters contribute to structural equality.
public virtual bool Equals(HumlNode? other)
Parameters
otherHumlNode
Returns
GetHashCode()
Returns a hash code based only on the runtime type, consistent with the overridden Equals(HumlNode?) that excludes Line and Column. Derived types override this further to incorporate their primary-constructor parameters.
public override int GetHashCode()