diff --git a/IDEHelper/Compiler/BfPrinter.cpp b/IDEHelper/Compiler/BfPrinter.cpp index 2c27ae6e..dd8442d7 100644 --- a/IDEHelper/Compiler/BfPrinter.cpp +++ b/IDEHelper/Compiler/BfPrinter.cpp @@ -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); diff --git a/IDEHelper/Compiler/BfPrinter.h b/IDEHelper/Compiler/BfPrinter.h index d37f9dc6..0ee568b6 100644 --- a/IDEHelper/Compiler/BfPrinter.h +++ b/IDEHelper/Compiler/BfPrinter.h @@ -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; diff --git a/IDEHelper/Compiler/BfReducer.cpp b/IDEHelper/Compiler/BfReducer.cpp index e17597a5..96175c4e 100644 --- a/IDEHelper/Compiler/BfReducer.cpp +++ b/IDEHelper/Compiler/BfReducer.cpp @@ -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) { @@ -8341,11 +8341,14 @@ bool BfReducer::CheckInlineTypeRefAttribute(BfAstNode* typeRef, BfAttributeDirec checkAttribute = checkAttribute->mNextAttribute; } - auto typeDecl = inlineTypeRef->mTypeDeclaration; - typeDecl->mTriviaStart = attributes->mTriviaStart; + auto typeDecl = inlineTypeRef->mTypeDeclaration; 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))