首页 新闻 会员 周边

System.Linq.Expressions.Expression类的这段代码有没有问题?

0
悬赏园豆:20 [已关闭问题] 关闭于 2015-08-14 09:12
// System.Linq.Expressions.Expression
[__DynamicallyInvokable]
public Expression ReduceAndCheck()
{
    if (!this.CanReduce)
    {
        throw Error.MustBeReducible();
    }
    Expression expression = this.Reduce();
    if (expression == null || expression == this)
    {
        throw Error.MustReduceToDifferent();
    }
    if (!TypeUtils.AreReferenceAssignable(this.Type, expression.Type))
    {
        throw Error.ReducedNotCompatible();
    }
    return expression;
}

// System.Linq.Expressions.Expression
[__DynamicallyInvokable]
public virtual Expression Reduce()
{
    if (this.CanReduce)
    {
        throw Error.ReducibleMustOverrideReduce();
    }
    return this;
}

ReduceAndCheck中先判断CanReduce,为true则向下执行,随即调用Reduce,再次判断CanReduce,为false则向下执行,那么问题来了,无论CanReduce为True或False,都会抛出异常?
happydaily的主页 happydaily | 菜鸟二级 | 园豆:301
提问于:2015-08-14 09:09
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册