Author: benm
Date: 2005-07-07 01:39:38 -0400 (Thu, 07 Jul 2005)
New Revision: 47025
Modified:
trunk/mcs/tools/monop/ChangeLog
trunk/mcs/tools/monop/outline.cs
Log:
2005-07-07 Ben Maurer <[EMAIL PROTECTED]>
* outline.cs:
- Print out static for fields (how the hell did I let myself
not put this in earlier!!!!!)
- To print out const fields, we might need to quote
things. This logic is not complete yet (for example, a string
with \n will have a literal new line)
- Try some smarter logic to get less verbosity by printing out
fewer namespaces
- Do a nicer sorting for methods. It sorts things by param
type, then from fewest params to most. This makes overloads
get sorted out cleanly.
Modified: trunk/mcs/tools/monop/ChangeLog
===================================================================
--- trunk/mcs/tools/monop/ChangeLog 2005-07-07 04:48:43 UTC (rev 47024)
+++ trunk/mcs/tools/monop/ChangeLog 2005-07-07 05:39:38 UTC (rev 47025)
@@ -1,3 +1,17 @@
+2005-07-07 Ben Maurer <[EMAIL PROTECTED]>
+
+ * outline.cs:
+ - Print out static for fields (how the hell did I let myself
+ not put this in earlier!!!!!)
+ - To print out const fields, we might need to quote
+ things. This logic is not complete yet (for example, a string
+ with \n will have a literal new line)
+ - Try some smarter logic to get less verbosity by printing out
+ fewer namespaces
+ - Do a nicer sorting for methods. It sorts things by param
+ type, then from fewest params to most. This makes overloads
+ get sorted out cleanly.
+
2005-07-06 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* outline.cs: prevent nullref for non-public events.
Modified: trunk/mcs/tools/monop/outline.cs
===================================================================
--- trunk/mcs/tools/monop/outline.cs 2005-07-07 04:48:43 UTC (rev 47024)
+++ trunk/mcs/tools/monop/outline.cs 2005-07-07 05:39:38 UTC (rev 47025)
@@ -424,15 +424,23 @@
if (fi.IsPrivate) o.Write ("private ");
if (fi.IsAssembly) o.Write ("internal ");
if (fi.IsLiteral) o.Write ("const ");
+ else if (fi.IsStatic) o.Write ("static ");
if (fi.IsInitOnly) o.Write ("readonly ");
o.Write (FormatType (fi.FieldType));
o.Write (" ");
o.Write (fi.Name);
- if (fi.IsLiteral)
- {
+ if (fi.IsLiteral) {
+ object v = fi.GetValue (this);
+
+ // TODO: Escape values here
o.Write (" = ");
- o.Write (fi.GetValue (this));
+ if (v is char)
+ o.Write ("'{0}'", v);
+ else if (v is string)
+ o.Write ("\"{0}\"", v);
+ else
+ o.Write (fi.GetValue (this));
}
o.Write (";");
}
@@ -515,6 +523,8 @@
return sb.ToString ();
}
+ // TODO: fine tune this so that our output is less verbose. We need to
figure
+ // out a way to do this while not making things confusing.
string FormatType (Type t)
{
string type = GetFullName (t);
@@ -559,7 +569,17 @@
if (type.LastIndexOf(".") == 6)
return type.Substring(7);
-
+
+ //
+ // If the namespace of the type is the namespace of what
+ // we are printing (or is a member of one if its children
+ // don't print it. This basically means that in C# we would
+ // automatically get the namespace imported by virtue of the
+ // namespace {} block.
+ //
+ if (t.Namespace.StartsWith (this.t.Namespace))
+ return type.Substring (t.Namespace.Length + 1);
+
return type;
}
@@ -822,9 +842,27 @@
{
MethodBase aa = (MethodBase) a, bb = (MethodBase) b;
- if (aa.IsStatic == bb.IsStatic)
- return CompareMemberInfo (a, b);
-
+ if (aa.IsStatic == bb.IsStatic) {
+ int c = CompareMemberInfo (a, b);
+ if (c != 0)
+ return c;
+ ParameterInfo [] ap, bp;
+
+ //
+ // Sort overloads by the names of their types
+ // put methods with fewer params first.
+ //
+
+ ap = aa.GetParameters ();
+ bp = bb.GetParameters ();
+ int n = Math.Min (ap.Length, bp.Length);
+
+ for (int i = 0; i < n; i ++)
+ if ((c = CompareType (ap [i].ParameterType, bp
[i].ParameterType)) != 0)
+ return c;
+
+ return ap.Length.CompareTo (bp.Length);
+ }
if (aa.IsStatic)
return -1;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches