mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- ensure proper emission of deprecations.
For global variables this wasn't implemented. # Conflicts: # src/namedef.h # src/scripting/backend/codegen.cpp # wadsrc/static/zscript/base.txt
This commit is contained in:
parent
c6ee8e084c
commit
7c3ec662e1
5 changed files with 30 additions and 10 deletions
|
@ -164,7 +164,7 @@ struct FScriptPosition
|
|||
static int ErrorCounter;
|
||||
static bool StrictErrors;
|
||||
static bool errorout;
|
||||
FString FileName;
|
||||
FName FileName;
|
||||
int ScriptLine;
|
||||
|
||||
FScriptPosition()
|
||||
|
|
|
@ -6114,6 +6114,15 @@ FxExpression *FxIdentifier::Resolve(FCompileContext& ctx)
|
|||
|
||||
// internally defined global variable
|
||||
ScriptPosition.Message(MSG_DEBUGLOG, "Resolving name '%s' as global variable\n", Identifier.GetChars());
|
||||
|
||||
if ((vsym->Flags & VARF_Deprecated))
|
||||
{
|
||||
if (sym->mVersion <= ctx.Version)
|
||||
{
|
||||
ScriptPosition.Message(MSG_WARNING, "Accessing deprecated global variable %s - deprecated since %d.%d.%d", sym->SymbolName.GetChars(), vsym->mVersion.major, vsym->mVersion.minor, vsym->mVersion.revision);
|
||||
}
|
||||
}
|
||||
|
||||
newex = new FxGlobalVariable(static_cast<PField *>(sym), ScriptPosition);
|
||||
goto foundit;
|
||||
}
|
||||
|
@ -6201,10 +6210,13 @@ FxExpression *FxIdentifier::ResolveMember(FCompileContext &ctx, PContainerType *
|
|||
object = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
if ((vsym->Flags & VARF_Deprecated) && sym->mVersion <= ctx.Version)
|
||||
if ((vsym->Flags & VARF_Deprecated))
|
||||
{
|
||||
if (sym->mVersion <= ctx.Version)
|
||||
{
|
||||
ScriptPosition.Message(MSG_WARNING, "Accessing deprecated member variable %s - deprecated since %d.%d.%d", sym->SymbolName.GetChars(), vsym->mVersion.major, vsym->mVersion.minor, vsym->mVersion.revision);
|
||||
}
|
||||
}
|
||||
|
||||
// We have 4 cases to consider here:
|
||||
// 1. The symbol is a static/meta member which is always accessible.
|
||||
|
@ -8625,6 +8637,7 @@ ExpEmit FxActionSpecialCall::Emit(VMFunctionBuilder *build)
|
|||
emitters.AddParameterIntConst(abs(Special)); // pass special number
|
||||
emitters.AddParameter(build, Self);
|
||||
|
||||
|
||||
for (; i < ArgList.Size(); ++i)
|
||||
{
|
||||
FxExpression *argex = ArgList[i];
|
||||
|
@ -8711,10 +8724,13 @@ bool FxVMFunctionCall::CheckAccessibility(const VersionInfo &ver)
|
|||
ScriptPosition.Message(MSG_ERROR, "%s not accessible to %s", Function->SymbolName.GetChars(), VersionString.GetChars());
|
||||
return false;
|
||||
}
|
||||
if ((Function->Variants[0].Flags & VARF_Deprecated) && Function->mVersion <= ver)
|
||||
if ((Function->Variants[0].Flags & VARF_Deprecated))
|
||||
{
|
||||
if (Function->mVersion <= ver)
|
||||
{
|
||||
ScriptPosition.Message(MSG_WARNING, "Accessing deprecated function %s - deprecated since %d.%d.%d", Function->SymbolName.GetChars(), Function->mVersion.major, Function->mVersion.minor, Function->mVersion.revision);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//==========================================================================
|
||||
|
|
|
@ -1348,13 +1348,18 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
// This is a global variable.
|
||||
if (fd->BitValue != 0) thisfieldtype = fd->FieldSize == 1 ? TypeUInt8 : fd->FieldSize == 2 ? TypeUInt16 : TypeUInt32;
|
||||
PField *field = Create<PField>(name->Name, thisfieldtype, varflags | VARF_Native | VARF_Static, fd->FieldOffset, fd->BitValue);
|
||||
PField *f = Create<PField>(name->Name, thisfieldtype, varflags | VARF_Native | VARF_Static, fd->FieldOffset, fd->BitValue);
|
||||
if (f->Flags & (ZCC_Version | ZCC_Deprecated))
|
||||
{
|
||||
f->mVersion = field->Version;
|
||||
}
|
||||
|
||||
if (OutNamespace->Symbols.AddSymbol(field) == nullptr)
|
||||
if (OutNamespace->Symbols.AddSymbol(f) == nullptr)
|
||||
{ // name is already in use
|
||||
field->Destroy();
|
||||
f->Destroy();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -615,7 +615,6 @@ void DInterBackground::drawBackground(int state, bool drawsplat, bool snl_pointe
|
|||
for (i = 0; i<anims.Size(); i++)
|
||||
{
|
||||
in_anim_t * a = &anims[i];
|
||||
level_info_t * li;
|
||||
|
||||
switch (a->type & ANIM_CONDITION)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue