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)
|
if (lc != rc)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (lc == ':')
|
||||||
|
{
|
||||||
|
// If one has a subproject specified then ignore that
|
||||||
|
li = lhs.LastIndexOf(':');
|
||||||
|
ri = rhs.LastIndexOf(':');
|
||||||
|
}
|
||||||
|
|
||||||
if (lc == '<')
|
if (lc == '<')
|
||||||
{
|
{
|
||||||
SkipGeneric(lhs, ref li);
|
SkipGeneric(lhs, ref li);
|
||||||
|
|
|
@ -302,7 +302,7 @@ namespace IDE.ui
|
||||||
|
|
||||||
DeleteAndNullify!(mGenericTypeFilter);
|
DeleteAndNullify!(mGenericTypeFilter);
|
||||||
mIgnoreChange = true;
|
mIgnoreChange = true;
|
||||||
int colonPos = typeName.IndexOf(':');
|
int colonPos = typeName.LastIndexOf(':');
|
||||||
if (colonPos != -1)
|
if (colonPos != -1)
|
||||||
mGenericTypeCombo.Label = typeName.Substring(colonPos + 1);
|
mGenericTypeCombo.Label = typeName.Substring(colonPos + 1);
|
||||||
else
|
else
|
||||||
|
@ -321,7 +321,7 @@ namespace IDE.ui
|
||||||
EntryLoop: for (var entry in mGenericTypeData)
|
EntryLoop: for (var entry in mGenericTypeData)
|
||||||
{
|
{
|
||||||
StringView useName = entry.mTypeName;
|
StringView useName = entry.mTypeName;
|
||||||
int colonPos = useName.IndexOf(':');
|
int colonPos = useName.LastIndexOf(':');
|
||||||
if (colonPos != -1)
|
if (colonPos != -1)
|
||||||
useName.RemoveFromStart(colonPos + 1);
|
useName.RemoveFromStart(colonPos + 1);
|
||||||
|
|
||||||
|
|
|
@ -9132,11 +9132,13 @@ void BfCompiler::GetTypeDefs(const StringImpl& inTypeName, Array<BfTypeDef*>& ty
|
||||||
BfProject* project = NULL;
|
BfProject* project = NULL;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
int sep = (int)inTypeName.IndexOf(':');
|
int sep = (int)inTypeName.LastIndexOf(':');
|
||||||
if (sep != -1)
|
if (sep != -1)
|
||||||
{
|
{
|
||||||
|
int startProjName = (int)inTypeName.LastIndexOf(':', sep - 1) + 1;
|
||||||
|
|
||||||
idx = sep + 1;
|
idx = sep + 1;
|
||||||
project = mSystem->GetProject(inTypeName.Substring(0, sep));
|
project = mSystem->GetProject(inTypeName.Substring(startProjName, sep - startProjName));
|
||||||
}
|
}
|
||||||
|
|
||||||
String typeName;
|
String typeName;
|
||||||
|
@ -9271,10 +9273,11 @@ BfType* BfCompiler::GetType(const StringImpl& fullTypeName)
|
||||||
BfProject* activeProject = NULL;
|
BfProject* activeProject = NULL;
|
||||||
|
|
||||||
String typeName = fullTypeName;
|
String typeName = fullTypeName;
|
||||||
int colonPos = (int)typeName.IndexOf(':');
|
int colonPos = (int)typeName.LastIndexOf(':');
|
||||||
if (colonPos != -1)
|
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);
|
typeName.Remove(0, colonPos + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9923,10 +9926,7 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetCollapseRegions(BfCompiler* bfCo
|
||||||
|
|
||||||
if ((emitParser == NULL) || (!emitParser->mIsEmitted))
|
if ((emitParser == NULL) || (!emitParser->mIsEmitted))
|
||||||
{
|
{
|
||||||
String typeName;
|
outString += bfCompiler->mContext->mScratchModule->TypeToString(typeInst, BfTypeNameFlag_AddProjectName);
|
||||||
outString += typeInst->mTypeDef->mProject->mName;
|
|
||||||
outString += ":";
|
|
||||||
outString += bfCompiler->mContext->mScratchModule->TypeToString(typeInst, BfTypeNameFlags_None);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -10416,10 +10416,8 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetGenericTypeInstances(BfCompiler*
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (typeInst->mTypeDef->GetDefinition()->GetLatest() == lookupTypeInst->mTypeDef->GetDefinition()->GetLatest())
|
if (typeInst->mTypeDef->GetDefinition()->GetLatest() == lookupTypeInst->mTypeDef->GetDefinition()->GetLatest())
|
||||||
{
|
{
|
||||||
outString += typeInst->mTypeDef->mProject->mName;
|
outString += bfCompiler->mContext->mScratchModule->TypeToString(typeInst, BfTypeNameFlag_AddProjectName);
|
||||||
outString += ":";
|
|
||||||
outString += bfCompiler->mContext->mScratchModule->TypeToString(typeInst, BfTypeNameFlags_None);
|
|
||||||
outString += "\n";
|
outString += "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13894,7 +13894,8 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
methodInstGroup->mOnDemandKind = BfMethodOnDemandKind_Decl_AwaitingDecl;
|
methodInstGroup->mOnDemandKind = BfMethodOnDemandKind_Decl_AwaitingDecl;
|
||||||
mOnDemandMethodCount++;
|
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);
|
BfLogSys(mSystem, "Emit typeDef for type %p created %p parser %p typeDecl %p\n", typeInstance, emitTypeDef, emitParser, emitTypeDef->mTypeDeclaration);
|
||||||
|
|
||||||
String typeName;
|
String typeName = TypeToString(typeInstance, BfTypeNameFlag_AddProjectName);
|
||||||
typeName += typeInstance->mTypeDef->mProject->mName;
|
|
||||||
typeName += ":";
|
|
||||||
|
|
||||||
typeName += TypeToString(typeInstance, BfTypeNameFlags_None);
|
|
||||||
|
|
||||||
if ((mCompiler->mResolvePassData != NULL) && (!mCompiler->mResolvePassData->mEmitEmbedEntries.IsEmpty()))
|
if ((mCompiler->mResolvePassData != NULL) && (!mCompiler->mResolvePassData->mEmitEmbedEntries.IsEmpty()))
|
||||||
mCompiler->mResolvePassData->mEmitEmbedEntries.TryGetValue(typeName, &emitEmbedEntry);
|
mCompiler->mResolvePassData->mEmitEmbedEntries.TryGetValue(typeName, &emitEmbedEntry);
|
||||||
|
@ -5933,11 +5929,7 @@ void BfModule::DoTypeInstanceMethodProcessing(BfTypeInstance* typeInstance)
|
||||||
|
|
||||||
if (isCurrentEntry)
|
if (isCurrentEntry)
|
||||||
{
|
{
|
||||||
String typeName;
|
String typeName = TypeToString(typeInstance, BfTypeNameFlag_AddProjectName);
|
||||||
typeName += typeInstance->mTypeDef->mProject->mName;
|
|
||||||
typeName += ":";
|
|
||||||
typeName += TypeToString(typeInstance, BfTypeNameFlags_None);
|
|
||||||
|
|
||||||
if (mCompiler->mResolvePassData->mEmitEmbedEntries.ContainsKey(typeName))
|
if (mCompiler->mResolvePassData->mEmitEmbedEntries.ContainsKey(typeName))
|
||||||
{
|
{
|
||||||
wantsOnDemandMethods = false;
|
wantsOnDemandMethods = false;
|
||||||
|
@ -14809,6 +14801,31 @@ void BfModule::DoTypeToString(StringImpl& str, BfType* resolvedType, BfTypeNameF
|
||||||
{
|
{
|
||||||
BP_ZONE("BfModule::DoTypeToString");
|
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
|
// 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())
|
/*if (resolvedType->IsUnspecializedType())
|
||||||
typeNameFlags = (BfTypeNameFlags)(typeNameFlags & ~BfTypeNameFlag_ResolveGenericParamNames);*/
|
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_InternalName = 0x100, // Use special delimiters to remove ambiguities (ie: '+' for inner types)
|
||||||
BfTypeNameFlag_HideGlobalName = 0x200,
|
BfTypeNameFlag_HideGlobalName = 0x200,
|
||||||
BfTypeNameFlag_ExtendedInfo = 0x400,
|
BfTypeNameFlag_ExtendedInfo = 0x400,
|
||||||
BfTypeNameFlag_ShortConst = 0x800
|
BfTypeNameFlag_ShortConst = 0x800,
|
||||||
|
BfTypeNameFlag_AddProjectName = 0x1000
|
||||||
};
|
};
|
||||||
|
|
||||||
enum BfMethodNameFlags : uint8
|
enum BfMethodNameFlags : uint8
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue