mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Improved cross-project emit markers
This commit is contained in:
parent
eb59434e67
commit
1360afbea1
6 changed files with 50 additions and 26 deletions
|
@ -45,6 +45,13 @@ namespace IDE
|
|||
if (lc != rc)
|
||||
return false;
|
||||
|
||||
if (lc == ':')
|
||||
{
|
||||
// If one has a subproject specified then ignore that
|
||||
li = lhs.LastIndexOf(':');
|
||||
ri = rhs.LastIndexOf(':');
|
||||
}
|
||||
|
||||
if (lc == '<')
|
||||
{
|
||||
SkipGeneric(lhs, ref li);
|
||||
|
|
|
@ -302,7 +302,7 @@ namespace IDE.ui
|
|||
|
||||
DeleteAndNullify!(mGenericTypeFilter);
|
||||
mIgnoreChange = true;
|
||||
int colonPos = typeName.IndexOf(':');
|
||||
int colonPos = typeName.LastIndexOf(':');
|
||||
if (colonPos != -1)
|
||||
mGenericTypeCombo.Label = typeName.Substring(colonPos + 1);
|
||||
else
|
||||
|
@ -321,7 +321,7 @@ namespace IDE.ui
|
|||
EntryLoop: for (var entry in mGenericTypeData)
|
||||
{
|
||||
StringView useName = entry.mTypeName;
|
||||
int colonPos = useName.IndexOf(':');
|
||||
int colonPos = useName.LastIndexOf(':');
|
||||
if (colonPos != -1)
|
||||
useName.RemoveFromStart(colonPos + 1);
|
||||
|
||||
|
|
|
@ -9132,11 +9132,13 @@ void BfCompiler::GetTypeDefs(const StringImpl& inTypeName, Array<BfTypeDef*>& ty
|
|||
BfProject* project = NULL;
|
||||
int idx = 0;
|
||||
|
||||
int sep = (int)inTypeName.IndexOf(':');
|
||||
int sep = (int)inTypeName.LastIndexOf(':');
|
||||
if (sep != -1)
|
||||
{
|
||||
int startProjName = (int)inTypeName.LastIndexOf(':', sep - 1) + 1;
|
||||
|
||||
idx = sep + 1;
|
||||
project = mSystem->GetProject(inTypeName.Substring(0, sep));
|
||||
project = mSystem->GetProject(inTypeName.Substring(startProjName, sep - startProjName));
|
||||
}
|
||||
|
||||
String typeName;
|
||||
|
@ -9271,10 +9273,11 @@ BfType* BfCompiler::GetType(const StringImpl& fullTypeName)
|
|||
BfProject* activeProject = NULL;
|
||||
|
||||
String typeName = fullTypeName;
|
||||
int colonPos = (int)typeName.IndexOf(':');
|
||||
int colonPos = (int)typeName.LastIndexOf(':');
|
||||
if (colonPos != -1)
|
||||
{
|
||||
activeProject = mSystem->GetProject(typeName.Substring(0, colonPos));
|
||||
int startProjName = (int)typeName.LastIndexOf(':', colonPos - 1) + 1;
|
||||
activeProject = mSystem->GetProject(typeName.Substring(startProjName, colonPos - startProjName));
|
||||
typeName.Remove(0, colonPos + 1);
|
||||
}
|
||||
|
||||
|
@ -9923,10 +9926,7 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetCollapseRegions(BfCompiler* bfCo
|
|||
|
||||
if ((emitParser == NULL) || (!emitParser->mIsEmitted))
|
||||
{
|
||||
String typeName;
|
||||
outString += typeInst->mTypeDef->mProject->mName;
|
||||
outString += ":";
|
||||
outString += bfCompiler->mContext->mScratchModule->TypeToString(typeInst, BfTypeNameFlags_None);
|
||||
outString += bfCompiler->mContext->mScratchModule->TypeToString(typeInst, BfTypeNameFlag_AddProjectName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -10417,9 +10417,7 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetGenericTypeInstances(BfCompiler*
|
|||
|
||||
if (typeInst->mTypeDef->GetDefinition()->GetLatest() == lookupTypeInst->mTypeDef->GetDefinition()->GetLatest())
|
||||
{
|
||||
outString += typeInst->mTypeDef->mProject->mName;
|
||||
outString += ":";
|
||||
outString += bfCompiler->mContext->mScratchModule->TypeToString(typeInst, BfTypeNameFlags_None);
|
||||
outString += bfCompiler->mContext->mScratchModule->TypeToString(typeInst, BfTypeNameFlag_AddProjectName);
|
||||
outString += "\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13894,6 +13894,7 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
|
|||
else
|
||||
{
|
||||
methodInstGroup->mOnDemandKind = BfMethodOnDemandKind_Decl_AwaitingDecl;
|
||||
if (!mIsScratchModule)
|
||||
mOnDemandMethodCount++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2176,11 +2176,7 @@ BfCEParseContext BfModule::CEEmitParse(BfTypeInstance* typeInstance, BfTypeDef*
|
|||
|
||||
BfLogSys(mSystem, "Emit typeDef for type %p created %p parser %p typeDecl %p\n", typeInstance, emitTypeDef, emitParser, emitTypeDef->mTypeDeclaration);
|
||||
|
||||
String typeName;
|
||||
typeName += typeInstance->mTypeDef->mProject->mName;
|
||||
typeName += ":";
|
||||
|
||||
typeName += TypeToString(typeInstance, BfTypeNameFlags_None);
|
||||
String typeName = TypeToString(typeInstance, BfTypeNameFlag_AddProjectName);
|
||||
|
||||
if ((mCompiler->mResolvePassData != NULL) && (!mCompiler->mResolvePassData->mEmitEmbedEntries.IsEmpty()))
|
||||
mCompiler->mResolvePassData->mEmitEmbedEntries.TryGetValue(typeName, &emitEmbedEntry);
|
||||
|
@ -5933,11 +5929,7 @@ void BfModule::DoTypeInstanceMethodProcessing(BfTypeInstance* typeInstance)
|
|||
|
||||
if (isCurrentEntry)
|
||||
{
|
||||
String typeName;
|
||||
typeName += typeInstance->mTypeDef->mProject->mName;
|
||||
typeName += ":";
|
||||
typeName += TypeToString(typeInstance, BfTypeNameFlags_None);
|
||||
|
||||
String typeName = TypeToString(typeInstance, BfTypeNameFlag_AddProjectName);
|
||||
if (mCompiler->mResolvePassData->mEmitEmbedEntries.ContainsKey(typeName))
|
||||
{
|
||||
wantsOnDemandMethods = false;
|
||||
|
@ -14809,6 +14801,31 @@ void BfModule::DoTypeToString(StringImpl& str, BfType* resolvedType, BfTypeNameF
|
|||
{
|
||||
BP_ZONE("BfModule::DoTypeToString");
|
||||
|
||||
if ((typeNameFlags & BfTypeNameFlag_AddProjectName) != 0)
|
||||
{
|
||||
BfProject* defProject = NULL;
|
||||
|
||||
auto typeInst = resolvedType->ToTypeInstance();
|
||||
if (typeInst != NULL)
|
||||
{
|
||||
defProject = typeInst->mTypeDef->mProject;
|
||||
str += defProject->mName;
|
||||
str += ":";
|
||||
}
|
||||
|
||||
SizedArray<BfProject*, 4> projectList;
|
||||
BfTypeUtils::GetProjectList(resolvedType, &projectList, 0);
|
||||
if (!projectList.IsEmpty())
|
||||
{
|
||||
if (defProject != projectList[0])
|
||||
{
|
||||
str += projectList[0]->mName;
|
||||
str += ":";
|
||||
}
|
||||
}
|
||||
typeNameFlags = (BfTypeNameFlags)(typeNameFlags & ~BfTypeNameFlag_AddProjectName);
|
||||
}
|
||||
|
||||
// This is clearly wrong. If we pass in @T0 from a generic type, this would immediately disable the ability to get its name
|
||||
/*if (resolvedType->IsUnspecializedType())
|
||||
typeNameFlags = (BfTypeNameFlags)(typeNameFlags & ~BfTypeNameFlag_ResolveGenericParamNames);*/
|
||||
|
|
|
@ -57,7 +57,8 @@ enum BfTypeNameFlags : uint16
|
|||
BfTypeNameFlag_InternalName = 0x100, // Use special delimiters to remove ambiguities (ie: '+' for inner types)
|
||||
BfTypeNameFlag_HideGlobalName = 0x200,
|
||||
BfTypeNameFlag_ExtendedInfo = 0x400,
|
||||
BfTypeNameFlag_ShortConst = 0x800
|
||||
BfTypeNameFlag_ShortConst = 0x800,
|
||||
BfTypeNameFlag_AddProjectName = 0x1000
|
||||
};
|
||||
|
||||
enum BfMethodNameFlags : uint8
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue