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.
This commit is contained in:
John Wiegley 2009-03-05 23:02:50 -04:00
parent a2c7312080
commit 5167e6223b

View file

@ -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);
}
}