diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-13 05:02:14 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-13 05:02:14 -0400 |
commit | ea1642b3f969463a49e5a671478c92e4ef129665 (patch) | |
tree | 9eba47b8708123b4e3f539dd9d747f1f85d9d2fe /src/xact.cc | |
parent | ad3b30a9641b8e09c38ea76e7011b614152d8faf (diff) | |
download | fork-ledger-ea1642b3f969463a49e5a671478c92e4ef129665.tar.gz fork-ledger-ea1642b3f969463a49e5a671478c92e4ef129665.tar.bz2 fork-ledger-ea1642b3f969463a49e5a671478c92e4ef129665.zip |
Completely reworked argument passing in expressions
Diffstat (limited to 'src/xact.cc')
-rw-r--r-- | src/xact.cc | 25 |
1 files changed, 10 insertions, 15 deletions
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<xact_t>(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<post_t>(scope)); - expr_t& expr(args.get<expr_t&>(0)); + post_t& post(args.context<post_t>()); + expr_t::ptr_op_t expr(args.get<expr_t::ptr_op_t>(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<post_t>(scope)); - expr_t& expr(args.get<expr_t&>(0)); + post_t& post(args.context<post_t>()); + expr_t::ptr_op_t expr(args.get<expr_t::ptr_op_t>(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; |