Skip to content

Merge upstream master to fork master #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Oct 1, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Avoid assumptions on parameters
  • Loading branch information
dr-BEat committed Aug 23, 2018
commit a1f5b732fd084fdc7ac0f0b13fecdbae6ae8735c
5 changes: 3 additions & 2 deletions src/WorkflowCore/Services/FluentBuilders/ExpressionHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public static Expression<Action<TObject, TParam>> CreateSetter<TObject, TParam>(

public static LambdaExpression CreateSetter(LambdaExpression getterExpression)
{
var thisParameter = getterExpression.Parameters.Single();
var valueParameter = Expression.Parameter(getterExpression.ReturnType, "value");
Expression assignment;
if (getterExpression.Body is MethodCallExpression callExpression && callExpression.Method.Name == "get_Item")
Expand All @@ -48,7 +47,9 @@ public static LambdaExpression CreateSetter(LambdaExpression getterExpression)
{
assignment = Expression.Assign(getterExpression.Body, valueParameter);
}
return Expression.Lambda(assignment, thisParameter, valueParameter);

var parameters = getterExpression.Parameters.Concat(new[] {valueParameter}).ToArray();
return Expression.Lambda(assignment, parameters);
}
}
}