summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-03-05 23:02:50 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-03-05 23:02:50 -0400
commit5167e6223b7a0e60a7e8db160902653fca9f2908 (patch)
tree13f2ef0bedc32c10256311263c2cd5047ae420d2 /src
parenta2c73120809ba78dfdeb75f5ff0956e5f41e5975 (diff)
downloadfork-ledger-5167e6223b7a0e60a7e8db160902653fca9f2908.tar.gz
fork-ledger-5167e6223b7a0e60a7e8db160902653fca9f2908.tar.bz2
fork-ledger-5167e6223b7a0e60a7e8db160902653fca9f2908.zip
Enriched the behavior of post_t::add_to_value
The new behavior will be used in future by some pending topic branches I'm working on.
Diffstat (limited to 'src')
-rw-r--r--src/post.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/post.cc b/src/post.cc
index 98899946..42e81159 100644
--- a/src/post.cc
+++ b/src/post.cc
@@ -367,9 +367,27 @@ void post_t::add_to_value(value_t& value, const optional<expr_t&>& expr) const
{
if (xdata_ && xdata_->has_flags(POST_EXT_COMPOUND)) {
add_or_set_value(value, xdata_->compound_value);
- } else {
- bind_scope_t bound_scope(*expr->get_context(), const_cast<post_t&>(*this));
- add_or_set_value(value, expr->calc(bound_scope));
+ }
+ else if (expr) {
+ bind_scope_t bound_scope(*expr->get_context(),
+ const_cast<post_t&>(*this));
+#if 1
+ value_t temp(expr->calc(bound_scope));
+ add_or_set_value(value, temp);
+#else
+ if (! xdata_) xdata_ = xdata_t();
+ xdata_->value = expr->calc(bound_scope);
+ xdata_->add_flags(POST_EXT_COMPOUND);
+
+ add_or_set_value(value, xdata_->value);
+#endif
+ }
+ else if (xdata_ && xdata_->has_flags(POST_EXT_VISITED) &&
+ ! xdata_->visited_value.is_null()) {
+ add_or_set_value(value, xdata_->visited_value);
+ }
+ else {
+ add_or_set_value(value, amount);
}
}