Author: ankit
Date: 2006-01-19 08:20:16 -0500 (Thu, 19 Jan 2006)
New Revision: 55779

Added:
   branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-1.il
   branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-2.il
   branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-3.il
   branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-4.il
Modified:
   branches/mono-1-1-13/mcs/class/PEAPI/ChangeLog
   branches/mono-1-1-13/mcs/class/PEAPI/Metadata.cs
   branches/mono-1-1-13/mcs/ilasm/codegen/ChangeLog
   branches/mono-1-1-13/mcs/ilasm/codegen/GenericParameters.cs
   branches/mono-1-1-13/mcs/ilasm/codegen/MethodDef.cs
   branches/mono-1-1-13/mcs/ilasm/codegen/MethodRef.cs
   branches/mono-1-1-13/mcs/ilasm/codegen/TypeDef.cs
   branches/mono-1-1-13/mcs/ilasm/parser/ChangeLog
   branches/mono-1-1-13/mcs/ilasm/parser/ILParser.jay
   branches/mono-1-1-13/mcs/ilasm/scanner/ChangeLog
   branches/mono-1-1-13/mcs/ilasm/scanner/ILTables.cs
   branches/mono-1-1-13/mcs/ilasm/tests/ChangeLog
Log:
Backport r55773, r55778

In ilasm/tests:
2006-01-19  Ankit Jain  <[EMAIL PROTECTED]>

        * err-gen-cattr-1.il: New.
        * err-gen-cattr-2.il: New.
        * err-gen-cattr-3.il: New.
        * err-gen-cattr-4.il: New.

In ilasm/codegen:
2006-01-19  Ankit Jain  <[EMAIL PROTECTED]>

        * GenericParameters.cs (GenericParameter): Implement ICustomAttrTarget.
        (GenericParameter.Resolve): New overload, reduce code duplication.
        (GenericParameters.GetGenericParam): New. Returns a GenericParameter.
        (GenericParameters.GetGenericParamNum): Update to use new 
GetGenericParam.

        * TypeDef.cs (TypeDef.GetGenericParam): New. Two overloads for id and 
index.
        * MethodDef.cs (MethodDef.GetGenericParam): Likewise.

2006-01-19  Ankit Jain  <[EMAIL PROTECTED]>

        * MethodRef.cs (MethodRef.Resolve): Resolve owner.

In ilasm/scanner:
2006-01-19  Ankit Jain  <[EMAIL PROTECTED]>

        * ILTables.cs (keywords): Add 'type' keyword.

In ilasm/parser:
2006-01-19  Ankit Jain  <[EMAIL PROTECTED]>

        * ILParser.jay (K_TYPE): New.
        (param_type_decl): New. Rule for '.param type ..', for specifying 
custom attibutes
        for type parameters.
        (class_decl | param_type_decl):
        (method_decl | param_type_decl): New.

In class/PEAPI:
2006-01-19  Ankit Jain  <[EMAIL PROTECTED]>

        * Metadata.cs (GenericParameter.GetCodedIx): Override. Return coded 
index
        for HasCustomAttr.
        (MetaData.BuildMetaData): Sort CustomAttribute table at the end.



Modified: branches/mono-1-1-13/mcs/class/PEAPI/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/PEAPI/ChangeLog      2006-01-19 13:13:36 UTC 
(rev 55778)
+++ branches/mono-1-1-13/mcs/class/PEAPI/ChangeLog      2006-01-19 13:20:16 UTC 
(rev 55779)
@@ -1,3 +1,9 @@
+2006-01-19  Ankit Jain  <[EMAIL PROTECTED]>
+
+       * Metadata.cs (GenericParameter.GetCodedIx): Override. Return coded 
index
+       for HasCustomAttr.
+       (MetaData.BuildMetaData): Sort CustomAttribute table at the end.
+
 2006-01-16  Ankit Jain  <[EMAIL PROTECTED]>
 
        * Metadata.cs (PInvokeAttr): Add 'bestfit_on', 'bestfit_off', 
'bestfit_mask',

Modified: branches/mono-1-1-13/mcs/class/PEAPI/Metadata.cs
===================================================================
--- branches/mono-1-1-13/mcs/class/PEAPI/Metadata.cs    2006-01-19 13:13:36 UTC 
(rev 55778)
+++ branches/mono-1-1-13/mcs/class/PEAPI/Metadata.cs    2006-01-19 13:20:16 UTC 
(rev 55779)
@@ -824,6 +824,13 @@
                        output.StringsIndex (nameIx);
                }
 
+               internal sealed override uint GetCodedIx(CIx code) 
+               {
+                       switch (code) {
+                               case (CIx.HasCustomAttr) : return 19; 
+                       }
+                       return 0;
+               }
 
        }
 
@@ -5204,7 +5211,6 @@
                        // will _ALWAYS_ be in the correct order as embedded in 
BuildMDTables
 
                        SortTable(metaDataTables[(int)MDTable.Constant]);
-                       SortTable(metaDataTables[(int)MDTable.CustomAttribute]);
                        SortTable(metaDataTables[(int)MDTable.FieldMarshal]);
                        SortTable(metaDataTables[(int)MDTable.DeclSecurity]);
                        SortTable(metaDataTables[(int)MDTable.MethodSemantics]);
@@ -5220,6 +5226,7 @@
                        
SortTable(metaDataTables[(int)MDTable.GenericParamConstraint]);
 #endif 
                        SortTable(metaDataTables[(int)MDTable.InterfaceImpl]);
+                       SortTable(metaDataTables[(int)MDTable.CustomAttribute]);
 
                }
 

Modified: branches/mono-1-1-13/mcs/ilasm/codegen/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/codegen/ChangeLog    2006-01-19 13:13:36 UTC 
(rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/codegen/ChangeLog    2006-01-19 13:20:16 UTC 
(rev 55779)
@@ -1,3 +1,17 @@
+2006-01-19  Ankit Jain  <[EMAIL PROTECTED]>
+
+       * GenericParameters.cs (GenericParameter): Implement ICustomAttrTarget.
+       (GenericParameter.Resolve): New overload, reduce code duplication.
+       (GenericParameters.GetGenericParam): New. Returns a GenericParameter.
+       (GenericParameters.GetGenericParamNum): Update to use new 
GetGenericParam.
+
+       * TypeDef.cs (TypeDef.GetGenericParam): New. Two overloads for id and 
index.
+       * MethodDef.cs (MethodDef.GetGenericParam): Likewise.
+
+2006-01-19  Ankit Jain  <[EMAIL PROTECTED]>
+
+       * MethodRef.cs (MethodRef.Resolve): Resolve owner.
+
 2006-01-16  Ankit Jain  <[EMAIL PROTECTED]>
 
        * TypeDef.cs (TypeDef.IComparable): Implement IComparable interface.

Modified: branches/mono-1-1-13/mcs/ilasm/codegen/GenericParameters.cs
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/codegen/GenericParameters.cs 2006-01-19 
13:13:36 UTC (rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/codegen/GenericParameters.cs 2006-01-19 
13:20:16 UTC (rev 55779)
@@ -13,11 +13,12 @@
 
 namespace Mono.ILASM {
 
-       public class GenericParameter {
+       public class GenericParameter : ICustomAttrTarget {
                string id;
                int num;
                 PEAPI.GenericParamAttributes attr;
                ArrayList constraintsList;
+               ArrayList customattrList;
                
                public GenericParameter (string id) 
                        : this (id, 0, null)
@@ -30,6 +31,7 @@
                        this.attr = attr;
                        num = -1;
                        constraintsList = null;
+                       customattrList = null;
                                
                        if (constraints != null)
                                foreach (BaseTypeRef typeref in constraints)
@@ -61,16 +63,34 @@
                        return Id;
                }
 
+               public void AddCustomAttribute (CustomAttr customattr)
+               {
+                       if (customattrList == null)
+                               customattrList = new ArrayList ();
+
+                       customattrList.Add (customattr);
+               }
+
                public void Resolve (CodeGen code_gen, PEAPI.MethodDef 
methoddef)
                {
                        PEAPI.GenericParameter gp = 
methoddef.AddGenericParameter ((short) num, id, attr);
-                       ResolveConstraints (code_gen, gp);
+                       Resolve (code_gen, gp);
                }
 
                public void Resolve (CodeGen code_gen, PEAPI.ClassDef classdef)
                {
                        PEAPI.GenericParameter gp = 
classdef.AddGenericParameter ((short) num, id, attr);
+                       Resolve (code_gen, gp);
+               }
+
+               private void Resolve (CodeGen code_gen, PEAPI.GenericParameter 
gp)
+               {
                        ResolveConstraints (code_gen, gp);
+                       if (customattrList == null)
+                               return;
+
+                       foreach (CustomAttr customattr in customattrList)
+                               customattr.AddTo (code_gen, gp);
                }
 
                public void ResolveConstraints (GenericParameters 
type_gen_params, GenericParameters method_gen_params)
@@ -85,7 +105,7 @@
                        }
                }
 
-               public void ResolveConstraints (CodeGen code_gen, 
PEAPI.GenericParameter gp)
+               private void ResolveConstraints (CodeGen code_gen, 
PEAPI.GenericParameter gp)
                {
                        if (constraintsList == null)
                                return;
@@ -129,7 +149,7 @@
                        param_str = null;
                }
                
-               public int GetGenericParamNum (string id)
+               public GenericParameter GetGenericParam (string id)
                {
                        if (param_list == null)
                                //FIXME: Report error
@@ -137,7 +157,16 @@
 
                        foreach (GenericParameter param in param_list)
                                if (param.Id == id)
-                                       return param.Num;
+                                       return param;
+                       return null;
+               }
+       
+               public int GetGenericParamNum (string id)
+               {
+                       GenericParameter param = GetGenericParam (id);
+                       if (param != null)
+                               return param.Num;
+
                        return -1;
                }
 

Modified: branches/mono-1-1-13/mcs/ilasm/codegen/MethodDef.cs
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/codegen/MethodDef.cs 2006-01-19 13:13:36 UTC 
(rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/codegen/MethodDef.cs 2006-01-19 13:20:16 UTC 
(rev 55779)
@@ -159,6 +159,22 @@
                         get { return (gen_params != null ? gen_params.Count : 
0); }
                 }
 
+                public GenericParameter GetGenericParam (string id)
+                {
+                        if (gen_params == null)
+                                return null;
+                        
+                        return gen_params.GetGenericParam (id);
+                }
+
+                public GenericParameter GetGenericParam (int index)
+                {
+                        if (gen_params == null || index < 0 || index >= 
gen_params.Count)
+                                return null;
+                        
+                        return gen_params [index];
+                }
+
                 public int GetGenericParamNum (string id)
                 {
                         if (gen_params == null)

Modified: branches/mono-1-1-13/mcs/ilasm/codegen/MethodRef.cs
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/codegen/MethodRef.cs 2006-01-19 13:13:36 UTC 
(rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/codegen/MethodRef.cs 2006-01-19 13:20:16 UTC 
(rev 55779)
@@ -26,6 +26,8 @@
                         if (is_resolved)
                                 return;
 
+                       owner.Resolve (code_gen);
+
                         TypeDef owner_def = 
code_gen.TypeManager[owner.FullName];
                        if (owner_def == null)
                                throw new Exception (String.Format ("Reference 
to undefined class '{0}'", owner.FullName));

Modified: branches/mono-1-1-13/mcs/ilasm/codegen/TypeDef.cs
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/codegen/TypeDef.cs   2006-01-19 13:13:36 UTC 
(rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/codegen/TypeDef.cs   2006-01-19 13:20:16 UTC 
(rev 55779)
@@ -253,6 +253,22 @@
                         decl_sec.AddPermission (sec_action, iper);
                 }
 
+                public GenericParameter GetGenericParam (string id)
+                {
+                        if (gen_params == null)
+                                return null;
+                        
+                        return gen_params.GetGenericParam (id);
+                }
+
+                public GenericParameter GetGenericParam (int index)
+                {
+                        if (gen_params == null || index < 0 || index >= 
gen_params.Count)
+                                return null;
+                        
+                        return gen_params [index];
+                }
+
                 public int GetGenericParamNum (string id)
                 {
                         if (gen_params == null)

Modified: branches/mono-1-1-13/mcs/ilasm/parser/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/parser/ChangeLog     2006-01-19 13:13:36 UTC 
(rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/parser/ChangeLog     2006-01-19 13:20:16 UTC 
(rev 55779)
@@ -1,3 +1,11 @@
+2006-01-19  Ankit Jain  <[EMAIL PROTECTED]>
+
+       * ILParser.jay (K_TYPE): New.
+       (param_type_decl): New. Rule for '.param type ..', for specifying 
custom attibutes
+       for type parameters.
+       (class_decl | param_type_decl):
+       (method_decl | param_type_decl): New.
+
 2006-01-16  Ankit Jain  <[EMAIL PROTECTED]>
 
        * ILParser.jay (K_BESTFIT):

Modified: branches/mono-1-1-13/mcs/ilasm/parser/ILParser.jay
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/parser/ILParser.jay  2006-01-19 13:13:36 UTC 
(rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/parser/ILParser.jay  2006-01-19 13:20:16 UTC 
(rev 55779)
@@ -401,6 +401,7 @@
 %token K_MODREQ
 %token K_MODOPT
 %token K_TYPEDREF
+%token K_TYPE
 %token K_WCHAR
 %token K_CHAR
 %token K_FROMUNMANAGED
@@ -755,6 +756,27 @@
                                 $$ = $1;
                           }
                         ;
+
+param_type_decl         : D_PARAM K_TYPE id
+                         {
+                                 if (codegen.CurrentMethodDef != null)
+                                         codegen.CurrentCustomAttrTarget = 
codegen.CurrentMethodDef.GetGenericParam ((string) $3);
+                                 else
+                                         codegen.CurrentCustomAttrTarget = 
codegen.CurrentTypeDef.GetGenericParam ((string) $3);
+                                 if (codegen.CurrentCustomAttrTarget == null)
+                                         throw new Exception (String.Format 
("Type parameter '{0}' undefined.", (string) $3));
+                         }
+                       | D_PARAM K_TYPE OPEN_BRACKET int32 CLOSE_BRACKET
+                         {
+                                 int index = ((int) $4);
+                                 if (codegen.CurrentMethodDef != null)
+                                         codegen.CurrentCustomAttrTarget = 
codegen.CurrentMethodDef.GetGenericParam (index - 1);
+                                 else
+                                         codegen.CurrentCustomAttrTarget = 
codegen.CurrentTypeDef.GetGenericParam (index - 1);
+                                 if (codegen.CurrentCustomAttrTarget == null)
+                                         throw new Exception (String.Format 
("Type parameter '{0}' index out of range.", index));
+                         }
+                       ;
                         
 class_refs             : class_ref
                           {
@@ -827,6 +849,7 @@
                           {
                                 
codegen.CurrentCustomAttrTarget.AddCustomAttribute ((CustomAttr) $1);
                           }
+                       | param_type_decl
                        | D_SIZE int32
                           {
                                 codegen.CurrentTypeDef.SetSize ((int) $2);
@@ -2043,6 +2066,7 @@
                                 codegen.CurrentMethodDef.AddParamDefaultValue 
((int)$3 - 1, (Constant)$5);
                                 codegen.CurrentCustomAttrTarget = 
codegen.CurrentMethodDef.GetParam ((int)$3 - 1);
                           }
+                       | param_type_decl
                        | id COLON
                           {
                                 codegen.CurrentMethodDef.AddLabel ((string) 
$1);

Modified: branches/mono-1-1-13/mcs/ilasm/scanner/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/scanner/ChangeLog    2006-01-19 13:13:36 UTC 
(rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/scanner/ChangeLog    2006-01-19 13:20:16 UTC 
(rev 55779)
@@ -1,3 +1,7 @@
+2006-01-19  Ankit Jain  <[EMAIL PROTECTED]>
+
+       * ILTables.cs (keywords): Add 'type' keyword.
+
 2006-01-16  Ankit Jain  <[EMAIL PROTECTED]>
 
        * NumberHelper.cs (NumberHelper.Build): Try parsing numeric value as 
UInt64 or 

Modified: branches/mono-1-1-13/mcs/ilasm/scanner/ILTables.cs
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/scanner/ILTables.cs  2006-01-19 13:13:36 UTC 
(rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/scanner/ILTables.cs  2006-01-19 13:20:16 UTC 
(rev 55779)
@@ -258,6 +258,7 @@
                                 keywords ["modreq"] = new ILToken 
(Token.K_MODREQ, "modreq");
                                 keywords ["modopt"] = new ILToken 
(Token.K_MODOPT, "modopt");
                                 keywords ["typedref"] = new ILToken 
(Token.K_TYPEDREF, "typedref");
+                                keywords ["type"] = new ILToken (Token.K_TYPE, 
"type");
                                 keywords ["refany"] = new ILToken 
(Token.K_TYPEDREF, "typedref");
                                 keywords ["wchar"] = new ILToken 
(Token.K_WCHAR, "wchar");
                                 keywords ["char"] = new ILToken (Token.K_CHAR, 
"char");

Modified: branches/mono-1-1-13/mcs/ilasm/tests/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/tests/ChangeLog      2006-01-19 13:13:36 UTC 
(rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/tests/ChangeLog      2006-01-19 13:20:16 UTC 
(rev 55779)
@@ -1,3 +1,10 @@
+2006-01-19  Ankit Jain  <[EMAIL PROTECTED]>
+
+       * err-gen-cattr-1.il: New.
+       * err-gen-cattr-2.il: New.
+       * err-gen-cattr-3.il: New.
+       * err-gen-cattr-4.il: New.
+
 2006-01-16  Ankit Jain  <[EMAIL PROTECTED]>
 
        * test-int64.il: New. Test for large numeric values.

Added: branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-1.il
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-1.il     2006-01-19 
13:13:36 UTC (rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-1.il     2006-01-19 
13:20:16 UTC (rev 55779)
@@ -0,0 +1,45 @@
+// Test for custom attributes on a 'undefined' type parameter name
+
+.assembly extern mscorlib
+{
+}
+.assembly 'err-gen-cattr-1'
+{
+  .custom instance void 
[mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32)
 = ( 01 00 08 00 00 00 00 00 ) 
+  .hash algorithm 0x00008004
+  .ver 0:0:0:0
+}
+.module 'err-gen-cattr-1.exe'
+
+.class private auto ansi beforefieldinit GenParAttribute
+       extends [mscorlib]System.Attribute
+{
+ .custom instance void 
[mscorlib]System.AttributeUsageAttribute::.ctor(valuetype 
[mscorlib]System.AttributeTargets) = ( 01 00 00 40 00 00 00 00 )
+  .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    .maxstack  8
+    IL_0000:  ldarg.0
+    IL_0001:  call       instance void [mscorlib]System.Attribute::.ctor()
+    IL_0006:  ret
+  }
+
+}
+
+.class private auto ansi beforefieldinit cons`1<A>
+       extends [mscorlib]System.Object
+{
+  .param type M
+  .custom instance void GenParAttribute::.ctor() = ( 01 00 00 00 ) 
+
+ .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    .maxstack  8
+    IL_0000:  ldarg.0
+    IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
+    IL_0006:  ret
+  }
+
+}
+

Added: branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-2.il
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-2.il     2006-01-19 
13:13:36 UTC (rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-2.il     2006-01-19 
13:20:16 UTC (rev 55779)
@@ -0,0 +1,53 @@
+// Test for custom attributes on a 'undefined' method type parameter
+
+.assembly extern mscorlib
+{
+}
+.assembly 'err-gen-cattr-2'
+{
+  .custom instance void 
[mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32)
 = ( 01 00 08 00 00 00 00 00 ) 
+  .hash algorithm 0x00008004
+  .ver 0:0:0:0
+}
+.module 'err-gen-cattr-2.exe'
+
+.class private auto ansi beforefieldinit GenParAttribute
+       extends [mscorlib]System.Attribute
+{
+ .custom instance void 
[mscorlib]System.AttributeUsageAttribute::.ctor(valuetype 
[mscorlib]System.AttributeTargets) = ( 01 00 00 40 00 00 00 00 )
+  .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    .maxstack  8
+    IL_0000:  ldarg.0
+    IL_0001:  call       instance void [mscorlib]System.Attribute::.ctor()
+    IL_0006:  ret
+  }
+
+}
+
+.class private auto ansi beforefieldinit cons`1<A>
+       extends [mscorlib]System.Object
+{
+  .method public hidebysig instance void 
+          abc<M>() cil managed
+  {
+    .param type A
+    .custom instance void GenParAttribute::.ctor() = ( 01 00 00 00 ) 
+
+    .maxstack  8
+    IL_0000:  nop
+    IL_0001:  ret
+  }
+
+  .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    .maxstack  8
+    IL_0000:  ldarg.0
+    IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
+    IL_0006:  ret
+  }
+
+}
+

Added: branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-3.il
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-3.il     2006-01-19 
13:13:36 UTC (rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-3.il     2006-01-19 
13:20:16 UTC (rev 55779)
@@ -0,0 +1,46 @@
+// Test for custom attributes on a 'undefined' type parameter index
+
+.assembly extern mscorlib
+{
+}
+.assembly 'err-gen-cattr-3'
+{
+  .custom instance void 
[mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32)
 = ( 01 00 08 00 00 00 00 00 ) 
+  .hash algorithm 0x00008004
+  .ver 0:0:0:0
+}
+.module 'err-gen-cattr-3.exe'
+
+.class private auto ansi beforefieldinit GenParAttribute
+       extends [mscorlib]System.Attribute
+{
+  .custom instance void 
[mscorlib]System.AttributeUsageAttribute::.ctor(valuetype 
[mscorlib]System.AttributeTargets) = ( 01 00 00 40 00 00 00 00 )
+  .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    .maxstack  8
+    IL_0000:  ldarg.0
+    IL_0001:  call       instance void [mscorlib]System.Attribute::.ctor()
+    IL_0006:  ret
+  }
+
+}
+
+.class private auto ansi beforefieldinit cons`1<A>
+       extends [mscorlib]System.Object
+{
+  /* Type parameter index is 1-based */          
+  .param type [2]
+  .custom instance void GenParAttribute::.ctor() = ( 01 00 00 00 ) 
+
+ .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    .maxstack  8
+    IL_0000:  ldarg.0
+    IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
+    IL_0006:  ret
+  }
+
+}
+

Added: branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-4.il
===================================================================
--- branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-4.il     2006-01-19 
13:13:36 UTC (rev 55778)
+++ branches/mono-1-1-13/mcs/ilasm/tests/err-gen-cattr-4.il     2006-01-19 
13:20:16 UTC (rev 55779)
@@ -0,0 +1,53 @@
+// Test for custom attributes on a 'undefined' method type parameter index
+
+.assembly extern mscorlib
+{
+}
+.assembly 'err-gen-cattr-4'
+{
+  .custom instance void 
[mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32)
 = ( 01 00 08 00 00 00 00 00 ) 
+  .hash algorithm 0x00008004
+  .ver 0:0:0:0
+}
+.module 'err-gen-cattr-4.exe'
+
+.class private auto ansi beforefieldinit GenParAttribute
+       extends [mscorlib]System.Attribute
+{
+  .custom instance void 
[mscorlib]System.AttributeUsageAttribute::.ctor(valuetype 
[mscorlib]System.AttributeTargets) = ( 01 00 00 40 00 00 00 00 )
+  .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    .maxstack  8
+    IL_0000:  ldarg.0
+    IL_0001:  call       instance void [mscorlib]System.Attribute::.ctor()
+    IL_0006:  ret
+  }
+
+}
+
+.class private auto ansi beforefieldinit cons`1<A>
+       extends [mscorlib]System.Object
+{
+  .method public hidebysig instance void 
+          abc<M>() cil managed
+  {
+    /* Type parameter index is 1-based */        
+    .param type [0]
+    .custom instance void GenParAttribute::.ctor() = ( 01 00 00 00 ) 
+
+    .maxstack  8
+    IL_0000:  nop
+    IL_0001:  ret
+  }
+
+  .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    .maxstack  8
+    IL_0000:  ldarg.0
+    IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
+    IL_0006:  ret
+  }
+
+}

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to