rename vm internal structs to make room for compilation-unit-internal structs/classes

This commit is contained in:
Ricardo Luís Vaz Silva 2025-03-04 08:59:03 -03:00
commit 909d211137
7 changed files with 54 additions and 53 deletions

View file

@ -110,7 +110,7 @@ public:
EScopeFlags ScopeFlags = (EScopeFlags)0;
bool SizeKnown = true;
bool TypeInternal = false;
bool VMInternalStruct = false;
bool TypeDeprecated = false; // mVersion is deprecation version, not minimum version
FString mDeprecationMessage;

View file

@ -442,12 +442,12 @@ struct_def(X) ::= EXTEND STRUCT(T) IDENTIFIER(A) LBRACE opt_struct_body(B) RBRAC
}
%type struct_flags{ClassFlagsBlock}
struct_flags(X) ::= . { X.Flags = 0; X.Version = {0, 0}; X.DeprecationMessage = NULL; }
struct_flags(X) ::= struct_flags(A) UI. { X.Flags = A.Flags | ZCC_UIFlag; X.Version = A.Version; X.DeprecationMessage = A.DeprecationMessage; }
struct_flags(X) ::= struct_flags(A) PLAY. { X.Flags = A.Flags | ZCC_Play; X.Version = A.Version; X.DeprecationMessage = A.DeprecationMessage; }
struct_flags(X) ::= struct_flags(A) CLEARSCOPE. { X.Flags = A.Flags | ZCC_ClearScope; X.Version = A.Version; X.DeprecationMessage = A.DeprecationMessage; }
struct_flags(X) ::= struct_flags(A) NATIVE. { X.Flags = A.Flags | ZCC_Native; X.Version = A.Version; X.DeprecationMessage = A.DeprecationMessage; }
struct_flags(X) ::= struct_flags(A) INTERNAL. { X.Flags = A.Flags | ZCC_Internal; X.Version = A.Version; X.DeprecationMessage = A.DeprecationMessage; }
struct_flags(X) ::= . { X.Flags = 0; X.Version = {0, 0}; X.DeprecationMessage = NULL; }
struct_flags(X) ::= struct_flags(A) UI. { X.Flags = A.Flags | ZCC_UIFlag; X.Version = A.Version; X.DeprecationMessage = A.DeprecationMessage; }
struct_flags(X) ::= struct_flags(A) PLAY. { X.Flags = A.Flags | ZCC_Play; X.Version = A.Version; X.DeprecationMessage = A.DeprecationMessage; }
struct_flags(X) ::= struct_flags(A) CLEARSCOPE. { X.Flags = A.Flags | ZCC_ClearScope; X.Version = A.Version; X.DeprecationMessage = A.DeprecationMessage; }
struct_flags(X) ::= struct_flags(A) NATIVE. { X.Flags = A.Flags | ZCC_Native; X.Version = A.Version; X.DeprecationMessage = A.DeprecationMessage; }
struct_flags(X) ::= struct_flags(A) UNSAFE LPAREN INTERNAL RPAREN. { X.Flags = A.Flags | ZCC_VMInternalStruct; X.Version = A.Version; X.DeprecationMessage = A.DeprecationMessage; }
struct_flags(X) ::= struct_flags(A) VERSION LPAREN STRCONST(C) RPAREN. { X.Flags = A.Flags | ZCC_Version; X.Version = C.String->GetChars(); X.DeprecationMessage = A.DeprecationMessage; }
struct_flags(X) ::= struct_flags(A) DEPRECATED LPAREN STRCONST(C) opt_deprecation_message(D) RPAREN.

View file

@ -758,11 +758,11 @@ void ZCCCompiler::CreateStructTypes()
s->strct->Type->mDeprecationMessage = s->strct->DeprecationMessage ? *s->strct->DeprecationMessage : "";
}
if (s->strct->Flags & ZCC_Internal)
if (s->strct->Flags & ZCC_VMInternalStruct)
{
if(fileSystem.GetFileContainer(Lump) == 0)
{
s->strct->Type->TypeInternal = true;
s->strct->Type->VMInternalStruct = true;
}
else
{
@ -2214,7 +2214,7 @@ PType *ZCCCompiler::ResolveUserType(PType *outertype, ZCC_BasicType *type, ZCC_I
}
//only allow references to internal types inside internal types
if (ptype->TypeInternal && !outertype->TypeInternal)
if (ptype->VMInternalStruct && !outertype->VMInternalStruct)
{
Error(type, "Type %s not accessible", FName(type->UserType->Id).GetChars());
return TypeError;

View file

@ -67,6 +67,7 @@ enum
ZCC_Sealed = 1 << 23,
ZCC_FuncConstUnsafe = 1 << 24,
ZCC_UnsafeClearScope = 1 << 25,
ZCC_VMInternalStruct = 1 << 26,
};
// Function parameter modifiers