public static LabelExpression Label(LabelTarget target, Expression defaultValue) { ValidateGoto(target, ref defaultValue, nameof(target), nameof(defaultValue), type: null); return new LabelExpression(target, defaultValue); } }
protected override object VisitDoWhile(DoWhile W) { string name = target.LabelName(); LinqExprs.LabelTarget begin = LinqExpr.Label("do_" + name + "_begin"); LinqExprs.LabelTarget end = LinqExpr.Label("do_" + name + "_end"); loops.Push(new Loop(LinqExpr.Goto(end), LinqExpr.Goto(begin))); target.PushScope(); // Check the condition, exit if necessary. target.Add(LinqExpr.Label(begin)); // Generate the body target. Visit(W.Body); // Loop. target.Add(LinqExpr.IfThen(target.Compile(W.Condition), LinqExpr.Goto(begin))); // Exit label. target.Add(LinqExpr.Label(end)); loops.Pop(); target.PopScope(); return(null); }