mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-07 09:50:45 +00:00
Fixed nested structs breaking the ZScript compiler under certain circumstances.
This commit is contained in:
parent
2c3303e723
commit
0ea4e182c7
2 changed files with 16 additions and 1 deletions
|
@ -100,6 +100,7 @@ public:
|
||||||
VersionInfo mVersion = { 0,0,0 };
|
VersionInfo mVersion = { 0,0,0 };
|
||||||
uint8_t loadOp, storeOp, moveOp, RegType, RegCount;
|
uint8_t loadOp, storeOp, moveOp, RegType, RegCount;
|
||||||
EScopeFlags ScopeFlags = (EScopeFlags)0;
|
EScopeFlags ScopeFlags = (EScopeFlags)0;
|
||||||
|
bool SizeKnown = true;
|
||||||
|
|
||||||
PType(unsigned int size = 1, unsigned int align = 1);
|
PType(unsigned int size = 1, unsigned int align = 1);
|
||||||
virtual ~PType();
|
virtual ~PType();
|
||||||
|
|
|
@ -1492,8 +1492,12 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
|
||||||
auto name = field->Names;
|
auto name = field->Names;
|
||||||
do
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1548,6 +1552,10 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
|
||||||
|
|
||||||
if (OutNamespace->Symbols.AddSymbol(f) == nullptr)
|
if (OutNamespace->Symbols.AddSymbol(f) == nullptr)
|
||||||
{ // name is already in use
|
{ // name is already in use
|
||||||
|
if (type != nullptr)
|
||||||
|
{
|
||||||
|
type->SizeKnown = false;
|
||||||
|
}
|
||||||
f->Destroy();
|
f->Destroy();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1577,6 +1585,12 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
|
||||||
} while (name != field->Names);
|
} while (name != field->Names);
|
||||||
Fields.Delete(0);
|
Fields.Delete(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type != nullptr)
|
||||||
|
{
|
||||||
|
type->SizeKnown = Fields.Size() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
return Fields.Size() == 0;
|
return Fields.Size() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue