mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fixed crash for lambda bind attempt outside method instance
This commit is contained in:
parent
36311cab2d
commit
24c91d373c
1 changed files with 5 additions and 1 deletions
|
@ -13427,7 +13427,11 @@ void BfExprEvaluator::Visit(BfLambdaBindExpression* lambdaBindExpr)
|
|||
BfTokenNode* newToken = NULL;
|
||||
BfAllocTarget allocTarget = ResolveAllocTarget(lambdaBindExpr->mNewToken, newToken);
|
||||
|
||||
if ((mModule->mCurMethodState != NULL) && (mModule->mCurMethodState->mClosureState != NULL) && (mModule->mCurMethodState->mClosureState->mBlindCapturing))
|
||||
if (mModule->mCurMethodInstance == NULL)
|
||||
mModule->Fail("Invalid use of lambda bind expression", lambdaBindExpr);
|
||||
|
||||
if (((mModule->mCurMethodState != NULL) && (mModule->mCurMethodState->mClosureState != NULL) && (mModule->mCurMethodState->mClosureState->mBlindCapturing)) ||
|
||||
(mModule->mCurMethodInstance == NULL))
|
||||
{
|
||||
// We're just capturing. We just need to visit the bodies here. This helps infinite recursion with local methods containing lambdas calling each other
|
||||
if (lambdaBindExpr->mBody != NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue