diff options
author | John Wiegley <johnw@newartisans.com> | 2008-07-29 20:10:03 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-07-29 20:10:03 -0400 |
commit | ea27d1b45a5ff975a1e90e3e9f4b74ff8d34056e (patch) | |
tree | 492a147199ad921959f86e8f0b4ec4edc1eeed46 /expr.cc | |
parent | 200d919fe7c8bcf021011c16fb6ec50821444d5e (diff) | |
download | ledger-ea27d1b45a5ff975a1e90e3e9f4b74ff8d34056e.tar.gz ledger-ea27d1b45a5ff975a1e90e3e9f4b74ff8d34056e.tar.bz2 ledger-ea27d1b45a5ff975a1e90e3e9f4b74ff8d34056e.zip |
Moved around and renamed a very large amount of code in order to rationalize
the way that value expressions extract information from journal objects.
Diffstat (limited to 'expr.cc')
-rw-r--r-- | expr.cc | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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); |