mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Properly colorize type declarations
This commit is contained in:
parent
c5f610bae2
commit
8868d3216e
2 changed files with 29 additions and 1 deletions
|
@ -3946,7 +3946,14 @@ void BfCompiler::ProcessAutocompleteTempType()
|
||||||
if ((typeInst->mModule != NULL) && (!typeInst->mModule->mIsScratchModule))
|
if ((typeInst->mModule != NULL) && (!typeInst->mModule->mIsScratchModule))
|
||||||
mLastAutocompleteModule = typeInst->mModule;
|
mLastAutocompleteModule = typeInst->mModule;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
BfSourceElementType elemType = BfSourceElementType_Type;
|
||||||
|
if (typeInst->IsInterface())
|
||||||
|
elemType = BfSourceElementType_Interface;
|
||||||
|
else if (typeInst->IsObject())
|
||||||
|
elemType = BfSourceElementType_RefType;
|
||||||
|
mResolvePassData->mSourceClassifier->SetElementType(tempTypeDef->mTypeDeclaration->mNameNode, elemType);
|
||||||
|
|
||||||
SetAndRestoreValue<BfTypeInstance*> prevType(module->mCurTypeInstance, typeInst);
|
SetAndRestoreValue<BfTypeInstance*> prevType(module->mCurTypeInstance, typeInst);
|
||||||
typeState.mTypeInstance = typeInst;
|
typeState.mTypeInstance = typeInst;
|
||||||
|
|
||||||
|
|
|
@ -3739,6 +3739,27 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
if (typeInstance == mContext->mBfObjectType)
|
if (typeInstance == mContext->mBfObjectType)
|
||||||
typeInstance->mHasBeenInstantiated = true;
|
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)
|
if (populateType == BfPopulateType_Data)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue