DuplicateLabels() static private method

ArgumentException with message like "Break and continue lables should be different"
static private DuplicateLabels ( ) : Exception
return System.Exception
示例#1
0
        internal static void ValidateLoop(Expression body, LabelTarget @break, LabelTarget @continue)
        {
            if (@break != null && @break.Type != typeof(void))
            {
                // DESIGN: C# statement behavior; can be revisited.
                throw LinqError.LabelTypeMustBeVoid();
            }

            if (@continue != null && @continue.Type != typeof(void))
            {
                throw LinqError.LabelTypeMustBeVoid();
            }

            if (@break != null && @continue != null && @break == @continue)
            {
                throw Error.DuplicateLabels();
            }
        }