/// </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.
DynamicSiteClass dynamic_site_container;
+ Label? return_label;
+
public EmitContext (IMemberContext rc, ILGenerator ig, TypeSpec return_type)
{
this.member_context = rc;
get { return member_context.CurrentMemberDefinition; }
}
+ public bool HasReturnLabel {
+ get {
+ return return_label.HasValue;
+ }
+ }
+
public bool IsStatic {
get { return member_context.IsStatic; }
}
}
}
+ //
+ // The label where we have to jump before leaving the context
+ //
+ public Label ReturnLabel {
+ get {
+ return return_label.Value;
+ }
+ }
+
#endregion
public void AssertEmptyStack ()
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)
ig.Emit (opcode);
}
- public void Emit (OpCode opcode, LocalBuilder local, TypeSpec type)
+ public void Emit (OpCode opcode, LocalBuilder local)
{
ig.Emit (opcode, local);
}
{
if (return_value == null){
return_value = DeclareLocal (return_type, false);
- if (!HasReturnLabel){
- ReturnLabel = DefineLabel ();
- HasReturnLabel = true;
- }
}
return return_value;