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

Document formatted

This commit is contained in:
Brian Fiete 2020-03-25 11:57:51 -07:00
parent 19e53801f1
commit 118f819cc3

View file

@ -199,7 +199,7 @@ BfAstNode* BfReducer::Fail(const StringImpl& errorMsg, BfAstNode* refNode)
if (mPassInstance->HasLastFailedAt(refNode)) // No duplicate failures if (mPassInstance->HasLastFailedAt(refNode)) // No duplicate failures
return NULL; return NULL;
auto error = mPassInstance->Fail(errorMsg, refNode); auto error = mPassInstance->Fail(errorMsg, refNode);
if ((error != NULL) && (mSource != NULL)) if ((error != NULL) && (mSource != NULL))
error->mProject = mSource->mProject; error->mProject = mSource->mProject;
return NULL; return NULL;
} }
@ -1266,10 +1266,10 @@ BfExpression* BfReducer::CheckBinaryOperatorPrecedence(BfBinaryOperatorExpressio
break; break;
} }
if (auto leftBinaryExpr = BfNodeDynCast<BfBinaryOperatorExpression>(checkBinOpExpression->mLeft)) if (auto leftBinaryExpr = BfNodeDynCast<BfBinaryOperatorExpression>(checkBinOpExpression->mLeft))
{ {
deferredChecks.push_back(leftBinaryExpr); deferredChecks.push_back(leftBinaryExpr);
} }
} }
checkBinOpExpression = nextBinaryOperatorExpression; checkBinOpExpression = nextBinaryOperatorExpression;
@ -2098,15 +2098,15 @@ BfExpression* BfReducer::CreateExpression(BfAstNode* node, CreateExprFlags creat
} }
} }
// static int sItrIdx = 0; // static int sItrIdx = 0;
// sItrIdx++; // sItrIdx++;
// int itrIdx = sItrIdx; // int itrIdx = sItrIdx;
// if (itrIdx == 197) // if (itrIdx == 197)
// { // {
// NOP; // NOP;
// } // }
// BfParenthesizedExpression or BfTupleExpression // BfParenthesizedExpression or BfTupleExpression
SetAndRestoreValue<bool> prevInParenExpr(mInParenExpr, true); SetAndRestoreValue<bool> prevInParenExpr(mInParenExpr, true);
auto innerExpr = CreateExpressionAfter(tokenNode, CreateExprFlags_AllowVariableDecl); auto innerExpr = CreateExpressionAfter(tokenNode, CreateExprFlags_AllowVariableDecl);
if (innerExpr == NULL) if (innerExpr == NULL)
@ -6125,14 +6125,14 @@ void BfReducer::ReadPropertyBlock(BfPropertyDeclaration* propertyDeclaration, Bf
} }
if (accessorName == "get") if (accessorName == "get")
{ {
// if (hadGet) // if (hadGet)
// Fail("Only one 'get' method can be specified", accessorIdentifier); // Fail("Only one 'get' method can be specified", accessorIdentifier);
hadGet = true; hadGet = true;
} }
else if (accessorName == "set") else if (accessorName == "set")
{ {
// if (hadSet) // if (hadSet)
// Fail("Only one 'set' method can be specified", accessorIdentifier); // Fail("Only one 'set' method can be specified", accessorIdentifier);
hadSet = true; hadSet = true;
} }
else else
@ -7616,7 +7616,7 @@ BfAstNode* BfReducer::CreateTopLevelObject(BfTokenNode* tokenNode, BfAttributeDi
isSimpleEnum = true; isSimpleEnum = true;
} }
break; break;
} }
checkReadPos++; checkReadPos++;
@ -8294,7 +8294,7 @@ BfTokenNode* BfReducer::BreakDoubleChevron(BfTokenNode* tokenNode)
tokenNode->GetSrcPositions(triviaStart, srcStart, srcEnd); tokenNode->GetSrcPositions(triviaStart, srcStart, srcEnd);
firstChevron->Init(triviaStart, srcStart, srcEnd - 1); firstChevron->Init(triviaStart, srcStart, srcEnd - 1);
tokenNode->SetToken(BfToken_RChevron); tokenNode->SetToken(BfToken_RChevron);
tokenNode->SetSrcStart(srcStart + 1); tokenNode->SetSrcStart(srcStart + 1);
tokenNode->SetTriviaStart(srcStart); tokenNode->SetTriviaStart(srcStart);
@ -8477,12 +8477,12 @@ BfTokenNode* BfReducer::ParseMethodParams(BfAstNode* node, SizedArrayImpl<BfPara
{ {
mVisitorPos.MoveNext(); mVisitorPos.MoveNext();
attributes = CreateAttributeDirective(tokenNode); attributes = CreateAttributeDirective(tokenNode);
if (attributes != NULL) if (attributes != NULL)
{ {
nameAfterNode = attributes; nameAfterNode = attributes;
auto nextNode = mVisitorPos.GetNext(); auto nextNode = mVisitorPos.GetNext();
tokenNode = BfNodeDynCast<BfTokenNode>(nextNode); tokenNode = BfNodeDynCast<BfTokenNode>(nextNode);
} }
} }
int paramStartReadPos = mVisitorPos.mReadPos; int paramStartReadPos = mVisitorPos.mReadPos;
@ -9098,49 +9098,49 @@ BfGenericConstraintsDeclaration* BfReducer::CreateGenericConstraintsDeclaration(
addToConstraint = true; addToConstraint = true;
break; break;
case BfToken_Operator: case BfToken_Operator:
{
BfGenericOperatorConstraint* opConstraint = mAlloc->Alloc<BfGenericOperatorConstraint>();
constraintNode = opConstraint;
ReplaceNode(constraintToken, opConstraint);
MEMBER_SET(opConstraint, mOperatorToken, constraintToken);
mVisitorPos.MoveNext();
auto opToken = BfNodeDynCast<BfTokenNode>(mVisitorPos.GetNext());
if (opToken == NULL)
{ {
BfGenericOperatorConstraint* opConstraint = mAlloc->Alloc<BfGenericOperatorConstraint>(); auto typeRef = CreateTypeRefAfter(opConstraint, BfReducer::CreateTypeRefFlags_SafeGenericParse);
constraintNode = opConstraint;
ReplaceNode(constraintToken, opConstraint);
MEMBER_SET(opConstraint, mOperatorToken, constraintToken);
mVisitorPos.MoveNext();
auto opToken = BfNodeDynCast<BfTokenNode>(mVisitorPos.GetNext());
if (opToken == NULL)
{
auto typeRef = CreateTypeRefAfter(opConstraint, BfReducer::CreateTypeRefFlags_SafeGenericParse);
if (typeRef == NULL)
break;
MEMBER_SET(opConstraint, mLeftType, typeRef);
opToken = BfNodeDynCast<BfTokenNode>(mVisitorPos.GetNext());
if (opToken == NULL)
{
if (auto pointerTypeRef = BfNodeDynCast<BfPointerTypeRef>(typeRef))
{
MEMBER_SET(opConstraint, mLeftType, pointerTypeRef->mElementType);
opToken = pointerTypeRef->mStarNode;
MEMBER_SET(opConstraint, mOpToken, opToken);
}
}
}
if (opConstraint->mOpToken == NULL)
{
if (opToken == NULL)
break;
MEMBER_SET(opConstraint, mOpToken, opToken);
mVisitorPos.MoveNext();
}
auto typeRef = CreateTypeRefAfter(opConstraint);
if (typeRef == NULL) if (typeRef == NULL)
break; break;
MEMBER_SET(opConstraint, mRightType, typeRef); MEMBER_SET(opConstraint, mLeftType, typeRef);
opToken = BfNodeDynCast<BfTokenNode>(mVisitorPos.GetNext());
if (opToken == NULL)
{
if (auto pointerTypeRef = BfNodeDynCast<BfPointerTypeRef>(typeRef))
{
MEMBER_SET(opConstraint, mLeftType, pointerTypeRef->mElementType);
opToken = pointerTypeRef->mStarNode;
MEMBER_SET(opConstraint, mOpToken, opToken);
}
}
} }
break;
if (opConstraint->mOpToken == NULL)
{
if (opToken == NULL)
break;
MEMBER_SET(opConstraint, mOpToken, opToken);
mVisitorPos.MoveNext();
}
auto typeRef = CreateTypeRefAfter(opConstraint);
if (typeRef == NULL)
break;
MEMBER_SET(opConstraint, mRightType, typeRef);
}
break;
default: break; default: break;
} }