Predict that constructors return KindOfNull

If we can't infer it, then predict it.
Esse commit está contido em:
Guilherme Ottoni
2013-05-14 05:44:43 -07:00
commit de Sara Golemon
commit c5e36d31af
+8 -2
Ver Arquivo
@@ -3427,13 +3427,19 @@ bool EmitterVisitor::visitImpl(ConstructPtr node) {
}
e.FCall(numParams);
if (Option::WholeProgram) {
bool inferred = false;
if (Option::WholeProgram && Option::GenerateInferredTypes) {
FunctionScopePtr fs = ne->getFuncScope();
if (fs && !fs->getReturnType()) {
m_evalStack.setKnownType(KindOfNull, false /* inferred */);
m_evalStack.setKnownType(KindOfNull, false /* it's inferred */);
m_evalStack.setNotRef();
inferred = true;
}
}
if (!inferred) {
m_evalStack.setKnownType(KindOfNull, true /* it's predicted */);
m_evalStack.setNotRef();
}
e.PopR();
return true;
}