Пример #1
0
        public FObject Invoke(FunctionInvoker fi, FObject[] args)
        {
            var  gotTypes = args.Select(x => x.Type).ToArray();
            bool j        = CallObjectTypes.Contains(gotTypes[0]);

            for (int i = 1; j && i < ArgumentTypes.Count; i++)
            {
                var item = ArgumentTypes[i];
                if (item != FObjectType.Any && item != gotTypes[i])
                {
                    j = false;
                    break;
                }
            }

            if (!j)
            {
                throw new RuntimeException($"Call did not match function signature of function '{Name}'. " +
                                           $"Expected {ArgumentTypes.PrettyArray()}, got {gotTypes.PrettyArray()}.");
            }
            return(Invokable.Invoke(fi, args));
        }