diff options
Diffstat (limited to 'src/lift.cpp')
-rw-r--r-- | src/lift.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/lift.cpp b/src/lift.cpp index 7fa834f..48fcf4e 100644 --- a/src/lift.cpp +++ b/src/lift.cpp @@ -124,14 +124,14 @@ lift_fn(CEnv& cenv, Code& code, const ATuple* fn) throw() // Prepend closure parameter implProt.push_back(cenv.penv.sym("_me")); - for (ATuple::const_iterator p = fn->prot()->begin(); p != fn->prot()->end(); ++p) { + for (auto p : *fn->prot()) { const AST* paramType = (*tp++); if (is_form(paramType, "lambda")) { const ATuple* fnType = new ATuple(cenv.tenv.var(), paramType->as_tuple(), paramType->loc); - paramType = tup((*p)->loc, cenv.tenv.Tup, fnType, NULL); + paramType = tup(p->loc, cenv.tenv.Tup, fnType, NULL); } - cenv.def((*p)->as_symbol(), *p, paramType, NULL); - implProt.push_back(*p); + cenv.def(p->as_symbol(), p, paramType, NULL); + implProt.push_back(p); implProtT.push_back(paramType); } @@ -178,9 +178,9 @@ lift_fn(CEnv& cenv, Code& code, const ATuple* fn) throw() const CEnv::FreeVars freeVars = cenv.liftStack.top(); cenv.liftStack.pop(); - for (CEnv::FreeVars::const_iterator i = freeVars.begin(); i != freeVars.end(); ++i) { - cons.push_back(resp_lift(cenv, code, *i)); - closureT.push_back(cenv.type(*i)); + for (auto v : freeVars) { + cons.push_back(resp_lift(cenv, code, v)); + closureT.push_back(cenv.type(v)); } // Now we know our real lifted return type @@ -207,18 +207,18 @@ lift_fn(CEnv& cenv, Code& code, const ATuple* fn) throw() cenv.def(cenv.penv.sym(cenv.name(fn)), fn, closureT, NULL); // Replace return type variable with actual return type in type environment - for (TEnv::iterator i = cenv.tenv.begin(); i != cenv.tenv.end(); ++i) { - for (TEnv::Frame::iterator j = i->begin(); j != i->end(); ++j) { - if (j->second->to_tuple()) { - j->second = j->second->as_tuple()->replace(retTVar, implRetT); + for (auto& i : cenv.tenv) { + for (auto& j : i) { + if (j.second->to_tuple()) { + j.second = j.second->as_tuple()->replace(retTVar, implRetT); } } } // Replace return type variable with actual return type in code - for (Code::iterator i = code.begin(); i != code.end(); ++i) { - if (is_form(*i, "def-type")) { - *i = cenv.typedReplace((*i)->as_tuple(), retTVar, implRetT); + for (auto& i : code) { + if (is_form(i, "def-type")) { + i = cenv.typedReplace(i->as_tuple(), retTVar, implRetT); } } @@ -231,8 +231,8 @@ lift_call(CEnv& cenv, Code& code, const ATuple* call) throw() List copy; // Lift all children (callee and arguments, recursively) - for (ATuple::const_iterator i = call->begin(); i != call->end(); ++i) - copy.push_back(resp_lift(cenv, code, *i)); + for (auto i : *call) + copy.push_back(resp_lift(cenv, code, i)); copy.head->loc = call->loc; |