1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Early code generation support

This commit is contained in:
Brian Fiete 2021-01-11 09:41:43 -08:00
parent 0b48a60592
commit 71d4dd0e90
26 changed files with 2422 additions and 1576 deletions

View file

@ -696,7 +696,8 @@ void BfTypeDef::ClearEmitted()
for (int methodIdx = (int)mMethods.size() - 1; methodIdx >= 0; methodIdx--)
{
auto methodDef = mMethods[methodIdx];
if ((methodDef->mMethodDeclaration != NULL) && (methodDef->mMethodDeclaration->IsEmitted()))
if ((methodDef->mAddedAfterEmit) ||
((methodDef->mMethodDeclaration != NULL) && (methodDef->mMethodDeclaration->IsEmitted())))
{
delete methodDef;
mMethods.RemoveAt(methodIdx);
@ -712,6 +713,16 @@ void BfTypeDef::ClearEmitted()
mFields.RemoveAt(fieldIdx);
}
}
for (int propIdx = (int)mProperties.size() - 1; propIdx >= 0; propIdx--)
{
auto propDef = mProperties[propIdx];
if ((propDef->mFieldDeclaration != NULL) && (propDef->mFieldDeclaration->IsEmitted()))
{
delete propDef;
mProperties.RemoveAt(propIdx);
}
}
}
}
@ -830,6 +841,16 @@ BfMethodDef* BfTypeDef::GetMethodByName(const StringImpl& name, int paramCount)
return NULL;
}
BfFieldDef* BfTypeDef::GetFieldByName(const StringImpl& name)
{
PopulateMemberSets();
BfFieldDef* nextField = NULL;
BfMemberSetEntry* entry;
if (mFieldSet.TryGetWith(name, &entry))
return (BfFieldDef*)entry->mMemberDef;
return NULL;
}
String BfTypeDef::ToString()
{
String typeName(mName->ToString());
@ -1753,7 +1774,7 @@ void BfPassInstance::TryFlushDeferredError()
if (moreInfo->mSource != NULL)
MessageAt(":error", " > " + moreInfo->mInfo, moreInfo->mSource, moreInfo->mSrcStart, moreInfo->mSrcEnd - moreInfo->mSrcStart);
else
OutputLine(":error" + moreInfo->mInfo);
OutputLine(":error " + moreInfo->mInfo);
}
}
}