private static void ValidateGotoType(Type expectedType, ref Expression value, string paramName)
{
RequiresCanRead(value, paramName);
if (expectedType != typeof(void))
{
if (!TypeUtils.AreReferenceAssignable(expectedType, value.Type))
{
// C# auto-quotes return values, so we'll do that here
if (!TryQuote(expectedType, ref value))
{
throw Error.ExpressionTypeDoesNotMatchLabel(value.Type, expectedType);
}
}
}
}
}