protected override Expression DoResolve(ResolveContext ec) { var ctx = CreateBlockContext(ec); Block.Resolve(ctx); // // Explicit return is required for Task<T> state machine // var task_storey = storey as AsyncTaskStorey; if (task_storey == null || (task_storey.ReturnType != null && !task_storey.ReturnType.IsGenericTask)) { ctx.CurrentBranching.CurrentUsageVector.Goto(); } ctx.EndFlowBranching(); if (!ec.IsInProbingMode) { var move_next = new StateMachineMethod(storey, this, new TypeExpression(ReturnType, loc), Modifiers.PUBLIC, new MemberName("MoveNext", loc)); move_next.Block.AddStatement(new MoveNextBodyStatement(this)); storey.AddEntryMethod(move_next); } eclass = ExprClass.Value; return(this); }
public override bool Resolve(EmitContext ec) { ec.StartFlowBranching(iterator); bool ok = original_block.Resolve(ec); ec.EndFlowBranching(); return(ok); }
protected override Expression DoResolve(ResolveContext rc) { var bc = (BlockContext)rc; var ctx = CreateBlockContext(bc); Block.Resolve(ctx); if (!rc.IsInProbingMode) { var move_next = new StateMachineMethod(storey, this, new TypeExpression(ReturnType, loc), Modifiers.PUBLIC, new MemberName("MoveNext", loc), 0); move_next.Block.AddStatement(new MoveNextBodyStatement(this)); storey.AddEntryMethod(move_next); } bc.AssignmentInfoOffset = ctx.AssignmentInfoOffset; eclass = ExprClass.Value; return(this); }
protected override Expression DoResolve(ResolveContext ec) { IteratorHost = (IteratorStorey)block.TopBlock.AnonymousMethodStorey; BlockContext ctx = new BlockContext(ec, block, ReturnType); ctx.CurrentAnonymousMethod = this; ctx.StartFlowBranching(this, ec.CurrentBranching); Block.Resolve(ctx); ctx.EndFlowBranching(); var move_next = new IteratorMethod(IteratorHost, new TypeExpression(ec.BuiltinTypes.Bool, loc), Modifiers.PUBLIC, new MemberName("MoveNext", Location)); move_next.Block.AddStatement(new MoveNextMethodStatement(this)); IteratorHost.AddMethod(move_next); eclass = ExprClass.Value; return(this); }