From ea27d1b45a5ff975a1e90e3e9f4b74ff8d34056e Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 29 Jul 2008 20:10:03 -0400 Subject: Moved around and renamed a very large amount of code in order to rationalize the way that value expressions extract information from journal objects. --- expr.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'expr.cc') diff --git a/expr.cc b/expr.cc index 0319e243..086f2494 100644 --- a/expr.cc +++ b/expr.cc @@ -111,6 +111,23 @@ value_t expr_t::calc(scope_t& scope) const return NULL_VALUE; } +bool expr_t::is_constant() const +{ + return ptr.get() && ptr->is_value(); +} + +value_t& expr_t::constant_value() +{ + assert(is_constant()); + return ptr->as_value_lval(); +} + +const value_t& expr_t::constant_value() const +{ + assert(is_constant()); + return ptr->as_value(); +} + value_t expr_t::eval(const string& _expr, scope_t& scope) { return expr_t(_expr).calc(scope); -- cgit v1.2.3