diff --git a/src/common/scripting/core/types.h b/src/common/scripting/core/types.h index 58e213837..eae6891ee 100644 --- a/src/common/scripting/core/types.h +++ b/src/common/scripting/core/types.h @@ -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(); diff --git a/src/common/scripting/frontend/zcc_compile.cpp b/src/common/scripting/frontend/zcc_compile.cpp index 5c73fc1cc..0bc337bde 100644 --- a/src/common/scripting/frontend/zcc_compile.cpp +++ b/src/common/scripting/frontend/zcc_compile.cpp @@ -1476,8 +1476,12 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArrayNames; 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, TArraySymbols.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, TArrayNames); Fields.Delete(0); } + + if (type != nullptr) + { + type->SizeKnown = Fields.Size() == 0; + } + return Fields.Size() == 0; }