Author: raja
Date: 2007-05-27 08:59:18 -0400 (Sun, 27 May 2007)
New Revision: 78004

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/cs-parser.jay
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/cs-parser.jay
   trunk/mcs/mcs/statement.cs
Log:
Introduce ExplicitBlock

* mcs/statement.cs (ExplicitBlock): New.
(ToplevelBlock): Derive from it.
(Block.Flags.IsExplicit): Rename from '...Implicit' and invert sense of flag.
(Block.Implicit): Update to changes.
* mcs/cs-parser.jay, gmcs/cs-parser.jay: Update to changes.


Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2007-05-27 12:40:30 UTC (rev 78003)
+++ trunk/mcs/gmcs/ChangeLog    2007-05-27 12:59:18 UTC (rev 78004)
@@ -1,3 +1,8 @@
+2007-05-27  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * cs-parser.jay: Update to changes introduced in Block and
+       ExplicitBlock.
+
 2007-05-25  Raja R Harinath  <[EMAIL PROTECTED]>
 
        * cs-parser.jay: Use 'start_block' and 'end_block' rather than

Modified: trunk/mcs/gmcs/cs-parser.jay
===================================================================
--- trunk/mcs/gmcs/cs-parser.jay        2007-05-27 12:40:30 UTC (rev 78003)
+++ trunk/mcs/gmcs/cs-parser.jay        2007-05-27 12:59:18 UTC (rev 78004)
@@ -4898,7 +4898,7 @@
          {
                // CHANGE: was `null'
                Statement s = (Statement) $1;
-               Block b = new Block (current_block, Block.Flags.Implicit, 
s.loc, lexer.Location);   
+               Block b = new Block (current_block, s.loc, lexer.Location);   
 
                b.AddStatement (s);
                $$ = b;
@@ -5666,7 +5666,7 @@
        // int j = 1;  int k = j + 1;
        //
        if (current_block.Used)
-               implicit_block = new Block (current_block, 
Block.Flags.Implicit, loc, Location.Null);
+               implicit_block = new Block (current_block, loc, Location.Null);
        else
                implicit_block = current_block;
 
@@ -5704,7 +5704,7 @@
        Block implicit_block;
 
        if (current_block.Used)
-               implicit_block = new Block (current_block, 
Block.Flags.Implicit);
+               implicit_block = new Block (current_block);
        else
                implicit_block = current_block;
 
@@ -5887,7 +5887,7 @@
                        current_generic_method, loc);
                top_current_block = current_block;
        } else {
-               current_block = new Block (current_block, loc, Location.Null);
+               current_block = new ExplicitBlock (current_block, loc, 
Location.Null);
        }
 }
 

Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2007-05-27 12:40:30 UTC (rev 78003)
+++ trunk/mcs/mcs/ChangeLog     2007-05-27 12:59:18 UTC (rev 78004)
@@ -1,5 +1,13 @@
 2007-05-27  Raja R Harinath  <[EMAIL PROTECTED]>
 
+       Introduce ExplicitBlock
+       * statement.cs (ExplicitBlock): New.
+       (ToplevelBlock): Derive from it.
+       (Block.Flags.IsExplicit): Rename from '...Implicit' and invert
+       sense of flag.
+       (Block.Implicit): Update to changes.
+       * cs-parser.jay: Update to changes.
+
        Remove unused field
        * codegen.cs (EmitContext.IsLastStatement): Remove.
        * statement.cs (Block.DoEmit): Update to changes.

Modified: trunk/mcs/mcs/cs-parser.jay
===================================================================
--- trunk/mcs/mcs/cs-parser.jay 2007-05-27 12:40:30 UTC (rev 78003)
+++ trunk/mcs/mcs/cs-parser.jay 2007-05-27 12:59:18 UTC (rev 78004)
@@ -4297,7 +4297,7 @@
          {
                // CHANGE: was `null'
                Statement s = (Statement) $1;
-               Block b = new Block (current_block, Block.Flags.Implicit, 
s.loc, lexer.Location);   
+               Block b = new Block (current_block, s.loc, lexer.Location);   
 
                b.AddStatement (s);
                $$ = b;
@@ -4941,7 +4941,7 @@
        // int j = 1;  int k = j + 1;
        //
        if (current_block.Used)
-               implicit_block = new Block (current_block, 
Block.Flags.Implicit, loc, Location.Null);
+               implicit_block = new Block (current_block, loc, Location.Null);
        else
                implicit_block = current_block;
 
@@ -4979,7 +4979,7 @@
        Block implicit_block;
 
        if (current_block.Used)
-               implicit_block = new Block (current_block, 
Block.Flags.Implicit);
+               implicit_block = new Block (current_block);
        else
                implicit_block = current_block;
 
@@ -5163,7 +5163,7 @@
                        current_generic_method, loc);
                top_current_block = current_block;
        } else {
-               current_block = new Block (current_block, loc, Location.Null);
+               current_block = new ExplicitBlock (current_block, loc, 
Location.Null);
        }
 }
 

Modified: trunk/mcs/mcs/statement.cs
===================================================================
--- trunk/mcs/mcs/statement.cs  2007-05-27 12:40:30 UTC (rev 78003)
+++ trunk/mcs/mcs/statement.cs  2007-05-27 12:59:18 UTC (rev 78004)
@@ -1445,7 +1445,7 @@
 
                [Flags]
                public enum Flags : ushort {
-                       Implicit  = 1,
+                       IsExplicit = 1,
                        Unchecked = 2,
                        BlockUsed = 4,
                        VariablesInitialized = 8,
@@ -1460,7 +1460,7 @@
                protected Flags flags;
 
                public bool Implicit {
-                       get { return (flags & Flags.Implicit) != 0; }
+                       get { return (flags & Flags.IsExplicit) == 0; }
                }
 
                public bool Unchecked {
@@ -1561,7 +1561,8 @@
 
                public Block CreateSwitchBlock (Location start)
                {
-                       Block new_block = new Block (this, start, start);
+                       // FIXME: should this be implicit?
+                       Block new_block = new ExplicitBlock (this, start, 
start);
                        new_block.switch_block = this;
                        return new_block;
                }
@@ -2438,6 +2439,18 @@
                }
        }
 
+       public class ExplicitBlock : Block {
+               public ExplicitBlock (Block parent, Location start, Location 
end)
+                       : this (parent, (Flags) 0, start, end)
+               {
+               }
+
+               public ExplicitBlock (Block parent, Flags flags, Location 
start, Location end)
+                       : base (parent, flags | Flags.IsExplicit, start, end)
+               {
+               }
+       }
+
        //
        // A toplevel block contains extra information, the split is done
        // only to separate information that would otherwise bloat the more
@@ -2446,7 +2459,7 @@
        // In particular, this was introduced when the support for Anonymous
        // Methods was implemented. 
        // 
-       public class ToplevelBlock : Block {
+       public class ToplevelBlock : ExplicitBlock {
                //
                // Pointer to the host of this anonymous method, or null
                // if we are the topmost block
@@ -2773,7 +2786,7 @@
                {
                        flags |= Flags.IsIterator;
 
-                       Block block = new Block (this);
+                       Block block = new ExplicitBlock (this, StartLocation, 
EndLocation);
                        foreach (Statement stmt in statements)
                                block.AddStatement (stmt);
                        statements = new ArrayList ();

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

Reply via email to