Skip to content

Commit

Permalink
Adds special handling of messages that do not return normally
Browse files Browse the repository at this point in the history
Some methods like Object>>error: do not return a value in a usual way.
In that case control flow is interrupted and all call chain aborts.

Type analyzer uses an empty composite type () to mark such special case.
Please note that () is not equal to * or ? types that still return a value.

Issue: #17
Issue: #92
  • Loading branch information
0x7CFE committed Jul 1, 2016
1 parent 5b7bcb5 commit 8290467
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/TypeAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@ void TypeAnalyzer::doSendBinary(InstructionNode& instruction) {
if (InferContext* const context = m_system.inferMessage(selector, arguments, &m_contextStack)) {
result = context->getReturnType();
m_context.getReferredContexts().insert(context);

if (result == Type(Type::tkComposite))
m_walker.addStopNode(*instruction.getOutEdges().begin());
} else {
result = Type(Type::tkPolytype);
}
Expand Down Expand Up @@ -863,6 +866,9 @@ void TypeAnalyzer::doSendMessage(InstructionNode& instruction, bool sendToSuper
if (InferContext* const context = m_system.inferMessage(selector, arguments, &m_contextStack, sendToSuper)) {
result = context->getReturnType();
m_context.getReferredContexts().insert(context);

if (result == Type(Type::tkComposite))
m_walker.addStopNode(*instruction.getOutEdges().begin());
} else {
result = Type(Type::tkPolytype);
}
Expand Down

0 comments on commit 8290467

Please sign in to comment.