public bool Matches(ParameterName name) { if (name == null) { throw new ArgumentNullException(nameof(name)); } // TODO Sentinel matching could impact this (uncommon) return(StaticMatches(this, name)); }
public bool Matches(MethodName name) { if (name == null) { throw new ArgumentNullException("name"); } return(name.Name == Name && TypeName.SafeMatch(DeclaringType, name.DeclaringType) && this.GenericParameterCount == name.GenericParameterCount && TypeName.MatchGenericArguments(this.GenericArguments, name.GenericArguments) && ParameterName.MatchHelper(this, name)); }
private ParameterName CloneParameter(ParameterName t, int index) { return(new DefaultParameterName(this, index, t.Name, t.ParameterType, t.Modifiers)); }
public MethodName RemoveParameter(ParameterName parameter) { return(WithParameters(Parameters.ImmutableRemove(parameter, CloneParameter))); }
public PropertyName RemoveIndexParameter(ParameterName parameter) { return(WithIndexParameters(IndexParameters.ImmutableRemove(parameter, CloneParameter))); }
internal void FinalizeReturnType(TypeName returnType) { _returnParameter = new DefaultReturnParameterName(this, returnType, null); }
public FunctionPointerTypeName RemoveParameter(ParameterName parameter) { return(WithParameters(Parameters.ImmutableRemove(parameter, CloneParameter))); }
protected internal virtual string FormatParameter(string format, ParameterName name, IFormatProvider formatProvider) { if (name == null) { throw new ArgumentNullException("name"); } if (string.IsNullOrEmpty(format)) { format = GetDefaultFormat(formatProvider, SymbolType.Parameter); } else if (format.Length > 2) { throw new FormatException(); } // Valid formats: // {G|C|N|F|U} {V|v}? char c = format[0]; var modifiers = name.Modifiers.Count == 0 ? "" : name.Modifiers.ToString() + " "; string over = modifiers + "{1} {0}"; // Beans cool if (format.Length == 2) { if (format[1] == 'V') { over = "{0}:{1}"; // cool:Beans } else if (format[1] == 'v') { over = "{1}"; // Beans } else { throw new FormatException(); } } if (string.IsNullOrEmpty(name.Name)) { over = "{1}"; // Beans } switch (c) { case 'G': case 'C': case 'N': case 'F': case 'U': if (string.IsNullOrEmpty(name.Name) && name.ParameterType == null) { return(string.Empty); } string pmType = string.Empty; if (name.ParameterType != null) { pmType = name.ParameterType.ToString(c.ToString(), formatProvider); } return(string.Format(over, name.Name, pmType)); default: throw new FormatException(); } }
protected internal override string FormatParameter(string format, ParameterName name, IFormatProvider formatProvider) { return(name.ParameterType.Name); }
static bool StaticMatches(ParameterName self, ParameterName name) { return(self.Position == name.Position && TypeName.SafeMatch((TypeName)self.ParameterType, (TypeName)name.ParameterType) && self.Modifiers.Match(name.Modifiers)); }