Author: raja
Date: 2007-05-25 10:51:06 -0400 (Fri, 25 May 2007)
New Revision: 77947

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/cs-parser.jay
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/cs-parser.jay
Log:
* mcs/cs-parser.jay: Use 'start_block' and 'end_block' rather than
modifying current_block directly.
* gmcs/cs-parser.jay: Likewise.


Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2007-05-25 13:34:32 UTC (rev 77946)
+++ trunk/mcs/gmcs/ChangeLog    2007-05-25 14:51:06 UTC (rev 77947)
@@ -1,3 +1,8 @@
+2007-05-25  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * cs-parser.jay: Use 'start_block' and 'end_block' rather than
+       modifying current_block directly.
+
 2007-05-22  Scott Peterson  <[EMAIL PROTECTED]>
        
        * cs-parser.jay: Implemented automatic properties (C# 3.0)

Modified: trunk/mcs/gmcs/cs-parser.jay
===================================================================
--- trunk/mcs/gmcs/cs-parser.jay        2007-05-25 13:34:32 UTC (rev 77946)
+++ trunk/mcs/gmcs/cs-parser.jay        2007-05-25 14:51:06 UTC (rev 77947)
@@ -4818,8 +4818,9 @@
        : FOR open_parens 
          opt_for_initializer SEMICOLON
          {
-               Block assign_block = new Block (current_block);
-               current_block = assign_block;
+               Location l = lexer.Location;
+               start_block (l);  
+               Block assign_block = current_block;
 
                if ($3 is DictionaryEntry){
                        DictionaryEntry de = (DictionaryEntry) $3;
@@ -4835,7 +4836,6 @@
                                if (vi == null)
                                        continue;
 
-                               Location l = lexer.Location;
                                Expression expr = 
decl.expression_or_array_initializer;
                                        
                                LocalVariableReference var;
@@ -4864,10 +4864,8 @@
                For f = new For ((Statement) $5, (Expression) $6, (Statement) 
$8, (Statement) $10, l);
 
                current_block.AddStatement (f);
-               while (current_block.Implicit)
-                       current_block = current_block.Parent;
-               $$ = current_block;
-               current_block = current_block.Parent;
+
+               $$ = end_block (lexer.Location);
          }
        ;
 
@@ -4923,8 +4921,8 @@
        | FOREACH open_parens type IDENTIFIER IN
          expression CLOSE_PARENS 
          {
-               Block foreach_block = new Block (current_block);
-               current_block = foreach_block;
+               start_block (lexer.Location);
+               Block foreach_block = current_block;
 
                LocatedToken lt = (LocatedToken) $4;
                Location l = lt.Location;
@@ -4953,10 +4951,7 @@
                        current_block.AddStatement (f);
                }
 
-               while (current_block.Implicit)
-                         current_block = current_block.Parent;
-               $$ = current_block;
-               current_block = current_block.Parent;
+               $$ = end_block (lexer.Location);
          }
        ;
 
@@ -5154,9 +5149,8 @@
 
                                one.Add (new VariableDeclaration (lt, null));
 
-                               current_block = new Block (current_block);
-                               Block b = declare_local_variables (type, one, 
lt.Location);
-                               current_block = b;
+                               start_block (lexer.Location);
+                               current_block = declare_local_variables (type, 
one, lt.Location);
                        }
                }
          } block {
@@ -5171,10 +5165,7 @@
 
                        if (lt != null){
                                id = lt.Value;
-                               while (current_block.Implicit)
-                                       current_block = current_block.Parent;
-                               var_block = current_block;
-                               current_block = current_block.Parent;
+                               var_block = end_block (lexer.Location);
                        }
                }
 
@@ -5228,8 +5219,8 @@
                Location l = (Location) $1;
                int top = list.Count;
 
-               Block assign_block = new Block (current_block);
-               current_block = assign_block;
+               start_block (lexer.Location);
+               Block assign_block = current_block;
 
                for (int i = 0; i < top; i++){
                        Pair p = (Pair) list [i];
@@ -5255,10 +5246,8 @@
                Fixed f = new Fixed ((Expression) $3, (ArrayList) $4, 
(Statement) $7, l);
 
                current_block.AddStatement (f);
-               while (current_block.Implicit)
-                       current_block = current_block.Parent;
-               $$ = current_block;
-               current_block = current_block.Parent;
+
+               $$ = end_block (lexer.Location);
          }
        ;
 
@@ -5306,8 +5295,8 @@
 using_statement
        : USING open_parens resource_acquisition CLOSE_PARENS
          {
-               Block assign_block = new Block (current_block);
-               current_block = assign_block;
+               start_block (lexer.Location);
+               Block assign_block = current_block;
 
                if ($3 is DictionaryEntry){
                        DictionaryEntry de = (DictionaryEntry) $3;
@@ -5355,10 +5344,7 @@
          {
                Using u = new Using ($5, (Statement) $6, (Location) $1);
                current_block.AddStatement (u);
-               while (current_block.Implicit)
-                       current_block = current_block.Parent;
-               $$ = current_block;
-               current_block = current_block.Parent;
+               $$ = end_block (lexer.Location);
          }
        ; 
 
@@ -5375,14 +5361,14 @@
          {
                lexer.QueryParsing = false;
                $$ = new QueryExpression ((Expression)$1, (Expression)$2);
-               current_block = current_block.Parent;
+               end_block (lexer.Location);
          }
        ;
        
 from_clause
        : FROM IDENTIFIER IN expression opt_join_clauses
          {
-               current_block = new Block (current_block);
+               start_block (lexer.Location);
                LocatedToken lt = (LocatedToken) $2;
                
                LocalInfo vi = current_block.AddVariable 
(TypeManager.system_object_expr, lt.Value, lt.Location);  // TODO: null is var 
type
@@ -5393,7 +5379,7 @@
          }
        | FROM type IDENTIFIER IN expression opt_join_clauses
          {
-               current_block = new Block (current_block);
+               start_block (lexer.Location);
                LocatedToken lt = (LocatedToken) $3;
 
                LocalInfo vi = current_block.AddVariable ((Expression)$2, 
lt.Value, lt.Location);

Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2007-05-25 13:34:32 UTC (rev 77946)
+++ trunk/mcs/mcs/ChangeLog     2007-05-25 14:51:06 UTC (rev 77947)
@@ -1,3 +1,8 @@
+2007-05-25  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * cs-parser.jay: Use 'start_block' and 'end_block' rather than
+       modifying current_block directly.
+
 2007-05-23  Scott Peterson  <[EMAIL PROTECTED]>
        
        * class.cs: Implemented automatic properties (C# 3.0)

Modified: trunk/mcs/mcs/cs-parser.jay
===================================================================
--- trunk/mcs/mcs/cs-parser.jay 2007-05-25 13:34:32 UTC (rev 77946)
+++ trunk/mcs/mcs/cs-parser.jay 2007-05-25 14:51:06 UTC (rev 77947)
@@ -4217,8 +4217,9 @@
        : FOR open_parens 
          opt_for_initializer SEMICOLON
          {
-               Block assign_block = new Block (current_block);
-               current_block = assign_block;
+               Location l = lexer.Location;
+               start_block (l);  
+               Block assign_block = current_block;
 
                if ($3 is DictionaryEntry){
                        DictionaryEntry de = (DictionaryEntry) $3;
@@ -4234,7 +4235,6 @@
                                if (vi == null)
                                        continue;
 
-                               Location l = lexer.Location;
                                Expression expr = 
decl.expression_or_array_initializer;
                                        
                                LocalVariableReference var;
@@ -4263,10 +4263,8 @@
                For f = new For ((Statement) $5, (Expression) $6, (Statement) 
$8, (Statement) $10, l);
 
                current_block.AddStatement (f);
-               while (current_block.Implicit)
-                       current_block = current_block.Parent;
-               $$ = current_block;
-               current_block = current_block.Parent;
+
+               $$ = end_block (lexer.Location);
          }
        ;
 
@@ -4322,8 +4320,8 @@
        | FOREACH open_parens type IDENTIFIER IN
          expression CLOSE_PARENS 
          {
-               Block foreach_block = new Block (current_block);
-               current_block = foreach_block;
+               start_block (lexer.Location);
+               Block foreach_block = current_block;
 
                LocatedToken lt = (LocatedToken) $4;
                Location l = lt.Location;
@@ -4352,10 +4350,7 @@
                        current_block.AddStatement (f);
                }
 
-               while (current_block.Implicit)
-                         current_block = current_block.Parent;
-               $$ = current_block;
-               current_block = current_block.Parent;
+               $$ = end_block (lexer.Location);
          }
        ;
 
@@ -4553,9 +4548,8 @@
 
                                one.Add (new VariableDeclaration (lt, null));
 
-                               current_block = new Block (current_block);
-                               Block b = declare_local_variables (type, one, 
lt.Location);
-                               current_block = b;
+                               start_block (lexer.Location);
+                               current_block = declare_local_variables (type, 
one, lt.Location);
                        }
                }
          } block {
@@ -4570,10 +4564,7 @@
 
                        if (lt != null){
                                id = lt.Value;
-                               while (current_block.Implicit)
-                                       current_block = current_block.Parent;
-                               var_block = current_block;
-                               current_block = current_block.Parent;
+                               var_block = end_block (lexer.Location);
                        }
                }
 
@@ -4627,8 +4618,8 @@
                Location l = (Location) $1;
                int top = list.Count;
 
-               Block assign_block = new Block (current_block);
-               current_block = assign_block;
+               start_block (lexer.Location);
+               Block assign_block = current_block;
 
                for (int i = 0; i < top; i++){
                        Pair p = (Pair) list [i];
@@ -4651,10 +4642,8 @@
                Fixed f = new Fixed ((Expression) $3, (ArrayList) $4, 
(Statement) $7, l);
 
                current_block.AddStatement (f);
-               while (current_block.Implicit)
-                       current_block = current_block.Parent;
-               $$ = current_block;
-               current_block = current_block.Parent;
+
+               $$ = end_block (lexer.Location);
          }
        ;
 
@@ -4702,8 +4691,8 @@
 using_statement
        : USING open_parens resource_acquisition CLOSE_PARENS
          {
-               Block assign_block = new Block (current_block);
-               current_block = assign_block;
+               start_block (lexer.Location);
+               Block assign_block = current_block;
 
                if ($3 is DictionaryEntry){
                        DictionaryEntry de = (DictionaryEntry) $3;
@@ -4751,10 +4740,7 @@
          {
                Using u = new Using ($5, (Statement) $6, (Location) $1);
                current_block.AddStatement (u);
-               while (current_block.Implicit)
-                       current_block = current_block.Parent;
-               $$ = current_block;
-               current_block = current_block.Parent;
+               $$ = end_block (lexer.Location);
          }
        ; 
 

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

Reply via email to