summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-22 18:53:44 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-22 18:53:44 -0400
commite95e8c3f792c8801f5e0c31a3a2234a0ccc553e9 (patch)
treed2acb79ef5cda3f9672f7ad9bb14af53c0549e6d /src/value.cc
parent965df4a404f7c47b2cb5a61411538d8849a76508 (diff)
downloadfork-ledger-e95e8c3f792c8801f5e0c31a3a2234a0ccc553e9.tar.gz
fork-ledger-e95e8c3f792c8801f5e0c31a3a2234a0ccc553e9.tar.bz2
fork-ledger-e95e8c3f792c8801f5e0c31a3a2234a0ccc553e9.zip
Corrected a parse-time optimization of "! CONSTANT".
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/value.cc b/src/value.cc
index 7db334cb..1ebc3110 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -1237,6 +1237,35 @@ void value_t::in_place_negate()
throw_(value_error, "Cannot negate " << label());
}
+void value_t::in_place_not()
+{
+ switch (type()) {
+ case BOOLEAN:
+ set_boolean(! as_boolean());
+ return;
+ case INTEGER:
+ case DATETIME:
+ set_boolean(! as_long());
+ return;
+ case DATE:
+ set_boolean(! as_long());
+ return;
+ case AMOUNT:
+ set_boolean(! as_amount());
+ return;
+ case BALANCE:
+ set_boolean(! as_balance());
+ return;
+ case BALANCE_PAIR:
+ set_boolean(! as_balance_pair());
+ return;
+ default:
+ break;
+ }
+
+ throw_(value_error, "Cannot not " << label());
+}
+
bool value_t::is_realzero() const
{
switch (type()) {