Author: marek
Date: 2007-10-11 06:22:57 -0400 (Thu, 11 Oct 2007)
New Revision: 87327

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/cs-parser.jay
   trunk/mcs/gmcs/linq.cs
Log:
2007-10-11  Marek Safar  <[EMAIL PROTECTED]>
        
        * cs-parser.jay: Added couple of ISO-2 checks.
        
        * linq.cs: Report range variable error message.
        


Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2007-10-11 10:10:05 UTC (rev 87326)
+++ trunk/mcs/gmcs/ChangeLog    2007-10-11 10:22:57 UTC (rev 87327)
@@ -1,3 +1,9 @@
+2007-10-11  Marek Safar  <[EMAIL PROTECTED]>
+       
+       * cs-parser.jay: Added couple of ISO-2 checks.
+       
+       * linq.cs: Report range variable error message.
+       
 2007-10-09  Marek Safar  <[EMAIL PROTECTED]>
        
        * cs-parser.jay: Added extension methods ISO-2 check.

Modified: trunk/mcs/gmcs/cs-parser.jay
===================================================================
--- trunk/mcs/gmcs/cs-parser.jay        2007-10-11 10:10:05 UTC (rev 87326)
+++ trunk/mcs/gmcs/cs-parser.jay        2007-10-11 10:22:57 UTC (rev 87327)
@@ -3450,24 +3450,20 @@
        : NEW type OPEN_PARENS opt_argument_list CLOSE_PARENS 
opt_object_or_collection_initializer
          {
                if ($6 != null) {
-                       if (RootContext.Version < LanguageVersion.LINQ) {
-                               Error_ExpectingTypeName ((Expression) $2);
-                               $$ = null;
-                       }
-                       else
-                               $$ = new NewInitialize ((Expression) $2, 
(ArrayList) $4, (CollectionOrObjectInitializers) $6, (Location) $1);
+                       if (RootContext.Version <= LanguageVersion.ISO_2)
+                               Report.FeatureIsNotISO1 (GetLocation ($1), 
"object initializers");
+                               
+                       $$ = new NewInitialize ((Expression) $2, (ArrayList) 
$4, (CollectionOrObjectInitializers) $6, (Location) $1);
                }
                else
                        $$ = new New ((Expression) $2, (ArrayList) $4, 
(Location) $1);
          }
        | NEW type object_or_collection_initializer
          {
-               if (RootContext.Version < LanguageVersion.LINQ) {
-                       Report.Error (1526, (Location) $1, "A new expression 
requires () or [] after type");
-                       $$ = null;
-               }
-               else
-                       $$ = new NewInitialize ((Expression) $2, null, 
(CollectionOrObjectInitializers) $3, (Location) $1);
+               if (RootContext.Version <= LanguageVersion.ISO_2)
+                       Report.FeatureIsNotISO1 (GetLocation ($1), "collection 
initializers");
+         
+               $$ = new NewInitialize ((Expression) $2, null, 
(CollectionOrObjectInitializers) $3, (Location) $1);
          }
        ;
 
@@ -3484,12 +3480,7 @@
          }
        | NEW rank_specifiers array_initializer
          {
-               if (RootContext.Version < LanguageVersion.LINQ) {
-                       Report.Error (1031, (Location) $1, "Type expected");
-                       $$ = null;
-               }
-               else
-                       $$ = new ImplicitlyTypedArrayCreation ((string) $2, 
(ArrayList) $3, (Location) $1);
+               $$ = new ImplicitlyTypedArrayCreation ((string) $2, (ArrayList) 
$3, (Location) $1);
          }
        | NEW error
          {
@@ -3506,12 +3497,10 @@
 anonymous_type_expression
        : NEW OPEN_BRACE anonymous_type_parameters CLOSE_BRACE
          {
-               if (RootContext.Version < LanguageVersion.LINQ) {
-                       Report.Error (1031, (Location) $1, "Type expected");
-                       $$ = null;
-               }
-               else
-                       $$ = new AnonymousTypeDeclaration ((ArrayList) $3, 
current_container, lexer.Location);
+               if (RootContext.Version <= LanguageVersion.ISO_2)
+                       Report.FeatureIsNotISO1 (GetLocation ($1), "anonymous 
types");
+
+               $$ = new AnonymousTypeDeclaration ((ArrayList) $3, 
current_container, GetLocation ($1));
          }
        ;
 

Modified: trunk/mcs/gmcs/linq.cs
===================================================================
--- trunk/mcs/gmcs/linq.cs      2007-10-11 10:10:05 UTC (rev 87326)
+++ trunk/mcs/gmcs/linq.cs      2007-10-11 10:22:57 UTC (rev 87327)
@@ -482,6 +482,12 @@
 
                                return e;
                        }
+                       
+                       protected override void Error_InvalidInitializer 
(Expression initializer)
+                       {
+                               Report.Error (1932, loc, "A range variable 
`{0}' cannot be initialized with `{1}'",
+                                       Name, initializer.GetSignatureForError 
());
+                       }                       
                }
 
                public Let (LocatedToken variable, Expression expr, Location 
loc)

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

Reply via email to