/// <summary> /// Expressions are compared using the concept of a <em>structural id</em>: /// variable and function names are anonymized such that two expressions with /// same tree structure will also have the same structural id and vice versa. /// Two value expressions are equal if /// <ol> /// <li>their structural id's are equal</li> /// <li>their bindings are equal</li> /// <li>their expected types are equal</li> /// </ol> /// </summary> public override bool Equals(object obj) { if (obj != null && obj.GetType() == this.GetType()) { TreeValueExpression other = (TreeValueExpression)obj; if (!builder.Equals(other.builder)) { return(false); } if (type != other.type) { return(false); } return(StructuralId.Equals(other.StructuralId) && bindings.Equals(other.bindings)); } return(false); }
/// <summary> /// Expressions are compared using the concept of a <em>structural id</em>: /// variable and function names are anonymized such that two expressions with /// same tree structure will also have the same structural id and vice versa. /// Two method expressions are equal if /// <ol> /// <li>their builders are equal</li> /// <li>their structural id's are equal</li> /// <li>their bindings are equal</li> /// <li>their expected types match</li> /// <li>their parameter types are equal</li> /// </ol> /// </summary> public override bool Equals(object obj) { if (obj != null && obj.GetType() == this.GetType()) { TreeMethodExpression other = (TreeMethodExpression)obj; if (!builder.Equals(other.builder)) { return(false); } if (type != other.type) { return(false); } if (!Enumerable.SequenceEqual(types, other.types)) { return(false); } return(StructuralId.Equals(other.StructuralId) && bindings.Equals(other.bindings)); } return(false); }