- backend update from GZDoom.

This commit is contained in:
Christoph Oelckers 2020-10-24 17:30:47 +02:00
parent 8b03abcd00
commit c82d9d2908
28 changed files with 178 additions and 53 deletions

View file

@ -6055,6 +6055,12 @@ FxExpression *FxIdentifier::Resolve(FCompileContext& ctx)
}
}
if (compileEnvironment.CheckSpecialGlobalIdentifier)
{
auto result = compileEnvironment.CheckSpecialGlobalIdentifier(this, ctx);
if (result != this) return result;
}
if (auto *cvar = FindCVar(Identifier.GetChars(), nullptr))
{
if (cvar->GetFlags() & CVAR_USERINFO)
@ -8540,6 +8546,13 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
if (!result) return nullptr;
}
// [Player701] Catch attempts to call abstract functions directly at compile time
if (NoVirtual && Function->Variants[0].Implementation->VarFlags & VARF_Abstract)
{
ScriptPosition.Message(MSG_ERROR, "Cannot call abstract function %s", Function->Variants[0].Implementation->PrintableName.GetChars());
delete this;
return nullptr;
}
CallingFunction = ctx.Function;
if (ArgList.Size() > 0)

View file

@ -2131,6 +2131,7 @@ struct CompileEnvironment
FxExpression* (*SpecialTypeCast)(FxTypeCast* func, FCompileContext& ctx);
bool (*CheckForCustomAddition)(FxAddSub* func, FCompileContext& ctx);
FxExpression* (*CheckSpecialIdentifier)(FxIdentifier* func, FCompileContext& ctx);
FxExpression* (*CheckSpecialGlobalIdentifier)(FxIdentifier* func, FCompileContext& ctx);
FxExpression* (*ResolveSpecialIdentifier)(FxIdentifier* func, FxExpression*& object, PContainerType* objtype, FCompileContext& ctx);
FxExpression* (*CheckSpecialMember)(FxStructMember* func, FCompileContext& ctx);
FxExpression* (*CheckCustomGlobalFunctions)(FxFunctionCall* func, FCompileContext& ctx);

View file

@ -767,13 +767,16 @@ FFunctionBuildList FunctionBuildList;
VMFunction *FFunctionBuildList::AddFunction(PNamespace *gnspc, const VersionInfo &ver, PFunction *functype, FxExpression *code, const FString &name, bool fromdecorate, int stateindex, int statecount, int lumpnum)
{
auto func = code->GetDirectFunction(functype, ver);
if (func != nullptr)
if (code != nullptr)
{
delete code;
auto func = code->GetDirectFunction(functype, ver);
if (func != nullptr)
{
delete code;
return func;
return func;
}
}
//Printf("Adding %s\n", name.GetChars());
@ -815,6 +818,10 @@ void FFunctionBuildList::Build()
for (auto &item : mItems)
{
// [Player701] Do not emit code for abstract functions
bool isAbstract = item.Func->Variants[0].Implementation->VarFlags & VARF_Abstract;
if (isAbstract) continue;
assert(item.Code != NULL);
// We don't know the return type in advance for anonymous functions.