Author: martin
Date: 2005-03-22 05:26:40 -0500 (Tue, 22 Mar 2005)
New Revision: 42086

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/anonymous.cs
   trunk/mcs/gmcs/class.cs
   trunk/mcs/gmcs/cs-parser.jay
   trunk/mcs/gmcs/cs-tokenizer.cs
   trunk/mcs/gmcs/delegate.cs
   trunk/mcs/gmcs/support.cs
Log:
**** Merged r41091-41093 from MCS ****


Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2005-03-22 10:22:36 UTC (rev 42085)
+++ trunk/mcs/gmcs/ChangeLog    2005-03-22 10:26:40 UTC (rev 42086)
@@ -1,3 +1,18 @@
+2005-02-23  Marek Safar  <[EMAIL PROTECTED]>
+
+       * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
+       CS1677 for out and ref as well.
+
+       * class.cs (Method.Define): Add error CS1599 detection.
+       
+       * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
+       
+       * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
+       
+       * delegate.cs (Delegate.Define): Add error CS1599 detection.
+       
+       * support.cs.cs (ModifierDesc): New helper method.
+
 2005-02-23  Raja R Harinath  <[EMAIL PROTECTED]>
            Abin Thomas  <[EMAIL PROTECTED]>
            Anoob V E  <[EMAIL PROTECTED]>

Modified: trunk/mcs/gmcs/anonymous.cs
===================================================================
--- trunk/mcs/gmcs/anonymous.cs 2005-03-22 10:22:36 UTC (rev 42085)
+++ trunk/mcs/gmcs/anonymous.cs 2005-03-22 10:26:40 UTC (rev 42086)
@@ -168,15 +168,8 @@
                        invoke_mb = (MethodInfo) invoke_mg.Methods [0];
                        ParameterData invoke_pd = TypeManager.GetParameterData 
(invoke_mb);
 
-                       //
-                       // If implicit parameters are set, then we must check 
for out in the parameters
-                       // and flag it accordingly.
-                       //
-                       bool out_invalid_check = false;
-                       
                        if (Parameters == null){
                                int i, j;
-                               out_invalid_check = true;
                                
                                //
                                // We provide a set of inaccessible parameters
@@ -226,6 +219,16 @@
                        
                        for (int i = 0; i < amp.Count; i++){
                                Parameter.Modifier amp_mod = 
amp.ParameterModifier (i);
+
+                               if ((amp_mod & (Parameter.Modifier.OUT | 
Parameter.Modifier.REF)) != 0){
+                                       if (!probe){
+                                               Error_ParameterMismatch 
(delegate_type);
+                                               Report.Error (1677, loc, 
"Parameter '{0}' should not be declared with the '{1}' keyword", 
+                                                       i+1, amp.ModifierDesc 
(i));
+                                       }
+                                       return null;
+                               }
+
                                if (amp_mod != invoke_pd.ParameterModifier (i)){
                                        if (!probe){
                                                Report.Error (1676, loc, 
@@ -245,14 +248,6 @@
                                        }
                                        return null;
                                }
-                               
-                               if (out_invalid_check && 
(invoke_pd.ParameterModifier (i) & Parameter.Modifier.OUT) != 0){
-                                       if (!probe){
-                                               Report.Error (1676, 
loc,"Parameter {0} must include the `out' modifier ", i+1);
-                                               Error_ParameterMismatch 
(delegate_type);
-                                       }
-                                       return null;
-                               }
                        }
 
                        //

Modified: trunk/mcs/gmcs/class.cs
===================================================================
--- trunk/mcs/gmcs/class.cs     2005-03-22 10:22:36 UTC (rev 42085)
+++ trunk/mcs/gmcs/class.cs     2005-03-22 10:26:40 UTC (rev 42086)
@@ -4067,6 +4067,11 @@
                        if (!DoDefine (ds))
                                return false;
 
+                       if (RootContext.StdLib && (ReturnType == 
TypeManager.arg_iterator_type || ReturnType == 
TypeManager.typed_reference_type)) {
+                               Error1599 (Location, ReturnType);
+                               return false;
+                       }
+
                        if (!CheckBase ())
                                return false;
 
@@ -4147,6 +4152,11 @@
                        MethodData = null;
                }
 
+               public static void Error1599 (Location loc, Type t)
+               {
+                       Report.Error (1599, loc, "Method or delegate cannot 
return type '{0}'", TypeManager.CSharpName (t));
+               }
+
                protected override MethodInfo FindOutBaseMethod (TypeContainer 
container, ref Type base_ret_type)
                {
                        MethodInfo mi = (MethodInfo) 
container.BaseCache.FindMemberToOverride (

Modified: trunk/mcs/gmcs/cs-parser.jay
===================================================================
--- trunk/mcs/gmcs/cs-parser.jay        2005-03-22 10:22:36 UTC (rev 42085)
+++ trunk/mcs/gmcs/cs-parser.jay        2005-03-22 10:26:40 UTC (rev 42086)
@@ -2182,6 +2182,10 @@
                Report.Error (73, lexer.Location, "Add or remove accessor must 
have a body");
                $$ = null;
          }
+       | opt_attributes modifiers ADD {
+               Report.Error (1609, lexer.Location, "Modifiers cannot be placed 
on event accessor declarations");
+               $$ = null;
+         }
        ;
 
 remove_accessor_declaration
@@ -2206,6 +2210,10 @@
                Report.Error (73, lexer.Location, "Add or remove accessor must 
have a body");
                $$ = null;
          }
+       | opt_attributes modifiers REMOVE {
+               Report.Error (1609, lexer.Location, "Modifiers cannot be placed 
on event accessor declarations");
+               $$ = null;
+         }
        ;
 
 indexer_declaration
@@ -3226,7 +3234,7 @@
                $$ = new Parameter ((Expression) $2, (string) $3, 
(Parameter.Modifier) $1, null);
          }
        | PARAMS type IDENTIFIER {
-               Report.Error (-221, lexer.Location, "params modifier not 
allowed in anonymous method declaration");
+               Report.Error (1670, lexer.Location, "params modifier not 
allowed in anonymous method declaration");
                $$ = null;
          }
        ;
@@ -4413,6 +4421,11 @@
                        $$ = new Yield ((Expression) $3, lexer.Location); 
                }
          }
+       | IDENTIFIER RETURN SEMICOLON
+       {
+               Report.Error (1627, lexer.Location, "Expression expected after 
yield return");
+               $$ = null;
+       }
        | IDENTIFIER BREAK SEMICOLON
          {
                string s = (string) $1;

Modified: trunk/mcs/gmcs/cs-tokenizer.cs
===================================================================
--- trunk/mcs/gmcs/cs-tokenizer.cs      2005-03-22 10:22:36 UTC (rev 42085)
+++ trunk/mcs/gmcs/cs-tokenizer.cs      2005-03-22 10:26:40 UTC (rev 42086)
@@ -2301,7 +2301,7 @@
                                } else if (is_identifier_start_character 
((char) c)){
                                        return consume_identifier (c, true);
                                } else {
-                                       Report.Error (1033, Location, "'@' must 
be followed by string constant or identifier");
+                                       Report.Error (1646, Location, "Keyword, 
identifier, or string expected after verbatim specifier: @");
                                }
                        }
 

Modified: trunk/mcs/gmcs/delegate.cs
===================================================================
--- trunk/mcs/gmcs/delegate.cs  2005-03-22 10:22:36 UTC (rev 42085)
+++ trunk/mcs/gmcs/delegate.cs  2005-03-22 10:26:40 UTC (rev 42086)
@@ -252,6 +252,11 @@
                        if (ret_type.IsPointer && !UnsafeOK (Parent))
                                return false;
 
+                       if (RootContext.StdLib && (ret_type == 
TypeManager.arg_iterator_type || ret_type == TypeManager.typed_reference_type)) 
{
+                               Method.Error1599 (Location, ret_type);
+                               return false;
+                       }
+
                        //
                        // We don't have to check any others because they are 
all
                        // guaranteed to be accessible - they are standard 
types.

Modified: trunk/mcs/gmcs/support.cs
===================================================================
--- trunk/mcs/gmcs/support.cs   2005-03-22 10:22:36 UTC (rev 42085)
+++ trunk/mcs/gmcs/support.cs   2005-03-22 10:26:40 UTC (rev 42086)
@@ -252,7 +252,12 @@
                        if (has_varargs && pos >= count)
                                return "__arglist";
 
-                       string tmp = String.Empty;
+                       Type t = ParameterType (pos);
+                       return ModifierDesc (pos) + " " + 
TypeManager.CSharpName (t);
+               }
+
+               public string ModifierDesc (int pos)
+               {
                        Parameter p = GetParameter (pos);
 
                        //
@@ -260,15 +265,13 @@
                        // extra flag ISBYREF will be set as well
                        //
                        if ((p.ModFlags & Parameter.Modifier.REF) != 0)
-                               tmp = "ref ";
-                       else if ((p.ModFlags & Parameter.Modifier.OUT) != 0)
-                               tmp = "out ";
-                       else if (p.ModFlags == Parameter.Modifier.PARAMS)
-                               tmp = "params ";
+                               return "ref";
+                       if ((p.ModFlags & Parameter.Modifier.OUT) != 0)
+                               return "out";
+                       if (p.ModFlags == Parameter.Modifier.PARAMS)
+                               return "params";
 
-                       Type t = ParameterType (pos);
-
-                       return tmp + TypeManager.CSharpName (t);
+                       return "";
                }
 
                public Parameter.Modifier ParameterModifier (int pos)

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

Reply via email to