Merge branch 'marek'
authorMarek Safar <marek.safar@gmail.com>
Wed, 28 Jul 2010 14:32:30 +0000 (15:32 +0100)
committerMarek Safar <marek.safar@gmail.com>
Wed, 28 Jul 2010 14:32:30 +0000 (15:32 +0100)
mcs/errors/cs0133-2.cs [new file with mode: 0644]
mcs/mcs/argument.cs
mcs/mcs/statement.cs

diff --git a/mcs/errors/cs0133-2.cs b/mcs/errors/cs0133-2.cs
new file mode 100644 (file)
index 0000000..7b438bb
--- /dev/null
@@ -0,0 +1,12 @@
+// CS0133: The expression being assigned to `c' must be constant\r
+// Line: 10\r
+\r
+class C\r
+{\r
+       void Foo ()\r
+       {\r
+               int[] array;\r
+               int idx;\r
+               const int c = array [idx];\r
+       }\r
+}\r
index b1f6939c330b8a3cb09fff93995cc37e43be028a..3d54dda0f2e5a7b3c7e517e69edfd4ea82ac96ba 100644 (file)
@@ -110,7 +110,7 @@ namespace Mono.CSharp
                        if (Expr == EmptyExpression.Null)
                                return;
 
-                       using (ec.With (ResolveContext.Options.DoFlowAnalysis, true)) {
+//                     using (ec.With (ResolveContext.Options.DoFlowAnalysis, true)) {
                                // Verify that the argument is readable
                                if (ArgType != AType.Out)
                                        Expr = Expr.Resolve (ec);
@@ -121,7 +121,7 @@ namespace Mono.CSharp
 
                                if (Expr == null)
                                        Expr = EmptyExpression.Null;
-                       }
+//                     }
                }
 
                public virtual void Emit (EmitContext ec)
index f6d4b7f5951b53b69bd46406e5dd70d98af8f4a2..3710cf7977ad1ac14c6d9412c78b9915b2b56f97 100644 (file)
@@ -1945,8 +1945,10 @@ namespace Mono.CSharp {
 
                                ec.CurrentBlock = this;
                                Expression e;
-                               using (ec.With (ResolveContext.Options.ConstantCheckState, (flags & Flags.Unchecked) == 0)) {
-                                       e = cv.Resolve (ec);
+                               using (ec.With (ResolveContext.Options.ConstantCheckState, (flags & Flags.Unchecked) == 0)) {\r
+                                       using (ec.With (ResolveContext.Options.DoFlowAnalysis, false)) {\r
+                                               e = cv.Resolve (ec);\r
+                                       }
                                }
                                if (e == null)
                                        continue;