Skip to content

Commit

Permalink
Fix removing of hoisted variable moved to another storey
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-safar committed Jul 1, 2013
1 parent f2bf4f7 commit a4cac48
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions mcs/mcs/anonymous.cs
Expand Up @@ -315,8 +315,11 @@ public void CaptureLocalVariable (ResolveContext ec, LocalVariable localVariable

var hoisted = localVariable.HoistedVariant;
if (hoisted != null && hoisted.Storey != this && hoisted.Storey is StateMachine) {
// TODO: It's too late the field is defined in HoistedLocalVariable ctor
//
// Variable is already hoisted but we need it in storey which can be shared
//
hoisted.Storey.hoisted_locals.Remove (hoisted);
hoisted.Storey.Members.Remove (hoisted.Field);
hoisted = null;
}

Expand Down Expand Up @@ -728,6 +731,12 @@ protected HoistedVariable (AnonymousMethodStorey storey, Field field)
this.field = field;
}

public Field Field {
get {
return field;
}
}

public AnonymousMethodStorey Storey {
get {
return storey;
Expand Down Expand Up @@ -848,12 +857,6 @@ public HoistedParameter (HoistedParameter hp, string name)

#region Properties

public Field Field {
get {
return field;
}
}

public bool IsAssigned { get; set; }

public ParameterReference Parameter {
Expand Down Expand Up @@ -893,12 +896,6 @@ public HoistedThis (AnonymousMethodStorey storey, Field field)
: base (storey, field)
{
}

public Field Field {
get {
return field;
}
}
}

//
Expand Down

0 comments on commit a4cac48

Please sign in to comment.