From 1bc5b894dfd9412a60c4db16e9a4e49ddddad5fd Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 12 Jun 2010 22:18:16 -0400 Subject: 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 --- src/account.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/account.cc') 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(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()); } } -- cgit v1.2.3