コード例 #1
0
        // This is copied from the base implementation.
        // Just want to make sure we disallow yield in filters
        protected override CatchBlock VisitCatchBlock(CatchBlock node)
        {
            ParameterExpression v = VisitAndConvert(node.Variable, "VisitCatchBlock");
            int        yields     = _yields.Count;
            Expression f          = Visit(node.Filter);

            if (yields != _yields.Count)
            {
                // No one needs this yet, and it's not clear what it should even do
                throw new NotSupportedException("yield in filter is not allowed");
            }
            Expression b = Visit(node.Body);

            if (v == node.Variable && b == node.Body && f == node.Filter)
            {
                return(node);
            }
            return(Expression.MakeCatchBlock(node.Test, v, b, f));
        }