From b8f81f6cb445cd26c2df4bb184ff3fb09a508744 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 13 Jan 2011 05:46:36 +0000 Subject: Tidier FreeVars::index. git-svn-id: http://svn.drobilla.net/resp/trunk@409 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- src/resp.hpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/resp.hpp b/src/resp.hpp index 41f1826..cf74e56 100644 --- a/src/resp.hpp +++ b/src/resp.hpp @@ -789,17 +789,12 @@ struct CEnv { const ATuple* const fn; const std::string implName; int32_t index(const ASymbol* sym) { - const_iterator i = begin(); - for (; i != end(); ++i) + for (const_iterator i = begin(); i != end(); ++i) if ((*i)->sym() == sym->sym()) - break; + return i - begin() + 1; - if (i != end()) { - return i - begin() + 1; - } else { - push_back(sym); - return size(); - } + push_back(sym); + return size(); } }; typedef std::stack LiftStack; -- cgit v1.2.1