1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Fixed empty return with lambda return type inference

This commit is contained in:
Brian Fiete 2021-02-28 12:56:02 -08:00
parent c598944f52
commit 97d9a4508d

View file

@ -4941,30 +4941,22 @@ void BfModule::Visit(BfReturnStatement* returnStmt)
if (returnStmt->mExpression == NULL)
{
MarkScopeLeft(&mCurMethodState->mHeadScope);
if (retType->IsVoid())
if ((retType != NULL) && (retType->IsVoid()))
{
EmitReturn(BfTypedValue());
return;
}
if (retType != NULL)
{
Fail("Expected return value", returnStmt);
return;
}
EmitReturn(GetDefaultTypedValue(retType));
return;
Fail("Expected return value", returnStmt);
if (retType != NULL)
EmitReturn(GetDefaultTypedValue(retType));
else
EmitReturn(BfTypedValue());
return;
}
BfType* expectingReturnType = retType;
if ((expectingReturnType != NULL) && (expectingReturnType->IsVar()))
{
NOP;
// expectingReturnType = NULL;
}
BfType* origType;
BfExprEvaluator exprEvaluator(this);
bool alreadyWritten = false;