private static void ValidateGoto(LabelTarget target, ref Expression value, string targetParameter, string valueParameter, Type type)
{
ContractUtils.RequiresNotNull(target, targetParameter);
if (value == null)
{
if (target.Type != typeof(void))
{
throw Error.LabelMustBeVoidOrHaveExpression(nameof(target));
}
if (type != null)
{
TypeUtils.ValidateType(type, nameof(type));
if (type.IsByRef)
{
throw Error.TypeMustNotBeByRef(nameof(type));
}
if (type.IsPointer)
{
throw Error.TypeMustNotBePointer(nameof(type));
}
}
}
else
{
ValidateGotoType(target.Type, ref value, valueParameter);
}
}