1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Properly colorize type declarations

This commit is contained in:
Brian Fiete 2020-08-23 06:45:14 -07:00
parent c5f610bae2
commit 8868d3216e
2 changed files with 29 additions and 1 deletions

View file

@ -3739,6 +3739,27 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
if (typeInstance == mContext->mBfObjectType)
typeInstance->mHasBeenInstantiated = true;
auto _HandleTypeDeclaration = [&](BfTypeDeclaration* typeDeclaration)
{
if ((typeDeclaration != NULL) && (typeDeclaration->mNameNode != NULL))
{
auto typeRefSource = typeDeclaration->mNameNode->GetParserData();
if ((mCompiler->mResolvePassData != NULL) && (mCompiler->mResolvePassData->mSourceClassifier != NULL) && (typeRefSource != NULL) && (typeRefSource == mCompiler->mResolvePassData->mParser->mSourceData))
{
BfSourceElementType elemType = BfSourceElementType_Type;
if (typeInstance->IsInterface())
elemType = BfSourceElementType_Interface;
else if (typeInstance->IsObject())
elemType = BfSourceElementType_RefType;
mCompiler->mResolvePassData->mSourceClassifier->SetElementType(typeDeclaration->mNameNode, elemType);
}
}
};
_HandleTypeDeclaration(typeDef->mTypeDeclaration);
for (auto partial : typeDef->mPartials)
_HandleTypeDeclaration(partial->mTypeDeclaration);
if (populateType == BfPopulateType_Data)
return;