mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Allow calling convention attributes
This commit is contained in:
parent
096ade7614
commit
b9908cb4a8
11 changed files with 240 additions and 93 deletions
|
@ -281,9 +281,52 @@ bool BfReducer::IsTypeReference(BfAstNode* checkNode, BfToken successToken, int*
|
|||
|
||||
int endNode = -1;
|
||||
|
||||
bool failed = false;
|
||||
|
||||
// Return type
|
||||
auto checkNode = mVisitorPos.GetCurrent();
|
||||
if ((checkNode == NULL) || (!IsTypeReference(checkNode, BfToken_LParen, &endNode, couldBeExpr, isGenericType, isTuple)))
|
||||
if (auto checkToken = BfNodeDynCast<BfTokenNode>(checkNode))
|
||||
{
|
||||
if (checkToken->mToken == BfToken_LBracket)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
mVisitorPos.mReadPos++;
|
||||
checkNode = mVisitorPos.GetCurrent();
|
||||
if (checkNode == NULL)
|
||||
{
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (BfNodeIsA<BfBlock>(checkNode))
|
||||
{
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (checkToken = BfNodeDynCast<BfTokenNode>(checkNode))
|
||||
{
|
||||
if (checkToken->mToken == BfToken_RBracket)
|
||||
{
|
||||
mVisitorPos.mReadPos++;
|
||||
checkNode = mVisitorPos.GetCurrent();
|
||||
break;
|
||||
}
|
||||
if ((checkToken->mToken != BfToken_Comma) &&
|
||||
(checkToken->mToken != BfToken_Dot) &&
|
||||
(checkToken->mToken != BfToken_LParen) &&
|
||||
(checkToken->mToken != BfToken_RParen))
|
||||
{
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((failed) || (checkNode == NULL) || (!IsTypeReference(checkNode, BfToken_LParen, &endNode, couldBeExpr, isGenericType, isTuple)))
|
||||
{
|
||||
if (outEndNode != NULL)
|
||||
*outEndNode = endNode;
|
||||
|
@ -4806,6 +4849,14 @@ BfTypeReference* BfReducer::DoCreateTypeRef(BfAstNode* firstNode, CreateTypeRefF
|
|||
ReplaceNode(firstNode, delegateTypeRef);
|
||||
MEMBER_SET(delegateTypeRef, mTypeToken, tokenNode);
|
||||
|
||||
auto nextToken = BfNodeDynCast<BfTokenNode>(mVisitorPos.GetNext());
|
||||
if ((nextToken != NULL) && (nextToken->mToken == BfToken_LBracket))
|
||||
{
|
||||
mVisitorPos.MoveNext();
|
||||
auto attribs = CreateAttributeDirective(nextToken);
|
||||
MEMBER_SET_CHECKED(delegateTypeRef, mAttributes, attribs);
|
||||
}
|
||||
|
||||
auto returnType = CreateTypeRefAfter(delegateTypeRef);
|
||||
MEMBER_SET_CHECKED(delegateTypeRef, mReturnType, returnType);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue