internal MethodName WithParameters(ParameterData[] pms) { return(new DefaultMethodName(DeclaringType, _name) { _parameters = ParameterData.ToArray(this, pms), _genericParameters = _genericParameters, _returnParameter = CopyReturnParameter(this), }); }
internal PropertyName(TypeName declaringType, string name, TypeName propertyType, ParameterData[] parameters) : base(declaringType) { _name = name; PropertyType = propertyType; _parameters = ParameterData.ToArray(this, parameters) ?? ParameterNameCollection.Empty; }
internal static Arg SetParameters(IEnumerable <TypeName> parameterTypes) { return(result => { result.FinalizeParameters( ParameterData.AllFromTypes( BindParameterTypes(result, parameterTypes) ) ); }); }
public static PropertyName FromPropertyInfo(System.Reflection.PropertyInfo property) { if (property == null) { throw new ArgumentNullException("property"); } var declaringType = TypeName.FromType(property.DeclaringType); var propertyType = TypeName.FromType(property.PropertyType); var parms = ParameterData.ConvertAll(property.GetIndexParameters()); return(new PropertyName(declaringType, property.Name, propertyType, parms)); }
internal override MethodName WithGenericParameters(GenericParameterName[] parameters) { var result = new DefaultMethodName(DeclaringType, _name); result.FinalizeGenerics(parameters); result.FinalizeParameters(ParameterData.AsData(_parameters).ToArray()); if (ReturnType != null) { result.FinalizeReturnType(ReturnType.CloneBind(DeclaringType, result)); } return(result); }
public static MethodName FromConstructorInfo(System.Reflection.ConstructorInfo constructor) { if (constructor == null) { throw new ArgumentNullException("constructor"); } return(new DefaultMethodName( TypeName.FromType(constructor.DeclaringType), constructor.Name, DefaultMethodName.SetGenericMangle(0), DefaultMethodName.SetParameters( ParameterData.ConvertAll(constructor.GetParameters()) ) )); }
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) )); }
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))); }
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)); }
internal static Arg SetParameters(ParameterInfo[] parameters) { return(result => result.FinalizeParameters(ParameterData.ConvertAll(parameters))); }
internal void FinalizeParameters(ParameterData[] pms) { _parameters = ParameterData.ToArray(this, pms); }