[Mono-dev] Parameter names and class status

Leszek Ciesielski skolima at gmail.com
Fri Oct 20 16:44:13 EDT 2006


On 10/20/06, Kornél Pál <kornelpal at gmail.com> wrote:
> > Though I really want to use passing by name, I'm not convinced
> > it's a good idea.

OK. The patch I submitted in the beginning works, I've just tested it
on Microsoft.Build.Tasks. The glitch is that it requires regenerating
the masterfiles (without this, every method with parameters is
reported as an error). And I was unable to test the whole Class Status
page, because this procedure :
http://www.mono-project.com/Class_Status aborts with
no rules to make 'src/class-status-Microsoft.VisualBasic.src' required
by 'deploy/ado-net.html'.
I generated a per-assembly status following this guide:
http://www.mono-project.com/Generating_class_status_pages

As to the number of differences: as I said, I could not generate the
whole status page. In the assembly I tested, there was one new
inconsistency uncovered, which bodes well for the code in general.

After I read what Kornél Pál wrote about public metadata, I made
another change to the corcompare/class-status generation feature.
Class status used to check whether attributes match, I extended it to
check if the values of the attributes match. Sometimes the differences
reported are of small consequence (eg. different CompanyName), but
other, such as attribute parameters from System.Xml.Serialization, may
have an important impact on interoperability. Patch is attached,
please review. Also attached is a simplified Makefile for producing
masterfiles / api-info files.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 1198 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061020/f27d5637/attachment.obj 
-------------- next part --------------
Index: mono-api-info.cs
===================================================================
--- mono-api-info.cs	(wersja 66839)
+++ mono-api-info.cs	(kopia robocza)
@@ -910,9 +910,12 @@
 					continue;
 
 				XmlNode node = document.CreateElement ("attribute");
-				AddAttribute (node, "name", t.ToString ());
+				StringBuilder name = new StringBuilder();
+				name.Append (t.ToString ());
+				name.Append ("(");
 
 				XmlNode properties = null;
+				bool hasProperties = false;
 				foreach (PropertyInfo pi in TypeData.GetProperties (t)) {
 					if (pi.Name == "TypeId")
 						continue;
@@ -931,17 +934,31 @@
 							AddAttribute (n, "null", "true");
 							continue;
 						}
+						
+						name.Append (pi.Name);
+						name.Append (" = ");
+						hasProperties = true;
 
 						string value = o.ToString ();
 						if (t == typeof (GuidAttribute))
 							value = value.ToUpper ();
 
 						AddAttribute (n, "value", value);
+						name.AppendFormat ("{0}, ", value);
 					}
 					catch (TargetInvocationException) {
 						continue;
 					}
 				}
+				
+				if (hasProperties)
+					name.Length -= 2; // remove ", "
+				name.Append (")");
+				
+				if (t.Name.EndsWith ("TODOAttribute")) //ignore MonoTODO
+					AddAttribute (node, "name", t.ToString ());
+				else				
+					AddAttribute (node, "name", name.ToString ());
 
 				natts.AppendChild (node);
 			}


More information about the Mono-devel-list mailing list