optimizer: address comment.

This commit is contained in:
qiuyesuifeng
2016-01-04 10:34:41 +08:00
parent a8baf4fc02
commit fcbd15dae8

View File

@ -55,9 +55,12 @@ func Eval(ctx context.Context, expr ast.ExprNode) (interface{}, error) {
// EvalBool evalueates an expression to a boolean value.
func EvalBool(ctx context.Context, expr ast.ExprNode) (bool, error) {
val, err := Eval(ctx, expr)
if err != nil || val == nil {
if err != nil {
return false, errors.Trace(err)
}
if val == nil {
return false, nil
}
i, err := types.ToBool(val)
if err != nil {