- 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:
Christoph Oelckers 2019-01-12 16:36:21 +01:00
commit 7c3ec662e1
5 changed files with 30 additions and 10 deletions

View file

@ -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;
}
}