/// <summary> /// Specify a <see cref="FunctionCall"/> for the <see cref="Scope"/> /// </summary> /// <param name="scope"><see cref="Scope"/> to specify for</param> /// <param name="callback"><see cref="Action{FunctionCall}"/> that gets called for setting up the <see cref="FunctionCall"/></param> /// <returns>Chained <see cref="Scope"/> to keep building on</returns> public static Scope FunctionCall(this Scope scope, Action<FunctionCall> callback) { var functionCall = new FunctionCall(); scope.AddChild(functionCall); callback(functionCall); return scope; }
/// <summary> /// Call function on an accessor /// </summary> /// <param name="accessor"><see cref="Accessor"/> perform call on</param> /// <param name="callback"><see cref="Action{FunctionCall}"/> that gets called to build the functioncall</param> /// <returns>The <see cref="Assignment"/> to build on</returns> public static Accessor WithFunctionCall(this Accessor accessor, Action<FunctionCall> callback) { var functionCall = new FunctionCall(); accessor.Child = functionCall; callback(functionCall); return accessor; }
/// <summary> /// Assign a function call /// </summary> /// <param name="assignment"><see cref="Assignment"/> to assign to</param> /// <param name="callback"><see cref="Action{FunctionCall}"/> that gets called to build the functioncall</param> /// <returns>The <see cref="Assignment"/> to build on</returns> public static Assignment WithFunctionCall(this Assignment assignment, Action<FunctionCall> callback) { var functionCall = new FunctionCall(); assignment.Value = functionCall; callback(functionCall); return assignment; }
/// <summary> /// Specify a name for the <see cref="FunctionCall"/> /// </summary> /// <param name="functionCall"><see cref="FunctionCall"/> to set name for</param> /// <param name="name">Name of the <see cref="FunctionCall"/></param> /// <returns>Chained <see cref="FunctionCall"/> to keep building on</returns> public static FunctionCall WithName(this FunctionCall functionCall, string name) { functionCall.Function = name; return(functionCall); }
/// <summary> /// Set the parameters for a <see cref="FunctionCall"/> /// </summary> /// <param name="functionCall"><see cref="FunctionCall"/> to set for</param> /// <param name="parameters">Parameters to set</param> /// <returns>Chained <see cref="FunctionCall"/> to keep building on</returns> public static FunctionCall WithParameters(this FunctionCall functionCall, params LanguageElement[] parameters) { functionCall.Parameters = parameters; return(functionCall); }
/// <summary> /// Set the parameters for a <see cref="FunctionCall"/> based on strings /// </summary> /// <param name="functionCall"><see cref="FunctionCall"/> to set for</param> /// <param name="parameters">Parameters to set</param> /// <returns>Chained <see cref="FunctionCall"/> to keep building on</returns> public static FunctionCall WithParameters(this FunctionCall functionCall, params string[] parameters) { functionCall.Parameters = parameters.Select(p => new Literal(p)).ToArray(); return(functionCall); }