diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-12 22:18:16 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-13 01:03:48 -0400 |
commit | 1bc5b894dfd9412a60c4db16e9a4e49ddddad5fd (patch) | |
tree | 482c6d0143b56c61b43fadb141384fb89184279e /src/account.cc | |
parent | 536e3e73228b6168437704ede89499406b87391d (diff) | |
download | fork-ledger-1bc5b894dfd9412a60c4db16e9a4e49ddddad5fd.tar.gz fork-ledger-1bc5b894dfd9412a60c4db16e9a4e49ddddad5fd.tar.bz2 fork-ledger-1bc5b894dfd9412a60c4db16e9a4e49ddddad5fd.zip |
Expression evaluations now have a "type context"
Thus, an expression can know if the context in which it's being
evaluated requires a string, and if so, determine it's output
accordingly. For example:
account ; returns the full name of the posting's account
account.total ; here the context is SCOPE, so account is an obj
Diffstat (limited to 'src/account.cc')
-rw-r--r-- | src/account.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/account.cc b/src/account.cc index 606562b8..f26b7913 100644 --- a/src/account.cc +++ b/src/account.cc @@ -208,7 +208,11 @@ namespace { return scope_value(acct->find_account_re(args.get<mask_t>(0).str())); else return NULL_VALUE; - } else { + } + else if (scope.type_context() == value_t::SCOPE) { + return scope_value(&account); + } + else { return string_value(account.fullname()); } } |