Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit ebac6f5

Browse files
committed
Restoring the return type of the Expression<TDelegate>.Update
The method is a public API and is used to return Expression<TDelegate>
1 parent fc96be9 commit ebac6f5

File tree

4 files changed

+3
-32
lines changed

4 files changed

+3
-32
lines changed

src/System.Linq.Expressions/src/System/Linq/Expressions/DebugViewWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ protected internal override Expression VisitParameter(ParameterExpression node)
430430
return node;
431431
}
432432

433-
protected internal override Expression VisitLambda(LambdaExpression node)
433+
protected internal override Expression VisitLambda<T>(Expression<T> node)
434434
{
435435
Out(
436436
String.Format(CultureInfo.CurrentCulture,

src/System.Linq.Expressions/src/System/Linq/Expressions/ExpressionStringBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ protected internal override Expression VisitParameter(ParameterExpression node)
326326
return node;
327327
}
328328

329-
protected internal override Expression VisitLambda(LambdaExpression node)
329+
protected internal override Expression VisitLambda<T>(Expression<T> node)
330330
{
331331
if (node.Parameters.Count == 1)
332332
{

src/System.Linq.Expressions/src/System/Linq/Expressions/ExpressionVisitor.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -364,18 +364,6 @@ protected internal virtual Expression VisitLabel(LabelExpression node)
364364
/// <returns>The modified expression, if it or any subexpression was modified;
365365
/// otherwise, returns the original expression.</returns>
366366
protected internal virtual Expression VisitLambda<T>(Expression<T> node)
367-
{
368-
return VisitLambda((LambdaExpression)node);
369-
}
370-
371-
/// <summary>
372-
/// Visits the children of the <see cref="LambdaExpression" />.
373-
/// </summary>
374-
/// <typeparam name="T">The type of the delegate.</typeparam>
375-
/// <param name="node">The expression to visit.</param>
376-
/// <returns>The modified expression, if it or any subexpression was modified;
377-
/// otherwise, returns the original expression.</returns>
378-
protected internal virtual Expression VisitLambda(LambdaExpression node)
379367
{
380368
return node.Update(Visit(node.Body), VisitAndConvert(node.Parameters, "VisitLambda"));
381369
}

src/System.Linq.Expressions/src/System/Linq/Expressions/LambdaExpression.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,6 @@ public Delegate Compile()
120120
#endif
121121
}
122122

123-
/// <summary>
124-
/// Dispatches to the specific visit method for this node type.
125-
/// </summary>
126-
protected internal override Expression Accept(ExpressionVisitor visitor)
127-
{
128-
return visitor.VisitLambda(this);
129-
}
130-
131-
public virtual LambdaExpression Update(Expression body, IEnumerable<ParameterExpression> parameters)
132-
{
133-
if (body == Body && parameters == Parameters)
134-
{
135-
return this;
136-
}
137-
return Expression.Lambda(Type, body, Name, TailCall, parameters);
138-
}
139-
140123
#if FEATURE_CORECLR
141124
internal abstract LambdaExpression Accept(Compiler.StackSpiller spiller);
142125
#endif
@@ -178,7 +161,7 @@ public Expression(Expression body, string name, bool tailCall, ReadOnlyCollectio
178161
/// <param name="body">The <see cref="LambdaExpression.Body">Body</see> property of the result.</param>
179162
/// <param name="parameters">The <see cref="LambdaExpression.Parameters">Parameters</see> property of the result.</param>
180163
/// <returns>This expression if no children changed, or an expression with the updated children.</returns>
181-
public override LambdaExpression Update(Expression body, IEnumerable<ParameterExpression> parameters)
164+
public Expression<TDelegate> Update(Expression body, IEnumerable<ParameterExpression> parameters)
182165
{
183166
if (body == Body && parameters == Parameters)
184167
{

0 commit comments

Comments
 (0)