* Update nullable argument defaults and enhance ForEach tests with additional edge cases. * Refactor input evaluation and JavaScript evaluator for clarity and consistency. * Update src/modules/Elsa.Workflows.Core/Extensions/ActivityExecutionContextExtensions.InputEvaluation.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
17 lines
596 B
C#
17 lines
596 B
C#
using Elsa.Expressions.Contracts;
|
|
using Elsa.Expressions.Models;
|
|
|
|
namespace Elsa.Expressions;
|
|
|
|
/// <summary>
|
|
/// An expression handler for Delegate expressions.
|
|
/// </summary>
|
|
public class DelegateExpressionHandler : IExpressionHandler
|
|
{
|
|
/// <inheritdoc />
|
|
public async ValueTask<object?> EvaluateAsync(Expression expression, Type returnType, ExpressionExecutionContext context, ExpressionEvaluatorOptions options)
|
|
{
|
|
var value = expression.Value is Func<ExpressionExecutionContext, ValueTask<object?>> @delegate ? await @delegate(context) : null;
|
|
return value;
|
|
}
|
|
} |