From 363fb6d55823cb84f49735e795232837a40a4f0c Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 3 Aug 2008 00:22:55 -0400 Subject: Got date, payee and accounts back into the register report. --- scope.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'scope.h') diff --git a/scope.h b/scope.h index be60fb85..88b45d84 100644 --- a/scope.h +++ b/scope.h @@ -66,14 +66,14 @@ template inline T& find_scope(scope_t& scope, bool skip_this = true) { optional found = scope.find_scope(typeid(T), skip_this); assert(found); - return downcast(*found); + return static_cast(*found); } template inline optional maybe_find_scope(scope_t& scope, bool skip_this = true) { optional found = scope.find_scope(typeid(T), skip_this); if (found) - return optional(downcast(*found)); + return optional(static_cast(*found)); else return none; } @@ -102,12 +102,14 @@ public: virtual optional find_scope(const std::type_info& type, bool skip_this = true) { - for (scope_t * ptr = (skip_this ? parent : this); - ptr; - ptr = polymorphic_downcast(ptr)->parent) - if (typeid(ptr) == type) + for (scope_t * ptr = (skip_this ? parent : this); ptr; ) { + if (typeid(*ptr) == type) return *ptr; - + if (child_scope_t * scope = dynamic_cast(ptr)) + ptr = scope->parent; + else + ptr = NULL; + } return none; } }; -- cgit v1.2.3