Refer to empty expression operators as simply NULL.

This commit is contained in:
John Wiegley 2009-02-07 04:27:04 -04:00
parent eb98e0da8b
commit 682544ef17
5 changed files with 6 additions and 7 deletions

View file

@ -217,7 +217,7 @@ expr_t::ptr_op_t account_t::lookup(const string& name)
break; break;
} }
return expr_t::ptr_op_t(); return NULL;
} }
bool account_t::valid() const bool account_t::valid() const

View file

@ -309,7 +309,7 @@ expr_t::ptr_op_t item_t::lookup(const string& name)
break; break;
} }
return expr_t::ptr_op_t(); return NULL;
} }
bool item_t::valid() const bool item_t::valid() const

View file

@ -60,8 +60,7 @@ expr_t::ptr_op_t expr_t::op_t::compile(scope_t& scope)
ptr_op_t lhs(left()->compile(scope)); ptr_op_t lhs(left()->compile(scope));
ptr_op_t rhs(kind > UNARY_OPERATORS && has_right() ? ptr_op_t rhs(kind > UNARY_OPERATORS && has_right() ?
(kind == O_LOOKUP ? right() : right()->compile(scope)) : (kind == O_LOOKUP ? right() : right()->compile(scope)) : NULL);
ptr_op_t());
if (lhs == left() && (! rhs || rhs == right())) if (lhs == left() && (! rhs || rhs == right()))
return this; return this;

View file

@ -287,8 +287,8 @@ public:
ostream_pos_type * end_pos; ostream_pos_type * end_pos;
bool relaxed; bool relaxed;
context_t(const ptr_op_t& _expr_op = ptr_op_t(), context_t(const ptr_op_t& _expr_op = NULL,
const ptr_op_t& _op_to_find = ptr_op_t(), const ptr_op_t& _op_to_find = NULL,
ostream_pos_type * const _start_pos = NULL, ostream_pos_type * const _start_pos = NULL,
ostream_pos_type * const _end_pos = NULL, ostream_pos_type * const _end_pos = NULL,
const bool _relaxed = true) const bool _relaxed = true)

View file

@ -101,7 +101,7 @@ public:
virtual expr_t::ptr_op_t lookup(const string& name) { virtual expr_t::ptr_op_t lookup(const string& name) {
if (parent) if (parent)
return parent->lookup(name); return parent->lookup(name);
return expr_t::ptr_op_t(); return NULL;
} }
}; };