1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 20:12:21 +02:00

Causing full refresh in IDE when deleting types

This commit is contained in:
Brian Fiete 2020-01-25 06:21:46 -08:00
parent ed1cf60bb9
commit 730ae877fa
3 changed files with 11 additions and 7 deletions

View file

@ -1785,6 +1785,7 @@ void BfContext::UpdateRevisedTypes()
if (typeDef->mDefState == BfTypeDef::DefState_Deleted) if (typeDef->mDefState == BfTypeDef::DefState_Deleted)
{ {
HandleChangedTypeDef(typeDef);
DeleteType(typeInst); DeleteType(typeInst);
continue; continue;
} }

View file

@ -13596,7 +13596,7 @@ void BfModule::EmitDtorBody()
UpdateSrcPos(typeDef->mTypeDeclaration); UpdateSrcPos(typeDef->mTypeDeclaration);
if ((methodDeclaration != NULL) && (methodDeclaration->mFatArrowToken != NULL)) if ((methodDeclaration != NULL) && (methodDeclaration->mFatArrowToken != NULL))
{ {
Fail("Destructors cannot have expression bodies", methodDeclaration->mFatArrowToken); Fail("Destructors cannot have expression bodies", methodDeclaration->mFatArrowToken, true);
} }
} }
@ -13610,7 +13610,7 @@ void BfModule::EmitDtorBody()
{ {
if ((!methodDef->mIsStatic) && (mCurTypeInstance->IsValueType())) if ((!methodDef->mIsStatic) && (mCurTypeInstance->IsValueType()))
{ {
Fail("Structs cannot have field destructors", fieldDef->mFieldDeclaration->mFieldDtor->mTildeToken); Fail("Structs cannot have field destructors", fieldDef->mFieldDeclaration->mFieldDtor->mTildeToken, true);
} }
SetAndRestoreValue<BfFilePosition> prevFilePos(mCurFilePosition); SetAndRestoreValue<BfFilePosition> prevFilePos(mCurFilePosition);
@ -13650,7 +13650,7 @@ void BfModule::EmitDtorBody()
else else
{ {
AssertErrorState(); AssertErrorState();
value = mBfIRBuilder->CreateConstNull(mBfIRBuilder->GetPointerTo(mBfIRBuilder->MapType(fieldInst->mResolvedType))); value = mBfIRBuilder->CreateAlloca(mBfIRBuilder->MapType(fieldInst->mResolvedType));
} }
} }
@ -13771,6 +13771,8 @@ void BfModule::EmitDtorBody()
if ((curFieldDef != NULL) && (fieldDef->mName == curFieldDef->mName)) if ((curFieldDef != NULL) && (fieldDef->mName == curFieldDef->mName))
fieldType = curFieldInstance->GetResolvedType(); fieldType = curFieldInstance->GetResolvedType();
} }
if (fieldType == NULL)
fieldType = GetPrimitiveType(BfTypeCode_Var);
auto fieldDtor = fieldDef->mFieldDeclaration->mFieldDtor; auto fieldDtor = fieldDef->mFieldDeclaration->mFieldDtor;

View file

@ -853,9 +853,10 @@ bool BfTypeDef::HasSource(BfSource* source)
{ {
if (mNextRevision != NULL) if (mNextRevision != NULL)
return mNextRevision->HasSource(source); return mNextRevision->HasSource(source);
if (mSource == source) if (mSource == source)
return true; return true;
if ((mSource != NULL) && (mSource->mNextRevision != NULL) && (mSource->mNextRevision == source))
return true;
for (auto partial : mPartials) for (auto partial : mPartials)
if (partial->mSource == source) if (partial->mSource == source)
return true; return true;