Added a "null" value for value expressions

This commit is contained in:
John Wiegley 2009-03-03 13:36:23 -04:00
parent 0f9d919367
commit 478998b4e9
2 changed files with 10 additions and 1 deletions

View file

@ -305,6 +305,10 @@ value_t report_t::fn_ansify_if(call_scope_t& scope)
}
namespace {
value_t fn_null(call_scope_t&) {
return NULL_VALUE;
}
template <class Type = post_t,
class handler_ptr = post_handler_ptr,
void (report_t::*report_method)(handler_ptr) =
@ -716,6 +720,11 @@ expr_t::ptr_op_t report_t::lookup(const string& name)
return MAKE_FUNCTOR(report_t::fn_market);
break;
case 'n':
if (is_eq(p, "null"))
return WRAP_FUNCTOR(fn_null);
break;
case 'o':
if (WANT_OPT()) { const char * q = p + OPT_PREFIX_LEN;
if (option_t<report_t> * handler = lookup_option(q))

View file

@ -1515,7 +1515,7 @@ void value_t::dump(std::ostream& out, const bool relaxed) const
{
switch (type()) {
case VOID:
out << "<null>";
out << "null";
break;
case BOOLEAN: