mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Expanded const generic params to support structs
This commit is contained in:
parent
d9de51a019
commit
b80db38cdc
13 changed files with 443 additions and 36 deletions
|
@ -899,6 +899,13 @@ bool BfReducer::IsTypeReference(BfAstNode* checkNode, BfToken successToken, int
|
|||
{
|
||||
isDone = true;
|
||||
|
||||
auto prevNode = mVisitorPos.Get(checkIdx + 1);
|
||||
if (prevNode = BfNodeDynCast<BfLiteralExpression>(prevNode))
|
||||
{
|
||||
// Allow expressions like '3...'
|
||||
isDone = false;
|
||||
}
|
||||
|
||||
auto nextNode = mVisitorPos.Get(checkIdx + 1);
|
||||
if (auto nextToken = BfNodeDynCast<BfTokenNode>(nextNode))
|
||||
{
|
||||
|
@ -906,6 +913,10 @@ bool BfReducer::IsTypeReference(BfAstNode* checkNode, BfToken successToken, int
|
|||
isDone = false;
|
||||
}
|
||||
}
|
||||
else if ((checkToken == BfToken_Minus) && (chevronDepth > 0))
|
||||
{
|
||||
// Allow - literal
|
||||
}
|
||||
else if (checkToken != BfToken_LBracket)
|
||||
isDone = true;
|
||||
|
||||
|
@ -5341,14 +5352,20 @@ BfTypeReference* BfReducer::DoCreateTypeRef(BfAstNode* firstNode, CreateTypeRefF
|
|||
bool doAddType = genericIdentifier != NULL;
|
||||
bool addAsExpr = false;
|
||||
|
||||
//if (mCompatMode)
|
||||
if (BfNodeDynCast<BfLiteralExpression>(nextNode) != NULL)
|
||||
{
|
||||
if (BfNodeDynCast<BfLiteralExpression>(nextNode) != NULL)
|
||||
doAddType = true;
|
||||
addAsExpr = true;
|
||||
}
|
||||
else if (auto tokenNode = BfNodeDynCast<BfTokenNode>(nextNode))
|
||||
{
|
||||
if (tokenNode->mToken == BfToken_Minus)
|
||||
{
|
||||
doAddType = true;
|
||||
addAsExpr = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (genericIdentifier == NULL)
|
||||
{
|
||||
auto nextNode = mVisitorPos.GetNext();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue