diff --git a/include/inference.h b/include/inference.h index 46a1fcd..3ec5b21 100644 --- a/include/inference.h +++ b/include/inference.h @@ -391,6 +391,8 @@ class TypeSystem { typedef TSymbol* TSelector; + InferContext* findBlockContext(std::size_t contextIndex) const; + InferContext* inferMessage( TSelector selector, const Type& arguments, diff --git a/src/TypeAnalyzer.cpp b/src/TypeAnalyzer.cpp index 34f8f3b..f447000 100644 --- a/src/TypeAnalyzer.cpp +++ b/src/TypeAnalyzer.cpp @@ -1485,3 +1485,15 @@ void type::TypeSystem::drawCallGraph() const { stream << "}\n"; stream.close(); } + +type::InferContext* type::TypeSystem::findBlockContext(std::size_t contextIndex) const +{ + TBlockCache::const_iterator iContext = m_blockCache.begin(); + for (; iContext != m_blockCache.end(); ++iContext) { + InferContext* const candidate = iContext->second; + if (candidate->getIndex() == contextIndex) + return candidate; + } + + return 0; +}