mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Fixed Go To Definition cases in generated code
This commit is contained in:
parent
4e5327e8b8
commit
100181b062
4 changed files with 36 additions and 9 deletions
|
@ -2182,12 +2182,14 @@ namespace IDE.ui
|
|||
for (var emitEmbedData in resolveParams.mEmitEmbeds)
|
||||
{
|
||||
var data = resolvePassData.GetEmitEmbedData(emitEmbedData.mTypeName, var srcLength, var revision);
|
||||
if (srcLength < 0)
|
||||
if ((srcLength < 0) && (resolveType == .ClassifyFullRefresh))
|
||||
srcLength = 0;
|
||||
|
||||
emitEmbedData.mCharData = new EditWidgetContent.CharData[srcLength+1] (?);
|
||||
emitEmbedData.mCharData[srcLength] = default;
|
||||
Internal.MemCpy(emitEmbedData.mCharData.Ptr, data, srcLength * strideof(EditWidgetContent.CharData));
|
||||
if (srcLength >= 0)
|
||||
{
|
||||
emitEmbedData.mCharData = new EditWidgetContent.CharData[srcLength+1] (?);
|
||||
emitEmbedData.mCharData[srcLength] = default;
|
||||
Internal.MemCpy(emitEmbedData.mCharData.Ptr, data, srcLength * strideof(EditWidgetContent.CharData));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,9 +227,18 @@ BfAutoComplete::~BfAutoComplete()
|
|||
|
||||
void BfAutoComplete::SetModule(BfModule* module)
|
||||
{
|
||||
mModule = module;
|
||||
mCompiler = mModule->mCompiler;
|
||||
mSystem = mCompiler->mSystem;
|
||||
if (module != NULL)
|
||||
{
|
||||
mModule = module;
|
||||
mCompiler = mModule->mCompiler;
|
||||
mSystem = mCompiler->mSystem;
|
||||
}
|
||||
else
|
||||
{
|
||||
mModule = NULL;
|
||||
mCompiler = NULL;
|
||||
mSystem = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void BfAutoComplete::Clear()
|
||||
|
@ -293,6 +302,8 @@ int BfAutoComplete::GetCursorIdx(BfAstNode* node)
|
|||
|
||||
bool BfAutoComplete::IsAutocompleteNode(BfAstNode* node, int lengthAdd, int startAdd)
|
||||
{
|
||||
if (mModule == NULL)
|
||||
return false;
|
||||
if (node == NULL)
|
||||
return false;
|
||||
|
||||
|
@ -1297,6 +1308,9 @@ BfProject* BfAutoComplete::GetActiveProject()
|
|||
|
||||
bool BfAutoComplete::WantsEntries()
|
||||
{
|
||||
if (mModule == NULL)
|
||||
return false;
|
||||
|
||||
return (mResolveType == BfResolveType_Autocomplete) ||
|
||||
(mResolveType == BfResolveType_Autocomplete_HighPri) ||
|
||||
(mResolveType == BfResolveType_GetSymbolInfo) ||
|
||||
|
|
|
@ -4279,6 +4279,7 @@ void BfCompiler::ProcessAutocompleteTempType()
|
|||
{
|
||||
if ((autoComplete != NULL) && (autoComplete->mResolveType == BfResolveType_GoToDefinition))
|
||||
{
|
||||
autoComplete->SetModule(NULL);
|
||||
for (auto& kv : mResolvePassData->mEmitEmbedEntries)
|
||||
{
|
||||
String typeName = kv.mKey;
|
||||
|
@ -4296,6 +4297,7 @@ void BfCompiler::ProcessAutocompleteTempType()
|
|||
}
|
||||
|
||||
DoWorkLoop();
|
||||
autoComplete->SetModule(mContext->mScratchModule);
|
||||
}
|
||||
|
||||
GenerateAutocompleteInfo();
|
||||
|
|
|
@ -571,7 +571,16 @@ bool BfContext::ProcessWorkList(bool onlyReifiedTypes, bool onlyReifiedMethods)
|
|||
{
|
||||
if (!mCompiler->mIsResolveOnly)
|
||||
BF_ASSERT(!methodInstance->mIsReified || methodInstance->mDeclModule->mIsModuleMutable);
|
||||
ProcessMethod(methodInstance);
|
||||
|
||||
auto autoComplete = mCompiler->GetAutoComplete();
|
||||
if ((autoComplete != NULL) && (autoComplete->mModule == NULL))
|
||||
{
|
||||
autoComplete->mModule = methodInstance->mDeclModule;
|
||||
ProcessMethod(methodInstance);
|
||||
autoComplete->mModule = NULL;
|
||||
}
|
||||
else
|
||||
ProcessMethod(methodInstance);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue