X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fanonymous.cs;h=d27fe806048797af33538b202c262e0e040dff4e;hb=770ca46e080aecbcbaccc0be03346709c49c41cf;hp=80481ed2091f6ba2cf1deb7c25e4c5514ce9e529;hpb=df9c98dda18083ec63171490267e08342621ef45;p=mono.git diff --git a/mcs/mcs/anonymous.cs b/mcs/mcs/anonymous.cs index 80481ed2091..d27fe806048 100644 --- a/mcs/mcs/anonymous.cs +++ b/mcs/mcs/anonymous.cs @@ -1595,6 +1595,15 @@ namespace Mono.CSharp { if (res && errors != ec.Report.Errors) return null; + if (block.IsAsync && block.Original.ParametersBlock.HasCapturedThis && ec.CurrentAnonymousMethod != null && ec.CurrentAnonymousMethod.block.IsAsync) { + // + // We'll do ldftn to load the fabricated m_X method but + // because we are inside struct the method can be hoisted + // anywhere in the parent scope + // + ec.CurrentBlock.ParametersBlock.HasReferenceToStoreyForInstanceLambdas = true; + } + return res ? this : null; } @@ -1798,6 +1807,8 @@ namespace Mono.CSharp { parent = storey = sm; } } + } else if (src_block.ParametersBlock.HasReferenceToStoreyForInstanceLambdas) { + src_block.ParametersBlock.StateMachine.AddParentStoreyReference (ec, storey); } modifiers = storey != null ? Modifiers.INTERNAL : Modifiers.PRIVATE;