mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 14:01:45 +00:00
Fixed nested structs breaking the ZScript compiler under certain circumstances.
This commit is contained in:
parent
b8bf812433
commit
0f86f3a62a
2 changed files with 16 additions and 1 deletions
|
@ -101,6 +101,7 @@ public:
|
|||
VersionInfo mVersion = { 0,0,0 };
|
||||
uint8_t loadOp, storeOp, moveOp, RegType, RegCount;
|
||||
EScopeFlags ScopeFlags = (EScopeFlags)0;
|
||||
bool SizeKnown = true;
|
||||
|
||||
PType(unsigned int size = 1, unsigned int align = 1);
|
||||
virtual ~PType();
|
||||
|
|
|
@ -1476,8 +1476,12 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
|
|||
auto name = field->Names;
|
||||
do
|
||||
{
|
||||
if (fieldtype->Size == 0 && !(varflags & VARF_Native)) // Size not known yet.
|
||||
if ((fieldtype->Size == 0 || !fieldtype->SizeKnown) && !(varflags & VARF_Native)) // Size not known yet.
|
||||
{
|
||||
if (type != nullptr)
|
||||
{
|
||||
type->SizeKnown = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1532,6 +1536,10 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
|
|||
|
||||
if (OutNamespace->Symbols.AddSymbol(f) == nullptr)
|
||||
{ // name is already in use
|
||||
if (type != nullptr)
|
||||
{
|
||||
type->SizeKnown = false;
|
||||
}
|
||||
f->Destroy();
|
||||
return false;
|
||||
}
|
||||
|
@ -1565,6 +1573,12 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
|
|||
} while (name != field->Names);
|
||||
Fields.Delete(0);
|
||||
}
|
||||
|
||||
if (type != nullptr)
|
||||
{
|
||||
type->SizeKnown = Fields.Size() == 0;
|
||||
}
|
||||
|
||||
return Fields.Size() == 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue