1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Added '?' capture, reworked '&' capture, allow 'this' capture

This commit is contained in:
Brian Fiete 2023-03-17 08:38:45 -07:00
parent 7ab6800f40
commit 7f695596b8
5 changed files with 70 additions and 22 deletions

View file

@ -11925,10 +11925,21 @@ void BfModule::GetCustomAttributes(BfCustomAttributes* customAttributes, BfAttri
}
BfCaptureInfo::Entry captureEntry;
captureEntry.mCaptureType = (tokenNode->mToken == BfToken_Ampersand) ? BfCaptureType_Reference : BfCaptureType_Copy;
captureEntry.mRefNode = tokenNode;
captureEntry.mCaptureType = BfCaptureType_Copy;
if (tokenNode->mToken == BfToken_Ampersand)
captureEntry.mCaptureType = BfCaptureType_Reference;
if (tokenNode->mToken == BfToken_Question)
captureEntry.mCaptureType = BfCaptureType_Auto;
if (!attributesDirective->mArguments.IsEmpty())
{
captureEntry.mNameNode = BfNodeDynCast<BfIdentifierNode>(attributesDirective->mArguments[0]);
if (auto identifierNode = BfNodeDynCast<BfIdentifierNode>(attributesDirective->mArguments[0]))
captureEntry.mNameNode = identifierNode;
else if (auto thisExpr = BfNodeDynCast<BfThisExpression>(attributesDirective->mArguments[0]))
{
captureEntry.mNameNode = thisExpr;
}
if ((captureEntry.mNameNode != NULL) && (autoComplete != NULL))
autoComplete->CheckIdentifier(captureEntry.mNameNode);
}