1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-22 09:38:01 +02:00

Fixed some classify flashing

This commit is contained in:
Brian Fiete 2020-09-14 11:54:54 -07:00
parent bbf76e0f53
commit ff56034eb2
3 changed files with 24 additions and 18 deletions

View file

@ -3757,9 +3757,12 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
} }
}; };
if (!typeInstance->IsBoxed())
{
_HandleTypeDeclaration(typeDef->mTypeDeclaration); _HandleTypeDeclaration(typeDef->mTypeDeclaration);
for (auto partial : typeDef->mPartials) for (auto partial : typeDef->mPartials)
_HandleTypeDeclaration(partial->mTypeDeclaration); _HandleTypeDeclaration(partial->mTypeDeclaration);
}
if (populateType == BfPopulateType_Data) if (populateType == BfPopulateType_Data)
return; return;

View file

@ -111,6 +111,9 @@ bool BfReducer::IsNodeRelevant(BfAstNode* astNode)
bool BfReducer::IsNodeRelevant(BfAstNode* startNode, BfAstNode* endNode) bool BfReducer::IsNodeRelevant(BfAstNode* startNode, BfAstNode* endNode)
{ {
if (startNode == NULL)
return IsNodeRelevant(endNode);
BfParser* bfParser = startNode->GetSourceData()->ToParser(); BfParser* bfParser = startNode->GetSourceData()->ToParser();
if (bfParser == NULL) if (bfParser == NULL)
return true; return true;
@ -5685,7 +5688,7 @@ BfFieldDeclaration* BfReducer::CreateFieldDeclaration(BfTokenNode* tokenNode, Bf
return fieldDeclaration; return fieldDeclaration;
} }
BfAstNode* BfReducer::ReadTypeMember(BfTokenNode* tokenNode, int depth) BfAstNode* BfReducer::ReadTypeMember(BfTokenNode* tokenNode, int depth, BfAstNode* deferredHeadNode)
{ {
BfToken token = tokenNode->GetToken(); BfToken token = tokenNode->GetToken();
@ -5706,7 +5709,7 @@ BfAstNode* BfReducer::ReadTypeMember(BfTokenNode* tokenNode, int depth)
} }
mVisitorPos.MoveNext(); mVisitorPos.MoveNext();
auto memberNode = ReadTypeMember(nextNode); auto memberNode = ReadTypeMember(nextNode, 0, (deferredHeadNode != NULL) ? deferredHeadNode : attributes);
if (memberNode == NULL) if (memberNode == NULL)
return NULL; return NULL;
auto member = BfNodeDynCast<BfMemberDeclaration>(memberNode); auto member = BfNodeDynCast<BfMemberDeclaration>(memberNode);
@ -5905,7 +5908,7 @@ BfAstNode* BfReducer::ReadTypeMember(BfTokenNode* tokenNode, int depth)
BfAstNode* startNode = mVisitorPos.GetCurrent(); BfAstNode* startNode = mVisitorPos.GetCurrent();
auto startToken = BfNodeDynCast<BfTokenNode>(startNode); auto startToken = BfNodeDynCast<BfTokenNode>(startNode);
auto topLevelObject = CreateTopLevelObject(startToken, NULL); auto topLevelObject = CreateTopLevelObject(startToken, NULL, deferredHeadNode);
auto typeDecl = BfNodeDynCast<BfTypeDeclaration>(topLevelObject); auto typeDecl = BfNodeDynCast<BfTypeDeclaration>(topLevelObject);
if (typeDecl == NULL) if (typeDecl == NULL)
{ {
@ -6392,7 +6395,7 @@ void BfReducer::ReadPropertyBlock(BfPropertyDeclaration* propertyDeclaration, Bf
} }
} }
BfAstNode* BfReducer::ReadTypeMember(BfAstNode* node, int depth) BfAstNode* BfReducer::ReadTypeMember(BfAstNode* node, int depth, BfAstNode* deferredHeadNode)
{ {
SetAndRestoreValue<BfAstNode*> prevTypeMemberNodeStart(mTypeMemberNodeStart, node, false); SetAndRestoreValue<BfAstNode*> prevTypeMemberNodeStart(mTypeMemberNodeStart, node, false);
if (depth == 0) if (depth == 0)
@ -6437,7 +6440,7 @@ BfAstNode* BfReducer::ReadTypeMember(BfAstNode* node, int depth)
// Read type member // Read type member
} }
else else
return ReadTypeMember(tokenNode, depth); return ReadTypeMember(tokenNode, depth, deferredHeadNode);
} }
else if (auto block = BfNodeDynCast<BfBlock>(node)) else if (auto block = BfNodeDynCast<BfBlock>(node))
{ {
@ -7796,7 +7799,7 @@ BfAstNode* BfReducer::HandleTopLevel(BfBlock* node)
return node; return node;
} }
BfAstNode* BfReducer::CreateTopLevelObject(BfTokenNode* tokenNode, BfAttributeDirective* attributes) BfAstNode* BfReducer::CreateTopLevelObject(BfTokenNode* tokenNode, BfAttributeDirective* attributes, BfAstNode* deferredHeadNode)
{ {
AssertCurrentNode(tokenNode); AssertCurrentNode(tokenNode);
@ -8024,7 +8027,7 @@ BfAstNode* BfReducer::CreateTopLevelObject(BfTokenNode* tokenNode, BfAttributeDi
MEMBER_SET(typeDeclaration, mDefineNode, block); MEMBER_SET(typeDeclaration, mDefineNode, block);
mVisitorPos.MoveNext(); mVisitorPos.MoveNext();
HandleTypeDeclaration(typeDeclaration, attributes); HandleTypeDeclaration(typeDeclaration, attributes, deferredHeadNode);
return typeDeclaration; return typeDeclaration;
} }
@ -8204,7 +8207,7 @@ BfAstNode* BfReducer::CreateTopLevelObject(BfTokenNode* tokenNode, BfAttributeDi
} }
} }
if (!IsNodeRelevant(typeDeclaration)) if (!IsNodeRelevant(deferredHeadNode, typeDeclaration))
typeDeclaration->mIgnoreDeclaration = true; typeDeclaration->mIgnoreDeclaration = true;
return typeDeclaration; return typeDeclaration;
@ -8319,7 +8322,7 @@ BfAstNode* BfReducer::CreateTopLevelObject(BfTokenNode* tokenNode, BfAttributeDi
{ {
typeDeclaration->mDefineNode = blockNode; typeDeclaration->mDefineNode = blockNode;
MoveNode(blockNode, typeDeclaration); MoveNode(blockNode, typeDeclaration);
HandleTypeDeclaration(typeDeclaration, attributes); HandleTypeDeclaration(typeDeclaration, attributes, (deferredHeadNode != NULL) ? deferredHeadNode : attributes);
} }
return typeDeclaration; return typeDeclaration;
@ -9526,7 +9529,7 @@ void BfReducer::HandleBlock(BfBlock* block, bool allowEndingExpression)
mVisitorPos.Trim(); mVisitorPos.Trim();
} }
void BfReducer::HandleTypeDeclaration(BfTypeDeclaration* typeDecl, BfAttributeDirective* attributes) void BfReducer::HandleTypeDeclaration(BfTypeDeclaration* typeDecl, BfAttributeDirective* attributes, BfAstNode* deferredHeadNode)
{ {
SetAndRestoreValue<BfTypeDeclaration*> prevTypeDecl(mCurTypeDecl, typeDecl); SetAndRestoreValue<BfTypeDeclaration*> prevTypeDecl(mCurTypeDecl, typeDecl);
SetAndRestoreValue<BfVisitorPos> prevVisitorPos(mVisitorPos, BfVisitorPos(BfNodeDynCast<BfBlock>(typeDecl->mDefineNode))); SetAndRestoreValue<BfVisitorPos> prevVisitorPos(mVisitorPos, BfVisitorPos(BfNodeDynCast<BfBlock>(typeDecl->mDefineNode)));
@ -9536,7 +9539,7 @@ void BfReducer::HandleTypeDeclaration(BfTypeDeclaration* typeDecl, BfAttributeDi
MEMBER_SET(typeDecl, mAttributes, attributes); MEMBER_SET(typeDecl, mAttributes, attributes);
} }
if (!IsNodeRelevant(typeDecl)) if (!IsNodeRelevant(deferredHeadNode, typeDecl))
{ {
typeDecl->mIgnoreDeclaration = true; typeDecl->mIgnoreDeclaration = true;
return; return;

View file

@ -184,8 +184,8 @@ public:
BfTokenNode* ParseMethodParams(BfAstNode* node, SizedArrayImpl<BfParameterDeclaration*>* params, SizedArrayImpl<BfTokenNode*>* commas, BfToken endToken, bool requireNames); BfTokenNode* ParseMethodParams(BfAstNode* node, SizedArrayImpl<BfParameterDeclaration*>* params, SizedArrayImpl<BfTokenNode*>* commas, BfToken endToken, bool requireNames);
BfTokenNode* ReadArguments(BfAstNode* parentNode, BfAstNode* afterNode, SizedArrayImpl<BfExpression*>* arguments, SizedArrayImpl<BfTokenNode*>* commas, BfToken endToken, bool allowSkippedArgs = false, CreateExprFlags createExprFlags = CreateExprFlags_None); BfTokenNode* ReadArguments(BfAstNode* parentNode, BfAstNode* afterNode, SizedArrayImpl<BfExpression*>* arguments, SizedArrayImpl<BfTokenNode*>* commas, BfToken endToken, bool allowSkippedArgs = false, CreateExprFlags createExprFlags = CreateExprFlags_None);
void ReadPropertyBlock(BfPropertyDeclaration* propertyDeclaration, BfBlock* block); void ReadPropertyBlock(BfPropertyDeclaration* propertyDeclaration, BfBlock* block);
BfAstNode* ReadTypeMember(BfTokenNode* node, int depth = 0); BfAstNode* ReadTypeMember(BfTokenNode* node, int depth = 0, BfAstNode* deferredHeadNode = NULL);
BfAstNode* ReadTypeMember(BfAstNode* node, int depth = 0); BfAstNode* ReadTypeMember(BfAstNode* node, int depth = 0, BfAstNode* deferredHeadNode = NULL);
BfIdentifierNode* CompactQualifiedName(BfAstNode* leftNode); BfIdentifierNode* CompactQualifiedName(BfAstNode* leftNode);
void TryIdentifierConvert(int readPos); void TryIdentifierConvert(int readPos);
void CreateQualifiedNames(BfAstNode* node); void CreateQualifiedNames(BfAstNode* node);
@ -231,12 +231,12 @@ public:
BfWhileStatement* CreateWhileStatement(BfAstNode* node); BfWhileStatement* CreateWhileStatement(BfAstNode* node);
BfDoStatement* CreateDoStatement(BfAstNode* node); BfDoStatement* CreateDoStatement(BfAstNode* node);
BfRepeatStatement* CreateRepeatStatement(BfAstNode* node); BfRepeatStatement* CreateRepeatStatement(BfAstNode* node);
BfAstNode* CreateTopLevelObject(BfTokenNode* tokenNode, BfAttributeDirective* attributes); BfAstNode* CreateTopLevelObject(BfTokenNode* tokenNode, BfAttributeDirective* attributes, BfAstNode* deferredHeadNode = NULL);
BfAstNode* HandleTopLevel(BfBlock* node); BfAstNode* HandleTopLevel(BfBlock* node);
BfInlineAsmStatement* CreateInlineAsmStatement(BfAstNode* asmNode); BfInlineAsmStatement* CreateInlineAsmStatement(BfAstNode* asmNode);
void HandleBlock(BfBlock* block, bool allowEndingExpression = false); void HandleBlock(BfBlock* block, bool allowEndingExpression = false);
void HandleTypeDeclaration(BfTypeDeclaration* typeDecl, BfAttributeDirective* attributes); void HandleTypeDeclaration(BfTypeDeclaration* typeDecl, BfAttributeDirective* attributes, BfAstNode* deferredHeadNode = NULL);
public: public:
BfReducer(); BfReducer();