Short-circuit annotated commodity valuation

This commit is contained in:
John Wiegley 2010-06-03 17:59:43 -04:00
parent e6c5837b2c
commit e8bf3da053

View file

@ -737,7 +737,9 @@ amount_t::value(const bool primary_only,
#endif
if (has_commodity() &&
(! primary_only || ! commodity().has_flags(COMMODITY_PRIMARY))) {
if (in_terms_of && commodity() == *in_terms_of) {
if (in_terms_of &&
(commodity() == *in_terms_of ||
commodity().referent() == in_terms_of->referent())) {
return *this;
}
else if (has_annotation() && annotation().price &&