Hi,
Currently ILDASM does not display the generic parameter in class
declaration but uses it in method declaration. e.g.
.class public auto ansi beforefieldinit Test.CollectionBase`1
instead of
.class public auto ansi beforefieldinit Test.CollectionBase`1<T>
To fix this in
Mono.Disassembler.ReflectionDisassembler::WriteTypeHeader replace
m_writer.WriteLine (Formater.Escape (type.Name));
with
//Emit the name of the class without terminating the line
m_writer.Write(Formater.Escape (type.Name));
if (type.HasGenericParameters) {
m_writer.Write("<");
for (int i = 0; i < type.GenericParameters.Count; i++)
{
m_writer.Write(type.GenericParameters
[i].FullName);
//If there are more than one Generic Parameters
//separate them by commas.
if (i < type.GenericParameters.Count - 1) {
m_writer.Write(",");
}
}
m_writer.Write(">");
}
m_writer.WriteLine();
Regards,
Karan Sev
p.s. I am not sure what the convention is about the paths in a patch
file. If there is one, I would appreciate it if some could let me
know.
========== Patch File ============
--- D:\Source Code\Mono\Cecil\ildasm\Mono.Disassembler
\ReflectionDisassembler.cs 2008-11-25 18:14:27.000000000 +-0530
+++ D:\Source Code\Decompiler\Mirror\04\ReflectionDisassembler.cs
2008-12-06 16:11:54.000000000 +-0530
@@ -121,13 +121,27 @@
m_writer.WriteFlags (attributes, (int)
TypeAttributes.LayoutMask,
m_typeLayoutVals, m_typeLayoutMap);
m_writer.WriteFlags (attributes, (int)
TypeAttributes.StringFormatMask,
m_typeFormatVals, m_typeFormatMap);
m_writer.WriteFlags (attributes, m_typeVals, m_typeMap);
- m_writer.WriteLine (Formater.Escape (type.Name));
+ //Emit the name of the class without terminating the line
+ m_writer.Write(Formater.Escape (type.Name));
+ if (type.HasGenericParameters) {
+ m_writer.Write("<");
+ for (int i = 0; i < type.GenericParameters.Count; i+
+) {
+ m_writer.Write(type.GenericParameters
[i].FullName);
+ //If there are more than one Generic Parameters
+ //separate them by commas.
+ if (i < type.GenericParameters.Count - 1) {
+ m_writer.Write(",");
+ }
+ }
+ m_writer.Write(">");
+ }
+ m_writer.WriteLine();
if (type.BaseType != null) {
m_writer.Indent ();
m_writer.Write ("extends ");
m_writer.WriteLine (Formater.Format
(type.BaseType));
m_writer.Unindent ();
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---