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

Added ability to put Main method in an anonymous static section

This commit is contained in:
Brian Fiete 2020-09-22 15:39:14 -07:00
parent 9a7bb95107
commit 125f7b85a7
3 changed files with 20 additions and 9 deletions

View file

@ -1792,7 +1792,8 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
bool hadRet = false;
String entryClassName = project->mStartupObject;
typeDef = mSystem->FindTypeDef(entryClassName, 0, bfModule->mProject);
typeDef = mSystem->FindTypeDef(entryClassName, 0, bfModule->mProject, {}, NULL, BfFindTypeDefFlag_AllowGlobal);
if (typeDef != NULL)
{
auto type = bfModule->ResolveTypeDef(typeDef);
@ -1911,7 +1912,10 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
}
else
{
mPassInstance->Fail(StrFormat("Unable to find Main method in class '%s'", entryClassName.c_str()));
if (entryClassName.IsEmpty())
mPassInstance->Fail("Unable to find Main method in global namespace. Consider specifying a Startup Object in the project properties.");
else
mPassInstance->Fail(StrFormat("Unable to find Main method in specified Startup Object '%s'", entryClassName.c_str()));
}
}
}
@ -6171,7 +6175,7 @@ void BfCompiler::CompileReified()
for (auto project : mSystem->mProjects)
{
String entryClassName = project->mStartupObject;
auto typeDef = mSystem->FindTypeDef(entryClassName, 0, project);
auto typeDef = mSystem->FindTypeDef(entryClassName, 0, project, {}, NULL, BfFindTypeDefFlag_AllowGlobal);
if (typeDef != NULL)
{
typeDef->mIsAlwaysInclude = true;