If a posting has an integer amount, convert it

This commit is contained in:
John Wiegley 2009-03-03 16:28:20 -04:00
parent e2c30cf6e4
commit c305db937c

View file

@ -157,10 +157,14 @@ namespace {
bind_scope_t bound_scope(session_scope, *post);
value_t result(expr.calc(bound_scope));
if (! result.is_amount())
throw_(parse_error, _("Postings may only specify simple amounts"));
if (result.is_long()) {
amount = result.to_amount();
} else {
if (! result.is_amount())
throw_(parse_error, _("Postings may only specify simple amounts"));
amount = result.as_amount();
amount = result.as_amount();
}
DEBUG("textual.parse", "The posting amount is " << amount);
}
}