* ILParser.jay: Create generic method refs.
authorJackson Harper <jackson@novell.com>
Sat, 11 Oct 2003 08:57:47 +0000 (08:57 -0000)
committerJackson Harper <jackson@novell.com>
Sat, 11 Oct 2003 08:57:47 +0000 (08:57 -0000)
svn path=/trunk/mcs/; revision=18875

mcs/ilasm/parser/ChangeLog
mcs/ilasm/parser/ILParser.jay

index c429ef179eeb9bc84aacec795847f652bc824896..eab3387adb044eeef9c102ddbeef2997897a4b05 100644 (file)
@@ -1,3 +1,7 @@
+2003-10-10 Jackson Harper <jackson@ximian.com>
+
+       * ILParser.jay: Create generic method refs.
+       
 2003-10-08 Jackson Harper <jackson@ximian.com>
 
        * ILParser.jay: Attach generic type parameters to methods.
index acd09867441a43a6d0897cdc3dbddd35d293f7bd..85d44f967e753cae558e788393591b4f64dc598e 100644 (file)
@@ -808,7 +808,8 @@ type                        : K_CLASS class_ref
                           }\r
                         | BANG BANG int32\r
                           {\r
-                                // access method type parameter by number\r
+                                MVar mvar = new MVar ((int) $3);\r
+                                $$ = new GenericTypeRef (mvar, $3.ToString ());\r
                           }\r
                         | K_CLASS slashed_name OPEN_ANGLE_BRACKET BANG int32 CLOSE_ANGLE_BRACKET\r
                           {\r
@@ -1975,25 +1976,28 @@ instr                   : INSTR_NONE
                           }\r
                        ;\r
 \r
-method_ref             : call_conv type type_spec DOUBLE_COLON method_name \r
-                         OPEN_PARENS type_list CLOSE_PARENS\r
+method_ref             : call_conv type type_spec DOUBLE_COLON method_name\r
+                          OPEN_PARENS type_list CLOSE_PARENS \r
                           {\r
                                 ITypeRef owner = (ITypeRef) $3;\r
                                 ArrayList arg_list = (ArrayList) $7;\r
                                 ITypeRef[] param_list;\r
-  \r
+                                IMethodRef methref;\r
+\r
                                 if (arg_list != null)\r
                                         param_list = (ITypeRef[]) arg_list.ToArray (typeof (ITypeRef));\r
                                 else\r
                                         param_list = new ITypeRef[0];\r
 \r
                                 if (owner.UseTypeSpec) {\r
-                                        $$ = new TypeSpecMethodRef (owner, (ITypeRef) $2,\r
+                                        methref = new TypeSpecMethodRef (owner, (ITypeRef) $2,\r
                                                 (CallConv) $1, (string) $5, param_list);\r
                                 } else {\r
-                                        $$ = owner.GetMethodRef ((ITypeRef) $2,\r
+                                        methref = owner.GetMethodRef ((ITypeRef) $2,\r
                                                 (CallConv) $1, (string) $5, param_list);\r
                                 }\r
+\r
+                                $$ = methref;\r
                           }\r
                        | call_conv type method_name \r
                          OPEN_PARENS type_list CLOSE_PARENS\r
@@ -2009,6 +2013,36 @@ method_ref               : call_conv type type_spec DOUBLE_COLON method_name
                                 $$ = new GlobalMethodRef ((ITypeRef) $2, (CallConv) $1,\r
                                         (string) $3, param_list);\r
                           }\r
+                        | call_conv type type_spec DOUBLE_COLON method_name\r
+                          typars_clause OPEN_PARENS type_list CLOSE_PARENS \r
+                          {\r
+                                ITypeRef owner = (ITypeRef) $3;\r
+                                ArrayList arg_list = (ArrayList) $8;\r
+                                ITypeRef[] param_list;\r
+                                IMethodRef methref;\r
+\r
+                                if (arg_list != null)\r
+                                        param_list = (ITypeRef[]) arg_list.ToArray (typeof (ITypeRef));\r
+                                else\r
+                                        param_list = new ITypeRef[0];\r
+\r
+                                if (owner.UseTypeSpec) {\r
+                                        methref = new TypeSpecMethodRef (owner, (ITypeRef) $2,\r
+                                                (CallConv) $1, (string) $5, param_list);\r
+                                } else {\r
+                                        methref = owner.GetMethodRef ((ITypeRef) $2,\r
+                                                (CallConv) $1, (string) $5, param_list);\r
+                                }\r
+\r
+                                if ($6 != null) {\r
+                                        ArrayList tp = (ArrayList) $6;\r
+                                        ITypeRef[] ta = (ITypeRef[]) tp.ToArray (typeof (ITypeRef));\r
+                                        \r
+                                        methref = new GenericMethodRef (methref, new GenericMethodSig (ta));\r
+                                }\r
+                                Console.WriteLine ("methodref:  {0}", methref);\r
+                                $$ = methref;\r
+                          }\r
                        ;\r
 \r
 labels                 : /* EMPTY */\r