[mcs] Adds handling for declared variables from while loop condition
[mono.git] / mcs / mcs / const.cs
index 883b0d2c23fe1efd45e1a5b61e4fe73317a3b251..046aec24c1b18b8bb3619e23a5a899bbb074f27a 100644 (file)
@@ -59,7 +59,7 @@ namespace Mono.CSharp {
 
                        if ((field_attr & FieldAttributes.InitOnly) != 0)
                                Parent.PartialContainer.RegisterFieldForInitialization (this,
-                                       new FieldInitializer (spec, initializer, this));
+                                       new FieldInitializer (this, initializer, Location));
 
                        if (declarators != null) {
                                var t = new TypeExpression (MemberType, TypeExpression.Location);
@@ -100,12 +100,23 @@ namespace Mono.CSharp {
                {
                        if (t.IsGenericParameter) {
                                Report.Error (1959, loc,
-                                       "Type parameter `{0}' cannot be declared const", TypeManager.CSharpName (t));
+                                       "Type parameter `{0}' cannot be declared const", t.GetSignatureForError ());
                        } else {
                                Report.Error (283, loc,
-                                       "The type `{0}' cannot be declared const", TypeManager.CSharpName (t));
+                                       "The type `{0}' cannot be declared const", t.GetSignatureForError ());
                        }
                }
+
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
+
+               public override void PrepareEmit ()
+               {
+                       base.PrepareEmit ();
+                       DefineValue ();
+               }
        }
 
        public class ConstSpec : FieldSpec