コード例 #1
0
 /// <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;
 }
コード例 #2
0
        /// <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();
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 private void With(IFunctionDescriptor descriptor)
 {
     _Descriptors.Add(descriptor.Name, descriptor);
 }
コード例 #5
0
 public bool TryDescriptor(string name, out IFunctionDescriptor descriptor)
 {
     return(IsList(name) ? _Descriptors.TryGetValue("list", out descriptor) : _Descriptors.TryGetValue(name, out descriptor));
 }
コード例 #6
0
 /// <summary>
 /// Adds a key/value pair of key'1 =&gt; 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));
 }
コード例 #7
0
 protected FunctionCallNodeController(IFunctionDescriptor def)
 {
     Definition = def;
 }
コード例 #8
0
 protected FunctionCallNodeController(IFunctionDescriptor def)
 {
     Definition = def;
 }
コード例 #9
0
 /// <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);
 }