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

Handle cast of function bind

This commit is contained in:
Brian Fiete 2020-09-11 23:18:20 -07:00
parent 4ecd7861d6
commit 578e513196

View file

@ -1978,10 +1978,18 @@ BfExpression* BfReducer::CreateExpression(BfAstNode* node, CreateExprFlags creat
endNode = mVisitorPos.Get(endNodeIdx);
if (auto endToken = BfNodeDynCast<BfTokenNode>(endNode))
{
bool isLambda = false;
if (endToken->GetToken() == BfToken_FatArrow)
{
return CreateLambdaBindExpression(NULL, tokenNode);
isLambda = true;
if (auto innerToken = BfNodeDynCast<BfTokenNode>(mVisitorPos.GetNext()))
{
// Specifically we're looking for a (function ...) cast, but any token here means it's not a lambda
isLambda = false;
}
}
if (isLambda)
return CreateLambdaBindExpression(NULL, tokenNode);
}
}
}