mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Merge pull request #1018 from EinBurgbauer/comptime-crash-fixes
Comptime crash fixes
This commit is contained in:
commit
369bb0640c
1 changed files with 19 additions and 11 deletions
|
@ -2951,19 +2951,21 @@ BfError* CeContext::Fail(const CeFrame& curFrame, const StringImpl& str)
|
||||||
err += mCeMachine->mCeModule->MethodToString(ceFunction->mCeInnerFunctionInfo->mOwner->mMethodInstance, BfMethodNameFlag_OmitParams);
|
err += mCeMachine->mCeModule->MethodToString(ceFunction->mCeInnerFunctionInfo->mOwner->mMethodInstance, BfMethodNameFlag_OmitParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((emitEntry != NULL) && (emitEntry->mFile != -1))
|
if ((emitEntry != NULL) && (emitEntry->mFile != -1))
|
||||||
|
{
|
||||||
err += StrFormat(" at line% d:%d in %s", emitEntry->mLine + 1, emitEntry->mColumn + 1, ceFunction->mFiles[emitEntry->mFile].c_str());
|
err += StrFormat(" at line% d:%d in %s", emitEntry->mLine + 1, emitEntry->mColumn + 1, ceFunction->mFiles[emitEntry->mFile].c_str());
|
||||||
|
|
||||||
auto moreInfo = passInstance->MoreInfo(err, mCeMachine->mCeModule->mCompiler->GetAutoComplete() != NULL);
|
auto moreInfo = passInstance->MoreInfo(err, mCeMachine->mCeModule->mCompiler->GetAutoComplete() != NULL);
|
||||||
if ((moreInfo != NULL) && (emitEntry != NULL))
|
if ((moreInfo != NULL))
|
||||||
{
|
{
|
||||||
BfErrorLocation* location = new BfErrorLocation();
|
BfErrorLocation* location = new BfErrorLocation();
|
||||||
location->mFile = ceFunction->mFiles[emitEntry->mFile];
|
location->mFile = ceFunction->mFiles[emitEntry->mFile];
|
||||||
location->mLine = emitEntry->mLine;
|
location->mLine = emitEntry->mLine;
|
||||||
location->mColumn = emitEntry->mColumn;
|
location->mColumn = emitEntry->mColumn;
|
||||||
moreInfo->mLocation = location;
|
moreInfo->mLocation = location;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return bfError;
|
return bfError;
|
||||||
|
@ -4625,7 +4627,13 @@ bool CeContext::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8*
|
||||||
_Fail("Invalid method instance");
|
_Fail("Invalid method instance");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (paramIdx < 0 || paramIdx >= methodInstance->mParams.mSize)
|
||||||
|
{
|
||||||
|
_Fail("paramIdx is out of range");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
addr_ce stringAddr = GetString(methodInstance->GetParamName(paramIdx));
|
addr_ce stringAddr = GetString(methodInstance->GetParamName(paramIdx));
|
||||||
_FixVariables();
|
_FixVariables();
|
||||||
*(int32*)(stackPtr + 0) = methodInstance->GetParamType(paramIdx)->mTypeId;
|
*(int32*)(stackPtr + 0) = methodInstance->GetParamType(paramIdx)->mTypeId;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue