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

Start of compile-time function evaluation

This commit is contained in:
Brian Fiete 2020-12-13 08:04:42 -08:00
parent 350516fae3
commit 577e199dcd
17 changed files with 2437 additions and 29 deletions

View file

@ -3950,7 +3950,7 @@ void BfModule::Visit(BfDeleteStatement* deleteStmt)
if (!mCompiler->IsAutocomplete())
AssertErrorState();
}
else if (!mCompiler->IsSkippingExtraResolveChecks())
else if (!IsSkippingExtraResolveChecks())
{
BfMethodInstance* methodInstance = objectType->mVirtualMethodTable[mCompiler->GetVTableMethodOffset() + 0].mImplementingMethod;
BF_ASSERT(methodInstance->mMethodDef->mName == "~this");
@ -5998,7 +5998,7 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
SizedArray<BfIRValue, 1> args;
auto castedTarget = Cast(forEachStmt->mCollectionExpression, target, getEnumeratorMethod.mMethodInstance->GetOwner());
exprEvaluator.PushThis(forEachStmt->mCollectionExpression, castedTarget, getEnumeratorMethod.mMethodInstance, args);
itr = exprEvaluator.CreateCall(getEnumeratorMethod.mMethodInstance, mCompiler->IsSkippingExtraResolveChecks() ? BfIRValue() : getEnumeratorMethod.mFunc, false, args);
itr = exprEvaluator.CreateCall(getEnumeratorMethod.mMethodInstance, IsSkippingExtraResolveChecks() ? BfIRValue() : getEnumeratorMethod.mFunc, false, args);
}
}