Beispiel #1
0
 internal static Arg SetParameters(IEnumerable <TypeName> parameterTypes)
 {
     return(result => {
         result.FinalizeParameters(
             ParameterData.AllFromTypes(
                 BindParameterTypes(result, parameterTypes)
                 )
             );
     });
 }
Beispiel #2
0
        private MethodName GetSetMethod()
        {
            string name = "set_" + Name;

            var parameters = new ParameterData[IndexParameters.Count + 1];

            parameters[parameters.Length - 1] = new ParameterData("value", PropertyType);
            var indexes = ParameterData.AllFromTypes(IndexParameters.Select(t => t.ParameterType));

            indexes.CopyTo(parameters, 0);

            return(new DefaultMethodName(
                       DeclaringType,
                       name,
                       DefaultMethodName.SetParameters(parameters),
                       DefaultMethodName.SetReturnType(TypeName.Void)
                       ));
        }
Beispiel #3
0
        public PropertyName GetProperty(string name, params TypeName[] parameters)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (name.Length == 0)
            {
                throw Failure.EmptyString(nameof(name));
            }

            parameters = parameters ?? Array.Empty <TypeName>();
            if (parameters.Any(t => t == null))
            {
                throw Failure.CollectionContainsNullElement("parameters");
            }

            return(new PropertyName(this, name, null, ParameterData.AllFromTypes(parameters)));
        }
Beispiel #4
0
        public PropertyName GetProperty(string name,
                                        TypeName propertyType,
                                        IEnumerable <TypeName> parameters)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (name.Length == 0)
            {
                throw Failure.EmptyString(nameof(name));
            }

            parameters = parameters ?? Array.Empty <TypeName>();
            if (parameters.Any(t => t == null))
            {
                throw Failure.CollectionContainsNullElement(nameof(parameters));
            }

            // TODO Can't bind unboound method parameters here
            var allParams = ParameterData.AllFromTypes(BindParameterTypes(null, parameters.ToArray()));

            return(new PropertyName(this, name, SafeCloneBind(propertyType), allParams));
        }