Fix comment typo
[mono.git] / mcs / mcs / codegen.cs
index fc47d2bc6120644dae1b4315463aab8d9ecf93dc..8764c79fe9949c668341dc6e3ceeb0aa2419f893 100644 (file)
@@ -51,16 +51,6 @@ namespace Mono.CSharp
                /// </summary>
                public LocalBuilder return_value;
 
-               /// <summary>
-               ///   The location where return has to jump to return the
-               ///   value
-               /// </summary>
-               public Label ReturnLabel;
-
-               /// <summary>
-               ///   If we already defined the ReturnLabel
-               /// </summary>
-               public bool HasReturnLabel;
 
                /// <summary>
                ///   Current loop begin and end labels.
@@ -87,6 +77,8 @@ namespace Mono.CSharp
 
                DynamicSiteClass dynamic_site_container;
 
+               Label? return_label;
+
                public EmitContext (IMemberContext rc, ILGenerator ig, TypeSpec return_type)
                {
                        this.member_context = rc;
@@ -127,6 +119,12 @@ namespace Mono.CSharp
                        get { return member_context.CurrentMemberDefinition; }
                }
 
+               public bool HasReturnLabel {
+                       get {
+                               return return_label.HasValue;
+                       }
+               }
+
                public bool IsStatic {
                        get { return member_context.IsStatic; }
                }
@@ -165,6 +163,15 @@ namespace Mono.CSharp
                        }
                }
 
+               //
+               // The label where we have to jump before leaving the context
+               //
+               public Label ReturnLabel {
+                       get {
+                               return return_label.Value;
+                       }
+               }
+
                #endregion
 
                public void AssertEmptyStack ()
@@ -246,6 +253,14 @@ namespace Mono.CSharp
                        return dynamic_site_container;
                }
 
+               public Label CreateReturnLabel ()
+               {
+                       if (!return_label.HasValue)
+                               return_label = DefineLabel ();
+
+                       return return_label.Value;
+               }
+
                public LocalBuilder DeclareLocal (TypeSpec type, bool pinned)
                {
                        if (IsAnonymousStoreyMutateRequired)
@@ -280,7 +295,7 @@ namespace Mono.CSharp
                        ig.Emit (opcode);
                }
 
-               public void Emit (OpCode opcode, LocalBuilder local, TypeSpec type)
+               public void Emit (OpCode opcode, LocalBuilder local)
                {
                        ig.Emit (opcode, local);
                }
@@ -815,10 +830,6 @@ namespace Mono.CSharp
                {
                        if (return_value == null){
                                return_value = DeclareLocal (return_type, false);
-                               if (!HasReturnLabel){
-                                       ReturnLabel = DefineLabel ();
-                                       HasReturnLabel = true;
-                               }
                        }
 
                        return return_value;