mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-02 14:25:59 +02:00
Fixes anonymous type formatting
This commit is contained in:
parent
b3cf2a0d04
commit
546c4d7e7e
3 changed files with 21 additions and 10 deletions
|
@ -1728,12 +1728,17 @@ void BfPrinter::Visit(BfPointerTypeRef* ptrType)
|
|||
|
||||
void BfPrinter::Visit(BfNullableTypeRef* ptrType)
|
||||
{
|
||||
Visit((BfAstNode*) ptrType);
|
||||
Visit((BfAstNode*)ptrType);
|
||||
|
||||
VisitChild(ptrType->mElementType);
|
||||
VisitChild(ptrType->mQuestionToken);
|
||||
}
|
||||
|
||||
void BfPrinter::Visit(BfInlineTypeReference* typeRef)
|
||||
{
|
||||
VisitChild(typeRef->mTypeDeclaration);
|
||||
}
|
||||
|
||||
void BfPrinter::Visit(BfVariableDeclaration* varDecl)
|
||||
{
|
||||
//Visit(varDecl->ToBase());
|
||||
|
@ -2901,6 +2906,7 @@ void BfPrinter::Visit(BfFieldDeclaration* fieldDeclaration)
|
|||
ExpectSpace();
|
||||
if (isEnumDecl)
|
||||
mNextStateModify.mExpectingSpace = false;
|
||||
|
||||
QueueVisitChild(fieldDeclaration->mTypeRef);
|
||||
ExpectSpace();
|
||||
QueueVisitChild(fieldDeclaration->mNameNode);
|
||||
|
|
|
@ -171,6 +171,7 @@ public:
|
|||
virtual void Visit(BfDelegateTypeRef* typeRef) override;
|
||||
virtual void Visit(BfPointerTypeRef* typeRef) override;
|
||||
virtual void Visit(BfNullableTypeRef* typeRef) override;
|
||||
virtual void Visit(BfInlineTypeReference* typeRef) override;
|
||||
virtual void Visit(BfVariableDeclaration* varDecl) override;
|
||||
virtual void Visit(BfParameterDeclaration* paramDecl) override;
|
||||
virtual void Visit(BfTypeOfExpression* typeOfExpr) override;
|
||||
|
|
|
@ -147,15 +147,15 @@ void BfReducer::MoveNode(BfAstNode* srcNode, BfAstNode* newOwner)
|
|||
#ifdef BF_AST_HAS_PARENT_MEMBER
|
||||
srcNode->mParent = newOwner;
|
||||
#endif
|
||||
int srcStart = srcNode->GetSrcStart();
|
||||
int srcEnd = srcNode->GetSrcEnd();
|
||||
if (srcStart < newOwner->GetSrcStart())
|
||||
newOwner->SetSrcStart(srcStart);
|
||||
if (srcEnd > newOwner->GetSrcEnd())
|
||||
newOwner->SetSrcEnd(srcEnd);
|
||||
int srcStart = srcNode->mSrcStart;
|
||||
int srcEnd = srcNode->mSrcEnd;
|
||||
if (srcStart < newOwner->mSrcStart)
|
||||
newOwner->mSrcStart = srcStart;
|
||||
if (srcEnd > newOwner->mSrcEnd)
|
||||
newOwner->mSrcEnd = srcEnd;
|
||||
}
|
||||
|
||||
// Replaces prevNode with new node and adds prevNode to newNode's childrenj
|
||||
// Replaces prevNode with new node and adds prevNode to newNode's children
|
||||
// It can be considered that newNode encapsulated prevNode.
|
||||
void BfReducer::ReplaceNode(BfAstNode* prevNode, BfAstNode* newNode)
|
||||
{
|
||||
|
@ -8342,10 +8342,13 @@ bool BfReducer::CheckInlineTypeRefAttribute(BfAstNode* typeRef, BfAttributeDirec
|
|||
}
|
||||
|
||||
auto typeDecl = inlineTypeRef->mTypeDeclaration;
|
||||
typeDecl->mTriviaStart = attributes->mTriviaStart;
|
||||
typeDecl->mSrcStart = attributes->mSrcStart;
|
||||
typeDecl->mTriviaStart = typeDecl->mSrcStart;
|
||||
typeDecl->mAttributes = attributes;
|
||||
|
||||
inlineTypeRef->mTriviaStart = attributes->mTriviaStart;
|
||||
inlineTypeRef->mSrcStart = attributes->mSrcStart;
|
||||
|
||||
if ((typeDecl->mIgnoreDeclaration) && (IsNodeRelevant(typeDecl)))
|
||||
typeDecl->mIgnoreDeclaration = false;
|
||||
|
||||
|
@ -11178,6 +11181,7 @@ void BfReducer::HandleTypeDeclaration(BfTypeDeclaration* typeDecl, BfAttributeDi
|
|||
if (attributes != NULL)
|
||||
{
|
||||
MEMBER_SET(typeDecl, mAttributes, attributes);
|
||||
typeDecl->mTriviaStart = BF_MIN(typeDecl->mAttributes->mTriviaStart, attributes->mTriviaStart);
|
||||
}
|
||||
|
||||
if ((!IsNodeRelevant(deferredHeadNode, typeDecl)) && (!typeDecl->IsTemporary()) && (!findInitializer))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue