/// <summary> /// Calls a function with arguments, but without specifying an output /// </summary> /// <returns>If the function has only one output it returns it, otherwise it returns a structure /// with all the function's outputs.</returns> public static IFunction Call(this IFunction function, IFunction[] arguments, CompilationContext context, CallSite?callSite = null) { if (function == null) { throw new ArgumentNullException(nameof(function)); } if (!(context.Debug && !(function is IType)) && function.Outputs?.Length == 1 && function.Outputs[0].Name == "return") { return(function.Call(arguments, function.Outputs[0].Name, context, callSite)); } if (function.CheckArguments(arguments, null, context) != null) { return(Error.Instance); } return(new CalledFunction(function, arguments, callSite).ResolveReturns(context, callSite)); }