Don't allow regexps to be evaluated in a boolean context.

This commit is contained in:
John Wiegley 2009-02-07 17:45:57 -04:00
parent 589eabd8e6
commit 96e11c5937

View file

@ -211,18 +211,16 @@ value_t::operator bool() const
return as_balance_pair(); return as_balance_pair();
case STRING: case STRING:
return ! as_string().empty(); return ! as_string().empty();
case MASK:
return ! as_mask().empty();
case SEQUENCE: case SEQUENCE:
return ! as_sequence().empty(); return ! as_sequence().empty();
case POINTER: case POINTER:
return ! as_any_pointer().empty(); return ! as_any_pointer().empty();
default: default:
assert(false);
break; break;
} }
assert(false);
return 0; throw_(value_error, "Cannot determine truth of " << label());
return false;
} }
bool value_t::to_boolean() const bool value_t::to_boolean() const