Exemplo n.º 1
0
        public override object Evaluate(IExpressionContext context)
        {
            Func <object[], object> unknownFunction = context != null?context.ResolveFunction(FunctionName) : null;

            if (unknownFunction != null)
            {
                object[] funcArgs;
                if (Arguments != null && Arguments.Length > 0)
                {
                    funcArgs = new object[Arguments.Length];
                    for (int i = 0; i < Arguments.Length; i++)
                    {
                        funcArgs[i] = Arguments[i].Evaluate(context);
                    }
                }
                else
                {
                    funcArgs = new object[0];
                }

                return(unknownFunction(funcArgs));
            }
            throw new InvalidOperationException("A function specified in the expression (" + FunctionName +
                                                ") does not exist.");
        }