/// <summary>
/// Creates a <see cref="LoopExpression"/> with the given body.
/// </summary>
/// <param name="body">The body of the loop.</param>
/// <param name="break">The break target used by the loop body.</param>
/// <param name="continue">The continue target used by the loop body.</param>
/// <returns>The created <see cref="LoopExpression"/>.</returns>
public static LoopExpression Loop(Expression body, LabelTarget @break, LabelTarget @continue)
{
RequiresCanRead(body, nameof(body));
if (@continue != null && @continue.Type != typeof(void))
{
throw Error.LabelTypeMustBeVoid();
}
return(new LoopExpression(body, @break, @continue));
}