/// <summary> /// Find all instances of the given oldExpr inside this text expression tree /// and replace them with a copy of newExpr. The search is done once and only instances near the /// leaf of the tree are replaced (i.e. one search-replace iteration over the tree) /// </summary> /// <param name="oldExpr"></param> /// <param name="newExpr"></param> /// <returns></returns> public SteExpression ReplaceAllInPlace(SteExpression oldExpr, SteExpression newExpr) { if (SyntaxTreeUtils.Equals(this, oldExpr)) { ResetAsCopy(newExpr); return(this); } if (IsAtomic) { return(this); } foreach (var subExpr in _argsList) { subExpr.ReplaceAllInPlace(oldExpr, newExpr); } return(this); }
public override bool Equals(object obj) { return(!ReferenceEquals(obj, null) && SyntaxTreeUtils.Equals(this, obj as SteExpression)); }