2010-05-21 Marek Safar <marek.safar@gmail.com>
authorMarek Safar <marek.safar@gmail.com>
Tue, 25 May 2010 09:55:05 +0000 (09:55 -0000)
committerMarek Safar <marek.safar@gmail.com>
Tue, 25 May 2010 09:55:05 +0000 (09:55 -0000)
* context.cs, expression.cs, cs-parser.jay: Don't store current
block in This expression (it's too early for linq blocks).

svn path=/trunk/mcs/; revision=157834

mcs/mcs/ChangeLog
mcs/mcs/context.cs
mcs/mcs/cs-parser.jay
mcs/mcs/expression.cs

index df6caf2cb20093b484466463f9dab88137c1f47e..099863db2cba9672daf38039eedafadc81be77e2 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-21  Marek Safar  <marek.safar@gmail.com>
+
+       * context.cs, expression.cs, cs-parser.jay: Don't store current
+       block in This expression (it's too early for linq blocks).
+
 2010-05-21  Marek Safar  <marek.safar@gmail.com>
 
        * expression.cs: Use constrained prefix more broadly to avoid boxing.
index 006c66cb60cf72a175c595df8cc7b8486bf82c41..89db3023bd067ddbbea54fa502efd056c3665c06 100644 (file)
@@ -402,11 +402,7 @@ namespace Mono.CSharp
                // TODO: Merge with CompilerGeneratedThis
                public Expression GetThis (Location loc)
                {
-                       This my_this;
-                       if (CurrentBlock != null)
-                               my_this = new This (CurrentBlock, loc);
-                       else
-                               my_this = new This (loc);
+                       This my_this = new This (loc);
 
                        if (!my_this.ResolveBase (this))
                                my_this = null;
index 647360860130734dacd28bf473d94265e8ac5d1d..b9b77cc78515b6db632d033d7f4688e64df31d32 100644 (file)
@@ -3361,7 +3361,7 @@ expression_list_argument
 this_access
        : THIS
          {
-               $$ = new This (current_block, GetLocation ($1));
+               $$ = new This (GetLocation ($1));
          }
        ;
 
index 9b96c05220a0f372a5e4b6dfbe78c5224f702eb9..f0b7ef03816b2f525bf8ab73e4abbcdd6fd4981d 100644 (file)
@@ -6419,7 +6419,6 @@ namespace Mono.CSharp {
                        if (type == null)
                                type = ec.CurrentType;
 
-                       is_struct = TypeManager.IsStruct (type);
                        return this;
                }
 
@@ -6455,15 +6454,7 @@ namespace Mono.CSharp {
                        }
                }
 
-               Block block;
                VariableInfo variable_info;
-               protected bool is_struct;
-
-               public This (Block block, Location loc)
-               {
-                       this.loc = loc;
-                       this.block = block;
-               }
 
                public This (Location loc)
                {
@@ -6496,7 +6487,7 @@ namespace Mono.CSharp {
                }
 
                public override bool IsRef {
-                       get { return is_struct; }
+                       get { return type.IsStruct; }
                }
 
                protected override ILocalVariable Variable {
@@ -6534,8 +6525,7 @@ namespace Mono.CSharp {
                                }
                        }
 
-                       is_struct = TypeManager.IsStruct (type);
-
+                       var block = ec.CurrentBlock;
                        if (block != null) {
                                if (block.Toplevel.ThisVariable != null)
                                        variable_info = block.Toplevel.ThisVariable.VariableInfo;
@@ -6600,7 +6590,7 @@ namespace Mono.CSharp {
 
                public override int GetHashCode()
                {
-                       return block.GetHashCode ();
+                       throw new NotImplementedException ();
                }
 
                public override string Name {
@@ -6613,14 +6603,12 @@ namespace Mono.CSharp {
                        if (t == null)
                                return false;
 
-                       return block == t.block;
+                       return true;
                }
 
                protected override void CloneTo (CloneContext clonectx, Expression t)
                {
-                       This target = (This) t;
-
-                       target.block = clonectx.LookupBlock (block);
+                       // Nothing
                }
 
                public override void SetHasAddressTaken ()