- changed order of identifier types to be checked to what it was in 4.3

This commit is contained in:
Christoph Oelckers 2020-10-17 15:13:14 +02:00
parent 28a12d2597
commit 565a5acd85
3 changed files with 18 additions and 3 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 (auto *cvar = FindCVar(Identifier.GetChars(), nullptr))
{ {
if (cvar->GetFlags() & CVAR_USERINFO) if (cvar->GetFlags() & CVAR_USERINFO)

View file

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

View file

@ -165,7 +165,7 @@ static bool CheckForCustomAddition(FxAddSub *func, FCompileContext &ctx)
// //
//========================================================================== //==========================================================================
static FxExpression* CheckForDefault(FxIdentifier *func, FCompileContext &ctx) static FxExpression* CheckForDefault(FxIdentifier* func, FCompileContext& ctx)
{ {
auto& ScriptPosition = func->ScriptPosition; auto& ScriptPosition = func->ScriptPosition;
@ -190,10 +190,16 @@ static FxExpression* CheckForDefault(FxIdentifier *func, FCompileContext &ctx)
return nullptr; return nullptr;
} }
FxExpression * x = new FxClassDefaults(new FxSelf(ScriptPosition), ScriptPosition); FxExpression* x = new FxClassDefaults(new FxSelf(ScriptPosition), ScriptPosition);
delete func; delete func;
return x->Resolve(ctx); return x->Resolve(ctx);
} }
return func;
}
static FxExpression* CheckForLineSpecial(FxIdentifier* func, FCompileContext& ctx)
{
auto& ScriptPosition = func->ScriptPosition;
// and line specials // and line specials
int num; int num;
@ -215,6 +221,7 @@ static FxExpression* CheckForDefault(FxIdentifier *func, FCompileContext &ctx)
static FxExpression *ResolveForDefault(FxIdentifier *expr, FxExpression*& object, PContainerType* objtype, FCompileContext &ctx) static FxExpression *ResolveForDefault(FxIdentifier *expr, FxExpression*& object, PContainerType* objtype, FCompileContext &ctx)
{ {
if (expr->Identifier == NAME_Default) if (expr->Identifier == NAME_Default)
{ {
if (!isActor(objtype)) if (!isActor(objtype))
@ -953,6 +960,7 @@ void SetDoomCompileEnvironment()
compileEnvironment.SpecialTypeCast = CustomTypeCast; compileEnvironment.SpecialTypeCast = CustomTypeCast;
compileEnvironment.CheckForCustomAddition = CheckForCustomAddition; compileEnvironment.CheckForCustomAddition = CheckForCustomAddition;
compileEnvironment.CheckSpecialIdentifier = CheckForDefault; compileEnvironment.CheckSpecialIdentifier = CheckForDefault;
compileEnvironment.CheckSpecialGlobalIdentifier = CheckForLineSpecial;
compileEnvironment.ResolveSpecialIdentifier = ResolveForDefault; compileEnvironment.ResolveSpecialIdentifier = ResolveForDefault;
compileEnvironment.CheckSpecialMember = CheckForMemberDefault; compileEnvironment.CheckSpecialMember = CheckForMemberDefault;
compileEnvironment.ResolveSpecialFunction = AJumpProcessing; compileEnvironment.ResolveSpecialFunction = AJumpProcessing;