mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-16 15:24:10 +02:00
Improved auto-ctor formatting
This commit is contained in:
parent
7057bcd099
commit
73265d82dd
1 changed files with 19 additions and 4 deletions
|
@ -2459,7 +2459,8 @@ void BfPrinter::Visit(BfConstructorDeclaration* ctorDeclaration)
|
||||||
{
|
{
|
||||||
//Visit((BfAstNode*)ctorDeclaration);
|
//Visit((BfAstNode*)ctorDeclaration);
|
||||||
|
|
||||||
ExpectNewLine();
|
if (!ctorDeclaration->IsA<BfAutoConstructorDeclaration>())
|
||||||
|
ExpectNewLine();
|
||||||
if (ctorDeclaration->mAttributes != NULL)
|
if (ctorDeclaration->mAttributes != NULL)
|
||||||
{
|
{
|
||||||
QueueVisitChild(ctorDeclaration->mAttributes);
|
QueueVisitChild(ctorDeclaration->mAttributes);
|
||||||
|
@ -3010,18 +3011,32 @@ void BfPrinter::Visit(BfTypeDeclaration* typeDeclaration)
|
||||||
ExpectSpace();
|
ExpectSpace();
|
||||||
QueueVisitChild(typeDeclaration->mNameNode);
|
QueueVisitChild(typeDeclaration->mNameNode);
|
||||||
QueueVisitChild(typeDeclaration->mGenericParams);
|
QueueVisitChild(typeDeclaration->mGenericParams);
|
||||||
QueueVisitChild(typeDeclaration->mAutoCtor);
|
|
||||||
if (typeDeclaration->mColonToken != NULL)
|
if (typeDeclaration->mColonToken != NULL)
|
||||||
{
|
{
|
||||||
ExpectSpace();
|
ExpectSpace();
|
||||||
QueueVisitChild(typeDeclaration->mColonToken);
|
QueueVisitChild(typeDeclaration->mColonToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeDeclaration->mAutoCtor != NULL)
|
||||||
|
{
|
||||||
|
ExpectSpace();
|
||||||
|
QueueVisitChild(typeDeclaration->mAutoCtor);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeDeclaration->mColonToken != NULL)
|
||||||
|
{
|
||||||
|
int nextCommaIdx = -1;
|
||||||
|
if (typeDeclaration->mAutoCtor != NULL)
|
||||||
|
nextCommaIdx++;
|
||||||
|
|
||||||
for (int i = 0; i < (int)typeDeclaration->mBaseClasses.size(); i++)
|
for (int i = 0; i < (int)typeDeclaration->mBaseClasses.size(); i++)
|
||||||
{
|
{
|
||||||
ExpectSpace();
|
ExpectSpace();
|
||||||
QueueVisitChild(typeDeclaration->mBaseClasses[i]);
|
QueueVisitChild(typeDeclaration->mBaseClasses[i]);
|
||||||
if (i > 0)
|
if (nextCommaIdx >= 0)
|
||||||
{
|
{
|
||||||
QueueVisitChild(typeDeclaration->mBaseClassCommas.GetSafe(i - 1));
|
QueueVisitChild(typeDeclaration->mBaseClassCommas.GetSafe(nextCommaIdx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ExpectSpace();
|
ExpectSpace();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue