/// <summary> /// Initializes a new instance of the <see cref="SerializableFunctionDescriptor"/> class. /// </summary> /// <param name="name"> /// The name. /// </param> /// <param name="function"> /// The function. /// </param> public SerializableFunctionDescriptor(string name, [NotNull] IFunctionDescriptor function) { this.Name = name; this.Description = function.Description; this.Arguments = function.Arguments.Count == 0 ? null : function.Arguments.Select(argument => new SerializableArgumentDescriptor(argument)).ToArray(); this.ReturnType = new SerializableTypeDescriptor(function.ReturnType); this.IsAggregateFunction = function.IsAggregateFunction; this.HasSideEffects = function.HasSideEffects; }
/// <summary> /// Initializes a new instance of the <see cref="Signature"/> class. /// </summary> /// <param name="buffer"> /// The buffer. /// </param> /// <param name="function"> /// The function. /// </param> /// <param name="trackingSpan"> /// The tracking span. /// </param> public Signature([NotNull] ITextBuffer buffer, IFunctionDescriptor function, ITrackingSpan trackingSpan) { this.ApplicableToSpan = trackingSpan; this.function = function; this.Parameters = new ReadOnlyCollection <IParameter>(this.function.Arguments.Select(a => new Parameter(this, a)).ToArray <IParameter>()); buffer.Changed += (o, e) => this.ComputeCurrentParameter(); this.ComputeCurrentParameter(); }
public IConnectQlFunctions AddFunction(string name, [NotNull] IFunctionDescriptor function) { var keyName = $"{name}'{function.Arguments.Count}"; if (this.dictionary.ContainsKey(keyName)) { throw new ArgumentException($"Function '{name.ToUpperInvariant()}' with {function.Arguments.Count} parameters is already registered."); } this.dictionary[keyName] = function; return(this); }
private void With(IFunctionDescriptor descriptor) { _Descriptors.Add(descriptor.Name, descriptor); }
public bool TryDescriptor(string name, out IFunctionDescriptor descriptor) { return(IsList(name) ? _Descriptors.TryGetValue("list", out descriptor) : _Descriptors.TryGetValue(name, out descriptor)); }
/// <summary> /// Adds a key/value pair of key'1 => function to the dictionary. /// </summary> /// <param name="name"> /// The name. /// </param> /// <param name="function"> /// The function. /// </param> /// <exception cref="System.ArgumentException"> /// Thrown when a lambda with the specified number of parameters is already in the dictionary. /// </exception> /// <returns> /// The <see cref="IConnectQlFunctions"/>. /// </returns> public IConnectQlFunctions AddFunction(string name, IFunctionDescriptor function) { return(this.functions.AddFunction(name, function)); }
protected FunctionCallNodeController(IFunctionDescriptor def) { Definition = def; }
/// <summary> /// Sets the function connected to the node. /// </summary> /// <param name="dataProvider"> /// The data provider. /// </param> /// <param name="node"> /// The node. /// </param> /// <param name="function"> /// The function. /// </param> public static void SetFunction([NotNull] this INodeDataProvider dataProvider, Node node, IFunctionDescriptor function) { dataProvider.Set(node, "Function", function); }