+ var storey_type_expr = CreateStoreyTypeExpression (ec);
+ var source = new New (storey_type_expr, null, Location).Resolve (rc);
+
+ //
+ // When the current context is async (or iterator) lift local storey
+ // instantiation to the currect storey
+ //
+ if (ec.CurrentAnonymousMethod is StateMachineInitializer && (block.HasYield || block.HasAwait)) {
+ //
+ // Unfortunately, normal capture mechanism could not be used because we are
+ // too late in the pipeline and standart assign cannot be used either due to
+ // recursive nature of GetStoreyInstanceExpression
+ //
+ var field = ec.CurrentAnonymousMethod.Storey.AddCompilerGeneratedField (
+ LocalVariable.GetCompilerGeneratedName (block), storey_type_expr, true);
+
+ field.Define ();
+ field.Emit ();
+
+ var fexpr = new FieldExpr (field, Location);
+ fexpr.InstanceExpression = new CompilerGeneratedThis (ec.CurrentType, Location);
+ fexpr.EmitAssign (ec, source, false, false);
+ Instance = fexpr;
+ } else {
+ var local = TemporaryVariableReference.Create (source.Type, block, Location);
+ if (source.Type.IsStruct) {
+ local.LocalInfo.CreateBuilder (ec);
+ } else {
+ local.EmitAssign (ec, source);
+ }
+
+ Instance = local;
+ }