[mcs] Add missing lock expression flow analysis
authorMarek Safar <marek.safar@gmail.com>
Tue, 1 Jul 2014 12:03:53 +0000 (14:03 +0200)
committerMarek Safar <marek.safar@gmail.com>
Tue, 1 Jul 2014 12:03:53 +0000 (14:03 +0200)
mcs/mcs/statement.cs
mcs/tests/test-899.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_5.xml

index 07ab2da361ccab2d5504e9942debe3e617967637..0e8bbb6c48f8f3e1ca8b0bc20a616962a02129ec 100644 (file)
@@ -5781,6 +5781,12 @@ namespace Mono.CSharp {
                        }
                }
 
+               protected override bool DoFlowAnalysis (FlowAnalysisContext fc)
+               {
+                       expr.FlowAnalysis (fc);
+                       return base.DoFlowAnalysis (fc);
+               }
+
                public override bool Resolve (BlockContext ec)
                {
                        expr = expr.Resolve (ec);
diff --git a/mcs/tests/test-899.cs b/mcs/tests/test-899.cs
new file mode 100644 (file)
index 0000000..2f8c9e5
--- /dev/null
@@ -0,0 +1,15 @@
+using System;
+
+class Test
+{
+       public static void Main()
+       {
+               object o;
+               lock (o = new object())
+               {
+                       Console.WriteLine (o);
+               }
+
+               Console.WriteLine (o);
+       }
+}
index 2eb7696b19102a8e38ce8d162ff96b6c3467c8a2..a4f45fb67b6daf6a968dff132f27916a4880d592 100644 (file)
       </method>\r
     </type>\r
   </test>\r
+  <test name="test-899.cs">\r
+    <type name="Test">\r
+      <method name="Void Main()" attrs="150">\r
+        <size>49</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="test-9.cs">\r
     <type name="X">\r
       <method name="Int32 Main(System.String[])" attrs="150">\r