void AnalysisVisitor::visit(ast::ForExp & e) { logger.log(L"ForExp", e.getLocation()); loops.push(&e); dm.addBlock(Block::LOOP, &e); e.getVardec().accept(*this); dm.addBlock(Block::NORMAL, &e.getBody()); e.getBody().accept(*this); if (dm.requiresAnotherTrip()) { dm.finalizeBlock(); dm.addBlock(Block::NORMAL, &e.getBody()); e.getBody().accept(*this); if (dm.requiresAnotherTrip()) { std::wcerr << "Invalid forexp: types or refcount are not the same before and after the loop" << std::endl; } } dm.finalizeBlock(); dm.finalizeBlock(); loops.pop(); }
void SLintVisitor::visit(const ast::ForExp & e) { context.pushLoop(&e); auto range = preCheck(e); e.getVardec().accept(*this); e.getBody().accept(*this); postCheck(e, range); context.popLoop(); }
void GlobalsCollector::visit(ast::ForExp & e) { e.getVardec().accept(*this); e.getBody().accept(*this); }