Skip to content

Commit

Permalink
Adds TypeSystem::findBlockContext()
Browse files Browse the repository at this point in the history
Issue: #17
Issue: #92
  • Loading branch information
0x7CFE committed Jul 21, 2016
1 parent ee7d469 commit a532ac0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/inference.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ class TypeSystem {

typedef TSymbol* TSelector;

InferContext* findBlockContext(std::size_t contextIndex) const;

InferContext* inferMessage(
TSelector selector,
const Type& arguments,
Expand Down
12 changes: 12 additions & 0 deletions src/TypeAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit a532ac0

Please sign in to comment.