public Expression GetStoreyInstanceExpression (EmitContext ec)
{
AnonymousExpression am = ec.CurrentAnonymousMethod;
//
// Access from original block -> storey
//
if (am == null)
return Instance;
//
// Access from anonymous method implemented as a static -> storey
//
if (am.Storey == null)
return Instance;
Field f = am.Storey.GetReferencedStoreyField (this);
if (f == null) {
if (am.Storey == this) {
//
// Access inside of same storey (S -> S)
//
return new CompilerGeneratedThis (CurrentType, Location);
}
//
// External field access
//
return Instance;
}
//
// Storey was cached to local field
//
FieldExpr f_ind = new FieldExpr (f, Location);
f_ind.InstanceExpression = new CompilerGeneratedThis (CurrentType, Location);
return f_ind;
}