From ea1642b3f969463a49e5a671478c92e4ef129665 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 13 Jun 2010 05:02:14 -0400 Subject: Completely reworked argument passing in expressions --- src/xact.cc | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'src/xact.cc') diff --git a/src/xact.cc b/src/xact.cc index 0bf1fc2c..1188fd0f 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -36,7 +36,6 @@ #include "account.h" #include "journal.h" #include "pool.h" -#include "interactive.h" namespace ledger { @@ -503,31 +502,27 @@ namespace { return (*Func)(find_scope(scope)); } - value_t fn_any(call_scope_t& scope) + value_t fn_any(call_scope_t& args) { - interactive_t args(scope, "X&X"); - - post_t& post(find_scope(scope)); - expr_t& expr(args.get(0)); + post_t& post(args.context()); + expr_t::ptr_op_t expr(args.get(0)); foreach (post_t * p, post.xact->posts) { - bind_scope_t bound_scope(scope, *p); - if (expr.calc(bound_scope).to_boolean()) + bind_scope_t bound_scope(args, *p); + if (expr->calc(bound_scope).to_boolean()) return true; } return false; } - value_t fn_all(call_scope_t& scope) + value_t fn_all(call_scope_t& args) { - interactive_t args(scope, "X&X"); - - post_t& post(find_scope(scope)); - expr_t& expr(args.get(0)); + post_t& post(args.context()); + expr_t::ptr_op_t expr(args.get(0)); foreach (post_t * p, post.xact->posts) { - bind_scope_t bound_scope(scope, *p); - if (! expr.calc(bound_scope).to_boolean()) + bind_scope_t bound_scope(args, *p); + if (! expr->calc(bound_scope).to_boolean()) return false; } return true; -- cgit v1.2.3