public interface ParameterData {
Type ParameterType (int pos);
int Count { get; }
+ bool HasParams { get; }
string ParameterName (int pos);
string ParameterDesc (int pos);
Parameter.Modifier ParameterModifier (int pos);
public Parameter.Modifier ParameterModifier (int pos)
{
- int len = pi.Length;
-
if (last_arg_is_params && pos >= pi.Length - 1)
return Parameter.Modifier.PARAMS;
else if (is_varargs && pos >= pi.Length)
return is_varargs ? pi.Length + 1 : pi.Length;
}
}
+
+ public bool HasParams {
+ get {
+ return this.last_arg_is_params;
+ }
+ }
}
{
this.param_types = param_types;
this.Parameters = parameters;
- }
- public InternalParameters (DeclSpace ds, Parameters parameters)
- : this (parameters.GetParameterInfo (ds), parameters)
- {
has_varargs = parameters.HasArglist;
if (param_types == null)
}
}
+ public bool HasParams {
+ get {
+ return Parameters.ArrayParameter != null;
+ }
+ }
+
Parameter GetParameter (int pos)
{
Parameter [] fixed_pars = Parameters.FixedParameters;
}
}
- //
- // Compares member infos based on their name and
- // also allows one argument to be a string
- //
- class MemberInfoCompare : IComparer {
-
- public int Compare (object a, object b)
- {
- if (a == null || b == null){
- Console.WriteLine ("Invalid information passed");
- throw new Exception ();
- }
-
- if (a is string)
- return String.Compare ((string) a, ((MemberInfo)b).Name, false, CultureInfo.InvariantCulture);
-
- if (b is string)
- return String.Compare (((MemberInfo)a).Name, (string) b, false, CultureInfo.InvariantCulture);
-
- return String.Compare (((MemberInfo)a).Name, ((MemberInfo)b).Name, false, CultureInfo.InvariantCulture);
- }
- }
-
struct Pair {
public object First;
public object Second;
// buffer.
if ((value >= buffer_start) && (value < buffer_start + buffer_size)) {
int byte_offset = value - buffer_start;
+
+ // pos is an index into a char
+ // buffer so it might be
+ // greater than the buffer
+ // length now, if the buffer
+ // contains multibyte chars
pos = byte_offset;
- // encoded characters can take more than 1 byte length
- while (reader.CurrentEncoding.GetByteCount (buffer, 0, pos) > byte_offset)
+
+ // encoded characters can take
+ // more than 1 byte length.
+ while ((pos > buffer.Length) ||
+ reader.CurrentEncoding.GetByteCount (buffer, 0, pos) > byte_offset) {
pos--;
+ }
return;
}