mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
- took PTypeBase and all its subclasses out of the DObject hierarchy.
- moved scope flag to a new variable that is specific to PType instead of hijacking the ObjectFlags for this.
This commit is contained in:
parent
988fe8d735
commit
98dab9c4b9
14 changed files with 71 additions and 316 deletions
|
@ -377,6 +377,8 @@ static inline void GC::WriteBarrier(DObject *pointed)
|
|||
}
|
||||
}
|
||||
|
||||
#include "memarena.h"
|
||||
extern FMemArena ClassDataAllocator;
|
||||
#include "symbols.h"
|
||||
#include "dobjtype.h"
|
||||
|
||||
|
|
|
@ -367,8 +367,6 @@ static void MarkRoot()
|
|||
}
|
||||
Mark(SectorMarker);
|
||||
Mark(interpolator.Head);
|
||||
// Mark global symbols
|
||||
Namespaces.MarkSymbols();
|
||||
// Mark bot stuff.
|
||||
Mark(bglobal.firstthing);
|
||||
Mark(bglobal.body1);
|
||||
|
|
|
@ -25,9 +25,6 @@ enum EObjectFlags
|
|||
OF_Transient = 1 << 11, // Object should not be archived (references to it will be nulled on disk)
|
||||
OF_Spawned = 1 << 12, // Thinker was spawned at all (some thinkers get deleted before spawning)
|
||||
OF_Released = 1 << 13, // Object was released from the GC system and should not be processed by GC function
|
||||
OF_Abstract = 1 << 14, // Marks a class that cannot be created with new() function at all
|
||||
OF_UI = 1 << 15, // Marks a class that defaults to VARF_UI for it's fields/methods
|
||||
OF_Play = 1 << 16, // Marks a class that defaults to VARF_Play for it's fields/methods
|
||||
};
|
||||
|
||||
template<class T> class TObjPtr;
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#error You must #include "dobject.h" to get dobjtype.h
|
||||
#endif
|
||||
|
||||
#include "memarena.h"
|
||||
|
||||
typedef std::pair<const class PType *, unsigned> FTypeAndOffset;
|
||||
|
||||
#if 0
|
||||
|
@ -28,8 +26,6 @@ class VMFunction;
|
|||
class PClassType;
|
||||
struct FNamespaceManager;
|
||||
|
||||
extern FMemArena ClassDataAllocator;
|
||||
|
||||
enum
|
||||
{
|
||||
TentativeClass = UINT_MAX,
|
||||
|
|
|
@ -77,7 +77,6 @@ cycle_t ActionCycles;
|
|||
|
||||
class PActorInfo : public PCompoundType
|
||||
{
|
||||
DECLARE_CLASS(PActorInfo, PCompoundType);
|
||||
public:
|
||||
PActorInfo()
|
||||
:PCompoundType(sizeof(FActorInfo), alignof(FActorInfo))
|
||||
|
@ -113,8 +112,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(PActorInfo, false, false)
|
||||
|
||||
void AddActorInfo(PClass *cls)
|
||||
{
|
||||
auto type = new PActorInfo;
|
||||
|
|
|
@ -5159,8 +5159,8 @@ FxExpression *FxNew::Resolve(FCompileContext &ctx)
|
|||
//
|
||||
int outerside = ctx.Function && ctx.Function->Variants.Size() ? FScopeBarrier::SideFromFlags(ctx.Function->Variants[0].Flags) : FScopeBarrier::Side_Virtual;
|
||||
if (outerside == FScopeBarrier::Side_Virtual)
|
||||
outerside = FScopeBarrier::SideFromObjectFlags(ctx.Class->ObjectFlags);
|
||||
int innerside = FScopeBarrier::SideFromObjectFlags(cls->VMType->ObjectFlags);
|
||||
outerside = FScopeBarrier::SideFromObjectFlags(ctx.Class->ScopeFlags);
|
||||
int innerside = FScopeBarrier::SideFromObjectFlags(cls->VMType->ScopeFlags);
|
||||
if ((outerside != innerside) && (innerside != FScopeBarrier::Side_PlainData)) // "cannot construct ui class ... from data context"
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Cannot construct %s class %s from %s context", FScopeBarrier::StringFromSide(innerside), cls->TypeName.GetChars(), FScopeBarrier::StringFromSide(outerside));
|
||||
|
@ -5190,7 +5190,7 @@ ExpEmit FxNew::Emit(VMFunctionBuilder *build)
|
|||
{
|
||||
int outerside = FScopeBarrier::SideFromFlags(CallingFunction->Variants[0].Flags);
|
||||
if (outerside == FScopeBarrier::Side_Virtual)
|
||||
outerside = FScopeBarrier::SideFromObjectFlags(CallingFunction->OwningClass->ObjectFlags);
|
||||
outerside = FScopeBarrier::SideFromObjectFlags(CallingFunction->OwningClass->ScopeFlags);
|
||||
build->Emit(OP_NEW, to.RegNum, from.RegNum, outerside+1); // +1 to ensure it's not 0
|
||||
}
|
||||
else
|
||||
|
@ -6947,7 +6947,7 @@ bool FxStructMember::RequestAddress(FCompileContext &ctx, bool *writable)
|
|||
{
|
||||
outerflags = ctx.Function->Variants[0].Flags;
|
||||
if (((outerflags & (VARF_VirtualScope | VARF_Virtual)) == (VARF_VirtualScope | VARF_Virtual)) && ctx.Class)
|
||||
outerflags = FScopeBarrier::FlagsFromSide(FScopeBarrier::SideFromObjectFlags(ctx.Class->ObjectFlags));
|
||||
outerflags = FScopeBarrier::FlagsFromSide(FScopeBarrier::SideFromObjectFlags(ctx.Class->ScopeFlags));
|
||||
}
|
||||
FScopeBarrier scopeBarrier(outerflags, FScopeBarrier::FlagsFromSide(BarrierSide), membervar->SymbolName.GetChars());
|
||||
if (!scopeBarrier.writable)
|
||||
|
@ -6991,7 +6991,7 @@ FxExpression *FxStructMember::Resolve(FCompileContext &ctx)
|
|||
{
|
||||
outerflags = ctx.Function->Variants[0].Flags;
|
||||
if (((outerflags & (VARF_VirtualScope | VARF_Virtual)) == (VARF_VirtualScope | VARF_Virtual)) && ctx.Class)
|
||||
outerflags = FScopeBarrier::FlagsFromSide(FScopeBarrier::SideFromObjectFlags(ctx.Class->ObjectFlags));
|
||||
outerflags = FScopeBarrier::FlagsFromSide(FScopeBarrier::SideFromObjectFlags(ctx.Class->ScopeFlags));
|
||||
}
|
||||
FScopeBarrier scopeBarrier(outerflags, membervar->Flags, membervar->SymbolName.GetChars());
|
||||
if (!scopeBarrier.readable)
|
||||
|
@ -7619,14 +7619,14 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
|||
{
|
||||
outerflags = ctx.Function->Variants[0].Flags;
|
||||
if (((outerflags & (VARF_VirtualScope | VARF_Virtual)) == (VARF_VirtualScope | VARF_Virtual)) && ctx.Class)
|
||||
outerflags = FScopeBarrier::FlagsFromSide(FScopeBarrier::SideFromObjectFlags(ctx.Class->ObjectFlags));
|
||||
outerflags = FScopeBarrier::FlagsFromSide(FScopeBarrier::SideFromObjectFlags(ctx.Class->ScopeFlags));
|
||||
}
|
||||
int innerflags = afd->Variants[0].Flags;
|
||||
int innerside = FScopeBarrier::SideFromFlags(innerflags);
|
||||
// [ZZ] check this at compile time. this would work for most legit cases.
|
||||
if (innerside == FScopeBarrier::Side_Virtual)
|
||||
{
|
||||
innerside = FScopeBarrier::SideFromObjectFlags(ctx.Class->ObjectFlags);
|
||||
innerside = FScopeBarrier::SideFromObjectFlags(ctx.Class->ScopeFlags);
|
||||
innerflags = FScopeBarrier::FlagsFromSide(innerside);
|
||||
}
|
||||
FScopeBarrier scopeBarrier(outerflags, innerflags, MethodName.GetChars());
|
||||
|
@ -8300,14 +8300,14 @@ isresolved:
|
|||
{
|
||||
outerflags = ctx.Function->Variants[0].Flags;
|
||||
if (((outerflags & (VARF_VirtualScope | VARF_Virtual)) == (VARF_VirtualScope | VARF_Virtual)) && ctx.Class)
|
||||
outerflags = FScopeBarrier::FlagsFromSide(FScopeBarrier::SideFromObjectFlags(ctx.Class->ObjectFlags));
|
||||
outerflags = FScopeBarrier::FlagsFromSide(FScopeBarrier::SideFromObjectFlags(ctx.Class->ScopeFlags));
|
||||
}
|
||||
int innerflags = afd->Variants[0].Flags;
|
||||
int innerside = FScopeBarrier::SideFromFlags(innerflags);
|
||||
// [ZZ] check this at compile time. this would work for most legit cases.
|
||||
if (innerside == FScopeBarrier::Side_Virtual)
|
||||
{
|
||||
innerside = FScopeBarrier::SideFromObjectFlags(cls->ObjectFlags);
|
||||
innerside = FScopeBarrier::SideFromObjectFlags(cls->ScopeFlags);
|
||||
innerflags = FScopeBarrier::FlagsFromSide(innerside);
|
||||
}
|
||||
else if (innerside != FScopeBarrier::Side_Clear)
|
||||
|
@ -8938,11 +8938,11 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build)
|
|||
|
||||
if (innerside == FScopeBarrier::Side_Virtual)
|
||||
{
|
||||
auto selfside = FScopeBarrier::SideFromObjectFlags(Self->ValueType->toPointer()->PointedType->ObjectFlags);
|
||||
auto selfside = FScopeBarrier::SideFromObjectFlags(Self->ValueType->toPointer()->PointedType->ScopeFlags);
|
||||
|
||||
int outerside = FScopeBarrier::SideFromFlags(CallingFunction->Variants[0].Flags);
|
||||
if (outerside == FScopeBarrier::Side_Virtual)
|
||||
outerside = FScopeBarrier::SideFromObjectFlags(CallingFunction->OwningClass->ObjectFlags);
|
||||
outerside = FScopeBarrier::SideFromObjectFlags(CallingFunction->OwningClass->ScopeFlags);
|
||||
|
||||
// [ZZ] only emit if target side cannot be checked at compile time.
|
||||
if (selfside == FScopeBarrier::Side_PlainData)
|
||||
|
|
|
@ -19,11 +19,11 @@ int FScopeBarrier::SideFromFlags(int flags)
|
|||
}
|
||||
|
||||
// same as above, but from object flags
|
||||
int FScopeBarrier::SideFromObjectFlags(int flags)
|
||||
int FScopeBarrier::SideFromObjectFlags(EScopeFlags flags)
|
||||
{
|
||||
if (flags & OF_UI)
|
||||
if (flags & Scope_UI)
|
||||
return Side_UI;
|
||||
if (flags & OF_Play)
|
||||
if (flags & Scope_Play)
|
||||
return Side_Play;
|
||||
return Side_PlainData;
|
||||
}
|
||||
|
@ -46,16 +46,16 @@ int FScopeBarrier::FlagsFromSide(int side)
|
|||
}
|
||||
}
|
||||
|
||||
int FScopeBarrier::ObjectFlagsFromSide(int side)
|
||||
EScopeFlags FScopeBarrier::ObjectFlagsFromSide(int side)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case Side_Play:
|
||||
return OF_Play;
|
||||
return Scope_Play;
|
||||
case Side_UI:
|
||||
return OF_UI;
|
||||
return Scope_UI;
|
||||
default:
|
||||
return 0;
|
||||
return Scope_All;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,11 +88,12 @@ int FScopeBarrier::ChangeSideInFlags(int flags, int side)
|
|||
}
|
||||
|
||||
// this modifies OF_ flags and sets the side properly.
|
||||
int FScopeBarrier::ChangeSideInObjectFlags(int flags, int side)
|
||||
EScopeFlags FScopeBarrier::ChangeSideInObjectFlags(EScopeFlags flags, int side)
|
||||
{
|
||||
flags &= ~(OF_UI | OF_Play);
|
||||
flags |= ObjectFlagsFromSide(side);
|
||||
return flags;
|
||||
int f = int(flags);
|
||||
f &= ~(Scope_UI | Scope_Play);
|
||||
f |= ObjectFlagsFromSide(side);
|
||||
return (EScopeFlags)flags;
|
||||
}
|
||||
|
||||
FScopeBarrier::FScopeBarrier()
|
||||
|
@ -177,14 +178,14 @@ void FScopeBarrier::AddFlags(int flags1, int flags2, const char* name)
|
|||
// these are for vmexec.h
|
||||
void FScopeBarrier::ValidateNew(PClass* cls, int outerside)
|
||||
{
|
||||
int innerside = FScopeBarrier::SideFromObjectFlags(cls->VMType->ObjectFlags);
|
||||
int innerside = FScopeBarrier::SideFromObjectFlags(cls->VMType->ScopeFlags);
|
||||
if ((outerside != innerside) && (innerside != FScopeBarrier::Side_PlainData)) // "cannot construct ui class ... from data context"
|
||||
ThrowAbortException(X_OTHER, "Cannot construct %s class %s from %s context", FScopeBarrier::StringFromSide(innerside), cls->TypeName.GetChars(), FScopeBarrier::StringFromSide(outerside));
|
||||
}
|
||||
|
||||
void FScopeBarrier::ValidateCall(PClass* selftype, VMFunction *calledfunc, int outerside)
|
||||
{
|
||||
int innerside = FScopeBarrier::SideFromObjectFlags(selftype->VMType->ObjectFlags);
|
||||
int innerside = FScopeBarrier::SideFromObjectFlags(selftype->VMType->ScopeFlags);
|
||||
if ((outerside != innerside) && (innerside != FScopeBarrier::Side_PlainData))
|
||||
ThrowAbortException(X_OTHER, "Cannot call %s function %s from %s context", FScopeBarrier::StringFromSide(innerside), calledfunc->PrintableName.GetChars(), FScopeBarrier::StringFromSide(outerside));
|
||||
}
|
|
@ -2,6 +2,13 @@
|
|||
|
||||
#include "zstring.h"
|
||||
|
||||
enum EScopeFlags
|
||||
{
|
||||
Scope_All = 0,
|
||||
Scope_UI = 1, // Marks a class that defaults to VARF_UI for its fields/methods
|
||||
Scope_Play = 2, // Marks a class that defaults to VARF_Play for its fields/methods
|
||||
};
|
||||
|
||||
class PClass;
|
||||
class VMFunction;
|
||||
|
||||
|
@ -34,11 +41,11 @@ struct FScopeBarrier
|
|||
static int SideFromFlags(int flags);
|
||||
|
||||
// same as above, but from object flags
|
||||
static int SideFromObjectFlags(int flags);
|
||||
static int SideFromObjectFlags(EScopeFlags flags);
|
||||
|
||||
//
|
||||
static int FlagsFromSide(int side);
|
||||
static int ObjectFlagsFromSide(int side);
|
||||
static EScopeFlags ObjectFlagsFromSide(int side);
|
||||
|
||||
// used for errors
|
||||
static const char* StringFromSide(int side);
|
||||
|
@ -46,7 +53,7 @@ struct FScopeBarrier
|
|||
// this modifies VARF_ flags and sets the side properly.
|
||||
static int ChangeSideInFlags(int flags, int side);
|
||||
// this modifies OF_ flags and sets the side properly.
|
||||
static int ChangeSideInObjectFlags(int flags, int side);
|
||||
static EScopeFlags ChangeSideInObjectFlags(EScopeFlags flags, int side);
|
||||
FScopeBarrier();
|
||||
FScopeBarrier(int flags1, int flags2, const char* name);
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ PClassActor *DecoDerivedClass(const FScriptPosition &sc, PClassActor *parent, FN
|
|||
{
|
||||
// [ZZ] DECORATE classes are always play
|
||||
auto vmtype = type->VMType;
|
||||
vmtype->ObjectFlags = FScopeBarrier::ChangeSideInObjectFlags(vmtype->ObjectFlags, FScopeBarrier::Side_Play);
|
||||
vmtype->ScopeFlags = FScopeBarrier::ChangeSideInObjectFlags(vmtype->ScopeFlags, FScopeBarrier::Side_Play);
|
||||
}
|
||||
|
||||
return type;
|
||||
|
|
|
@ -47,7 +47,6 @@ FNamespaceManager Namespaces;
|
|||
|
||||
// Symbol tables ------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(PTypeBase, true, false);
|
||||
IMPLEMENT_CLASS(PSymbol, true, false);
|
||||
IMPLEMENT_CLASS(PSymbolConst, false, false);
|
||||
IMPLEMENT_CLASS(PSymbolConstNumeric, false, false);
|
||||
|
@ -56,12 +55,6 @@ IMPLEMENT_CLASS(PSymbolTreeNode, false, false)
|
|||
IMPLEMENT_CLASS(PSymbolType, false, false)
|
||||
IMPLEMENT_CLASS(PSymbolVMFunction, false, false)
|
||||
IMPLEMENT_CLASS(PFunction, false, false)
|
||||
IMPLEMENT_CLASS(PNamespace, false, true)
|
||||
|
||||
IMPLEMENT_POINTERS_START(PNamespace)
|
||||
IMPLEMENT_POINTER(Parent)
|
||||
IMPLEMENT_POINTERS_END
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -523,21 +516,6 @@ PNamespace *FNamespaceManager::NewNamespace(int filenum)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
size_t FNamespaceManager::MarkSymbols()
|
||||
{
|
||||
for (auto ns : AllNamespaces)
|
||||
{
|
||||
GC::Mark(ns);
|
||||
}
|
||||
return AllNamespaces.Size();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FNamespaceManager::ReleaseSymbols()
|
||||
{
|
||||
RemoveSymbols();
|
||||
|
@ -559,7 +537,7 @@ int FNamespaceManager::RemoveSymbols()
|
|||
for (auto ns : AllNamespaces)
|
||||
{
|
||||
count += ns->Symbols.Symbols.CountUsed();
|
||||
ns->Symbols.ReleaseSymbols();
|
||||
delete ns;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
// Note: This must not be included by anything but dobject.h!
|
||||
#pragma once
|
||||
|
||||
#ifndef __DOBJECT_H__
|
||||
#error You must #include "dobject.h" to get symbols.h
|
||||
#endif
|
||||
|
||||
|
||||
class VMFunction;
|
||||
class PType;
|
||||
|
@ -14,11 +10,18 @@ class PContainerType;
|
|||
|
||||
// Symbol information -------------------------------------------------------
|
||||
|
||||
class PTypeBase : public DObject
|
||||
class PTypeBase
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(PTypeBase, DObject)
|
||||
|
||||
public:
|
||||
// Allocate everything on the global memory arena because all subtypes of this
|
||||
// will live until the end of the game.
|
||||
void *operator new(size_t size)
|
||||
{
|
||||
return ClassDataAllocator.Alloc(size);
|
||||
}
|
||||
|
||||
void operator delete(void *)
|
||||
{}
|
||||
};
|
||||
|
||||
class PSymbol : public DObject
|
||||
|
@ -249,15 +252,11 @@ private:
|
|||
|
||||
class PNamespace : public PTypeBase
|
||||
{
|
||||
DECLARE_CLASS(PNamespace, PTypeBase)
|
||||
HAS_OBJECT_POINTERS;
|
||||
|
||||
public:
|
||||
PSymbolTable Symbols;
|
||||
PNamespace *Parent;
|
||||
int FileNum; // This is for blocking DECORATE access to later files.
|
||||
|
||||
PNamespace() {}
|
||||
PNamespace(int filenum, PNamespace *parent);
|
||||
};
|
||||
|
||||
|
@ -268,7 +267,6 @@ struct FNamespaceManager
|
|||
|
||||
FNamespaceManager();
|
||||
PNamespace *NewNamespace(int filenum);
|
||||
size_t MarkSymbols();
|
||||
void ReleaseSymbols();
|
||||
int RemoveSymbols();
|
||||
};
|
||||
|
|
|
@ -68,9 +68,6 @@ PPointer *TypeVoidPtr;
|
|||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(PErrorType, false, false)
|
||||
IMPLEMENT_CLASS(PVoidType, false, false)
|
||||
|
||||
void DumpTypeTable()
|
||||
{
|
||||
int used = 0;
|
||||
|
@ -116,8 +113,6 @@ void DumpTypeTable()
|
|||
|
||||
/* PType ******************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PType, true, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PType Parameterized Constructor
|
||||
|
@ -375,8 +370,6 @@ void PType::StaticInit()
|
|||
|
||||
/* PBasicType *************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PBasicType, true, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PBasicType Parameterized Constructor
|
||||
|
@ -392,8 +385,6 @@ PBasicType::PBasicType(unsigned int size, unsigned int align)
|
|||
|
||||
/* PCompoundType **********************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PCompoundType, true, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PBasicType Parameterized Constructor
|
||||
|
@ -408,8 +399,6 @@ PCompoundType::PCompoundType(unsigned int size, unsigned int align)
|
|||
|
||||
/* PContainerType *************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PContainerType, true, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PContainerType :: IsMatch
|
||||
|
@ -418,7 +407,7 @@ IMPLEMENT_CLASS(PContainerType, true, false)
|
|||
|
||||
bool PContainerType::IsMatch(intptr_t id1, intptr_t id2) const
|
||||
{
|
||||
const DObject *outer = (const DObject *)id1;
|
||||
const PTypeBase *outer = (const PTypeBase *)id1;
|
||||
FName name = (ENamedName)(intptr_t)id2;
|
||||
|
||||
return Outer == outer && TypeName == name;
|
||||
|
@ -438,23 +427,6 @@ void PContainerType::GetTypeIDs(intptr_t &id1, intptr_t &id2) const
|
|||
|
||||
/* PInt *******************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PInt, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PInt Default Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PInt::PInt()
|
||||
: PBasicType(4, 4), Unsigned(false), IntCompatible(true)
|
||||
{
|
||||
mDescriptiveName = "SInt32";
|
||||
Symbols.AddSymbol(new PSymbolConstNumeric(NAME_Min, this, -0x7FFFFFFF - 1));
|
||||
Symbols.AddSymbol(new PSymbolConstNumeric(NAME_Max, this, 0x7FFFFFFF));
|
||||
SetOps();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PInt Parameterized Constructor
|
||||
|
@ -678,8 +650,6 @@ double PInt::GetValueFloat(void *addr) const
|
|||
|
||||
/* PBool ******************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PBool, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PInt :: SetValue
|
||||
|
@ -722,8 +692,6 @@ PBool::PBool()
|
|||
|
||||
/* PFloat *****************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PFloat, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PFloat Parameterized Constructor
|
||||
|
@ -968,8 +936,6 @@ void PFloat::SetOps()
|
|||
|
||||
/* PString ****************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PString, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PString Default Constructor
|
||||
|
@ -1065,8 +1031,6 @@ void PString::DestroyValue(void *addr) const
|
|||
|
||||
/* PName ******************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PName, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PName Default Constructor
|
||||
|
@ -1116,8 +1080,6 @@ bool PName::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
|||
|
||||
/* PSpriteID ******************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PSpriteID, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PName Default Constructor
|
||||
|
@ -1159,8 +1121,6 @@ bool PSpriteID::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
|||
|
||||
/* PTextureID ******************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PTextureID, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PTextureID Default Constructor
|
||||
|
@ -1203,8 +1163,6 @@ bool PTextureID::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
|||
|
||||
/* PSound *****************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PSound, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PSound Default Constructor
|
||||
|
@ -1254,8 +1212,6 @@ bool PSound::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
|||
|
||||
/* PColor *****************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PColor, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PColor Default Constructor
|
||||
|
@ -1272,8 +1228,6 @@ PColor::PColor()
|
|||
|
||||
/* PStateLabel *****************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PStateLabel, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStateLabel Default Constructor
|
||||
|
@ -1289,8 +1243,6 @@ PStateLabel::PStateLabel()
|
|||
|
||||
/* PPointer ***************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PPointer, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PPointer - Default Constructor
|
||||
|
@ -1395,8 +1347,6 @@ bool PPointer::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
|||
|
||||
/* PObjectPointer **********************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PObjectPointer, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PPointer :: GetStoreOp
|
||||
|
@ -1488,8 +1438,6 @@ PPointer *NewPointer(PClass *cls, bool isconst)
|
|||
|
||||
/* PStatePointer **********************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PStatePointer, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStatePointer Default Constructor
|
||||
|
@ -1531,8 +1479,6 @@ bool PStatePointer::ReadValue(FSerializer &ar, const char *key, void *addr) cons
|
|||
|
||||
/* PClassPointer **********************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PClassPointer,false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PClassPointer - Parameterized Constructor
|
||||
|
@ -1641,20 +1587,6 @@ PClassPointer *NewClassPointer(PClass *restrict)
|
|||
|
||||
/* PEnum ******************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PEnum, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PEnum - Default Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PEnum::PEnum()
|
||||
: PInt(4, false)
|
||||
{
|
||||
mDescriptiveName = "Enum";
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PEnum - Parameterized Constructor
|
||||
|
@ -1694,20 +1626,6 @@ PEnum *NewEnum(FName name, PTypeBase *outer)
|
|||
|
||||
/* PArray *****************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PArray, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PArray - Default Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PArray::PArray()
|
||||
: ElementType(nullptr), ElementCount(0)
|
||||
{
|
||||
mDescriptiveName = "Array";
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PArray - Parameterized Constructor
|
||||
|
@ -1854,19 +1772,6 @@ PArray *NewArray(PType *type, unsigned int count)
|
|||
|
||||
/* PArray *****************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PStaticArray, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PArray - Default Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PStaticArray::PStaticArray()
|
||||
{
|
||||
mDescriptiveName = "ResizableArray";
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PArray - Parameterized Constructor
|
||||
|
@ -1928,22 +1833,6 @@ PStaticArray *NewStaticArray(PType *type)
|
|||
|
||||
/* PDynArray **************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PDynArray, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PDynArray - Default Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PDynArray::PDynArray()
|
||||
: ElementType(nullptr)
|
||||
{
|
||||
mDescriptiveName = "DynArray";
|
||||
Size = sizeof(FArray);
|
||||
Align = alignof(FArray);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PDynArray - Parameterized Constructor
|
||||
|
@ -2064,7 +1953,7 @@ void PDynArray::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffs
|
|||
|
||||
void PDynArray::SetPointerArray(void *base, unsigned offset, TArray<size_t> *special) const
|
||||
{
|
||||
if (ElementType->IsKindOf(RUNTIME_CLASS(PObjectPointer)))
|
||||
if (ElementType->isObjectPointer())
|
||||
{
|
||||
// Add to the list of pointer arrays for this class.
|
||||
special->Push(offset);
|
||||
|
@ -2179,22 +2068,6 @@ PDynArray *NewDynArray(PType *type)
|
|||
|
||||
/* PMap *******************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PMap, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PMap - Default Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PMap::PMap()
|
||||
: KeyType(nullptr), ValueType(nullptr)
|
||||
{
|
||||
mDescriptiveName = "Map";
|
||||
Size = sizeof(FMap);
|
||||
Align = alignof(FMap);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PMap - Parameterized Constructor
|
||||
|
@ -2258,20 +2131,6 @@ PMap *NewMap(PType *keytype, PType *valuetype)
|
|||
|
||||
/* PStruct ****************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PStruct, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStruct - Default Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PStruct::PStruct()
|
||||
{
|
||||
mDescriptiveName = "Struct";
|
||||
Size = 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStruct - Parameterized Constructor
|
||||
|
@ -2410,18 +2269,6 @@ PStruct *NewStruct(FName name, PTypeBase *outer, bool native)
|
|||
|
||||
/* PPrototype *************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PPrototype, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PPrototype - Default Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PPrototype::PPrototype()
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PPrototype - Parameterized Constructor
|
||||
|
@ -2459,20 +2306,6 @@ void PPrototype::GetTypeIDs(intptr_t &id1, intptr_t &id2) const
|
|||
id2 = (intptr_t)&ReturnTypes;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PPrototype :: PropagateMark
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
size_t PPrototype::PropagateMark()
|
||||
{
|
||||
GC::MarkArray(ArgumentTypes);
|
||||
GC::MarkArray(ReturnTypes);
|
||||
return (ArgumentTypes.Size() + ReturnTypes.Size()) * sizeof(void*) +
|
||||
Super::PropagateMark();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// NewPrototype
|
||||
|
@ -2496,8 +2329,6 @@ PPrototype *NewPrototype(const TArray<PType *> &rettypes, const TArray<PType *>
|
|||
|
||||
/* PClass *****************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PClassType, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -2514,6 +2345,7 @@ PClassType::PClassType(PClass *cls)
|
|||
ParentType = cls->ParentClass->VMType;
|
||||
assert(ParentType != nullptr);
|
||||
Symbols.SetParentTable(&ParentType->Symbols);
|
||||
ScopeFlags = ParentType->ScopeFlags;
|
||||
}
|
||||
cls->VMType = this;
|
||||
mDescriptiveName.Format("Class<%s>", cls->TypeName.GetChars());
|
||||
|
@ -2603,7 +2435,6 @@ void FTypeTable::AddType(PType *type, FName type_name, intptr_t parm1, intptr_t
|
|||
type->TypeTableType = type_name;
|
||||
type->HashNext = TypeHash[bucket];
|
||||
TypeHash[bucket] = type;
|
||||
type->Release();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -2625,7 +2456,6 @@ void FTypeTable::AddType(PType *type, FName type_name)
|
|||
|
||||
type->HashNext = TypeHash[bucket];
|
||||
TypeHash[bucket] = type;
|
||||
type->Release();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "dobject.h"
|
||||
#include "serializer.h"
|
||||
#include "scripting/backend/scopebarrier.h"
|
||||
|
||||
// Variable/parameter/field flags -------------------------------------------
|
||||
|
||||
|
@ -70,7 +71,6 @@ class PClassType;
|
|||
struct ZCC_ExprConstant;
|
||||
class PType : public PTypeBase
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(PType, PTypeBase)
|
||||
protected:
|
||||
|
||||
enum ETypeFlags
|
||||
|
@ -99,6 +99,7 @@ public:
|
|||
FString mDescriptiveName;
|
||||
VersionInfo mVersion = { 0,0,0 };
|
||||
uint8_t loadOp, storeOp, moveOp, RegType, RegCount;
|
||||
EScopeFlags ScopeFlags = (EScopeFlags)0;
|
||||
|
||||
PType(unsigned int size = 1, unsigned int align = 1);
|
||||
virtual ~PType();
|
||||
|
@ -210,14 +211,12 @@ public:
|
|||
|
||||
class PErrorType : public PType
|
||||
{
|
||||
DECLARE_CLASS(PErrorType, PType);
|
||||
public:
|
||||
PErrorType(int which = 1) : PType(0, which) {}
|
||||
};
|
||||
|
||||
class PVoidType : public PType
|
||||
{
|
||||
DECLARE_CLASS(PVoidType, PType);
|
||||
public:
|
||||
PVoidType() : PType(0, 1) {}
|
||||
};
|
||||
|
@ -226,21 +225,18 @@ public:
|
|||
|
||||
class PBasicType : public PType
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(PBasicType, PType);
|
||||
protected:
|
||||
PBasicType(unsigned int size = 1, unsigned int align = 1);
|
||||
};
|
||||
|
||||
class PCompoundType : public PType
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(PCompoundType, PType);
|
||||
protected:
|
||||
PCompoundType(unsigned int size = 1, unsigned int align = 1);
|
||||
};
|
||||
|
||||
class PContainerType : public PCompoundType
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(PContainerType, PCompoundType);
|
||||
public:
|
||||
PTypeBase *Outer; // object this type is contained within
|
||||
FName TypeName; // this type's name
|
||||
|
@ -266,7 +262,6 @@ public:
|
|||
|
||||
class PInt : public PBasicType
|
||||
{
|
||||
DECLARE_CLASS(PInt, PBasicType);
|
||||
public:
|
||||
PInt(unsigned int size, bool unsign, bool compatible = true);
|
||||
|
||||
|
@ -282,13 +277,11 @@ public:
|
|||
bool Unsigned;
|
||||
bool IntCompatible;
|
||||
protected:
|
||||
PInt();
|
||||
void SetOps();
|
||||
};
|
||||
|
||||
class PBool : public PInt
|
||||
{
|
||||
DECLARE_CLASS(PBool, PInt);
|
||||
public:
|
||||
PBool();
|
||||
virtual void SetValue(void *addr, int val);
|
||||
|
@ -299,7 +292,6 @@ public:
|
|||
|
||||
class PFloat : public PBasicType
|
||||
{
|
||||
DECLARE_CLASS(PFloat, PBasicType);
|
||||
public:
|
||||
PFloat(unsigned int size = 8);
|
||||
|
||||
|
@ -333,7 +325,6 @@ private:
|
|||
|
||||
class PString : public PBasicType
|
||||
{
|
||||
DECLARE_CLASS(PString, PBasicType);
|
||||
public:
|
||||
PString();
|
||||
|
||||
|
@ -348,7 +339,6 @@ public:
|
|||
|
||||
class PName : public PInt
|
||||
{
|
||||
DECLARE_CLASS(PName, PInt);
|
||||
public:
|
||||
PName();
|
||||
|
||||
|
@ -358,7 +348,6 @@ public:
|
|||
|
||||
class PSound : public PInt
|
||||
{
|
||||
DECLARE_CLASS(PSound, PInt);
|
||||
public:
|
||||
PSound();
|
||||
|
||||
|
@ -368,7 +357,6 @@ public:
|
|||
|
||||
class PSpriteID : public PInt
|
||||
{
|
||||
DECLARE_CLASS(PSpriteID, PInt);
|
||||
public:
|
||||
PSpriteID();
|
||||
|
||||
|
@ -378,7 +366,6 @@ public:
|
|||
|
||||
class PTextureID : public PInt
|
||||
{
|
||||
DECLARE_CLASS(PTextureID, PInt);
|
||||
public:
|
||||
PTextureID();
|
||||
|
||||
|
@ -388,14 +375,12 @@ public:
|
|||
|
||||
class PColor : public PInt
|
||||
{
|
||||
DECLARE_CLASS(PColor, PInt);
|
||||
public:
|
||||
PColor();
|
||||
};
|
||||
|
||||
class PStateLabel : public PInt
|
||||
{
|
||||
DECLARE_CLASS(PStateLabel, PInt);
|
||||
public:
|
||||
PStateLabel();
|
||||
};
|
||||
|
@ -404,7 +389,6 @@ public:
|
|||
|
||||
class PPointer : public PBasicType
|
||||
{
|
||||
DECLARE_CLASS(PPointer, PBasicType);
|
||||
|
||||
public:
|
||||
typedef void(*WriteHandler)(FSerializer &ar, const char *key, const void *addr);
|
||||
|
@ -437,7 +421,6 @@ protected:
|
|||
|
||||
class PStatePointer : public PPointer
|
||||
{
|
||||
DECLARE_CLASS(PStatePointer, PPointer);
|
||||
public:
|
||||
PStatePointer();
|
||||
|
||||
|
@ -448,7 +431,6 @@ public:
|
|||
|
||||
class PObjectPointer : public PPointer
|
||||
{
|
||||
DECLARE_CLASS(PObjectPointer, PPointer);
|
||||
public:
|
||||
PObjectPointer(PClass *pointedtype = nullptr, bool isconst = false);
|
||||
|
||||
|
@ -461,7 +443,6 @@ public:
|
|||
|
||||
class PClassPointer : public PPointer
|
||||
{
|
||||
DECLARE_CLASS(PClassPointer, PPointer);
|
||||
public:
|
||||
PClassPointer(class PClass *restrict = nullptr);
|
||||
|
||||
|
@ -480,19 +461,15 @@ public:
|
|||
|
||||
class PEnum : public PInt
|
||||
{
|
||||
DECLARE_CLASS(PEnum, PInt);
|
||||
public:
|
||||
PEnum(FName name, PTypeBase *outer);
|
||||
|
||||
PTypeBase *Outer;
|
||||
FName EnumName;
|
||||
protected:
|
||||
PEnum();
|
||||
};
|
||||
|
||||
class PArray : public PCompoundType
|
||||
{
|
||||
DECLARE_CLASS(PArray, PCompoundType);
|
||||
public:
|
||||
PArray(PType *etype, unsigned int ecount);
|
||||
|
||||
|
@ -508,27 +485,19 @@ public:
|
|||
|
||||
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special) override;
|
||||
void SetPointer(void *base, unsigned offset, TArray<size_t> *special) override;
|
||||
|
||||
protected:
|
||||
PArray();//deleteme
|
||||
};
|
||||
|
||||
class PStaticArray : public PArray
|
||||
{
|
||||
DECLARE_CLASS(PStaticArray, PArray);
|
||||
public:
|
||||
PStaticArray(PType *etype);
|
||||
|
||||
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
|
||||
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const;
|
||||
|
||||
protected:
|
||||
PStaticArray();// deleteme
|
||||
};
|
||||
|
||||
class PDynArray : public PCompoundType
|
||||
{
|
||||
DECLARE_CLASS(PDynArray, PCompoundType);
|
||||
public:
|
||||
PDynArray(PType *etype, PStruct *backing);
|
||||
|
||||
|
@ -544,14 +513,10 @@ public:
|
|||
void InitializeValue(void *addr, const void *def) const override;
|
||||
void DestroyValue(void *addr) const override;
|
||||
void SetPointerArray(void *base, unsigned offset, TArray<size_t> *ptrofs = NULL) const override;
|
||||
|
||||
protected:
|
||||
PDynArray(); // deleteme
|
||||
};
|
||||
|
||||
class PMap : public PCompoundType
|
||||
{
|
||||
DECLARE_CLASS(PMap, PCompoundType);
|
||||
public:
|
||||
PMap(PType *keytype, PType *valtype);
|
||||
|
||||
|
@ -560,14 +525,10 @@ public:
|
|||
|
||||
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
|
||||
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const;
|
||||
protected:
|
||||
PMap(); // deleteme
|
||||
};
|
||||
|
||||
class PStruct : public PContainerType
|
||||
{
|
||||
DECLARE_CLASS(PStruct, PContainerType);
|
||||
|
||||
public:
|
||||
PStruct(FName name, PTypeBase *outer, bool isnative = false);
|
||||
|
||||
|
@ -583,25 +544,18 @@ public:
|
|||
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
|
||||
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *specials) override;
|
||||
void SetPointer(void *base, unsigned offset, TArray<size_t> *specials) override;
|
||||
|
||||
protected:
|
||||
PStruct(); // deleteme
|
||||
};
|
||||
|
||||
class PPrototype : public PCompoundType
|
||||
{
|
||||
DECLARE_CLASS(PPrototype, PCompoundType);
|
||||
public:
|
||||
PPrototype(const TArray<PType *> &rettypes, const TArray<PType *> &argtypes);
|
||||
|
||||
TArray<PType *> ArgumentTypes;
|
||||
TArray<PType *> ReturnTypes;
|
||||
|
||||
size_t PropagateMark();
|
||||
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
|
||||
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const;
|
||||
protected:
|
||||
PPrototype(); // deleteme
|
||||
};
|
||||
|
||||
|
||||
|
@ -609,10 +563,6 @@ protected:
|
|||
|
||||
class PClassType : public PContainerType
|
||||
{
|
||||
DECLARE_CLASS(PClassType, PContainerType);
|
||||
|
||||
private:
|
||||
|
||||
public:
|
||||
PClass *Descriptor;
|
||||
PClassType *ParentType;
|
||||
|
|
|
@ -527,6 +527,7 @@ void ZCCCompiler::CreateStructTypes()
|
|||
s->strct->Type->mVersion = s->strct->Version;
|
||||
}
|
||||
|
||||
auto &sf = s->Type()->ScopeFlags;
|
||||
if (mVersion >= MakeVersion(2, 4, 0))
|
||||
{
|
||||
if ((s->strct->Flags & (ZCC_UIFlag | ZCC_Play)) == (ZCC_UIFlag | ZCC_Play))
|
||||
|
@ -534,19 +535,19 @@ void ZCCCompiler::CreateStructTypes()
|
|||
Error(s->strct, "Struct %s has incompatible flags", s->NodeName().GetChars());
|
||||
}
|
||||
|
||||
if (outer != OutNamespace) s->Type()->ObjectFlags = FScopeBarrier::ChangeSideInObjectFlags(s->Type()->ObjectFlags, FScopeBarrier::SideFromObjectFlags(outer->ObjectFlags));
|
||||
if (outer != OutNamespace) sf = FScopeBarrier::ChangeSideInObjectFlags(sf, FScopeBarrier::SideFromObjectFlags(static_cast<PType*>(outer)->ScopeFlags));
|
||||
else if (s->strct->Flags & ZCC_ClearScope) Warn(s->strct, "Useless 'ClearScope' on struct %s not inside a class", s->NodeName().GetChars());
|
||||
if (s->strct->Flags & ZCC_UIFlag)
|
||||
s->Type()->ObjectFlags = FScopeBarrier::ChangeSideInObjectFlags(s->Type()->ObjectFlags, FScopeBarrier::Side_UI);
|
||||
sf = FScopeBarrier::ChangeSideInObjectFlags(sf, FScopeBarrier::Side_UI);
|
||||
if (s->strct->Flags & ZCC_Play)
|
||||
s->Type()->ObjectFlags = FScopeBarrier::ChangeSideInObjectFlags(s->Type()->ObjectFlags, FScopeBarrier::Side_Play);
|
||||
sf = FScopeBarrier::ChangeSideInObjectFlags(sf, FScopeBarrier::Side_Play);
|
||||
if (s->strct->Flags & ZCC_ClearScope)
|
||||
s->Type()->ObjectFlags = FScopeBarrier::ChangeSideInObjectFlags(s->Type()->ObjectFlags, FScopeBarrier::Side_PlainData); // don't inherit the scope from the outer class
|
||||
sf = FScopeBarrier::ChangeSideInObjectFlags(sf, FScopeBarrier::Side_PlainData); // don't inherit the scope from the outer class
|
||||
}
|
||||
else
|
||||
{
|
||||
// old versions force 'play'.
|
||||
s->Type()->ObjectFlags = FScopeBarrier::ChangeSideInObjectFlags(s->Type()->ObjectFlags, FScopeBarrier::Side_Play);
|
||||
sf = FScopeBarrier::ChangeSideInObjectFlags(sf, FScopeBarrier::Side_Play);
|
||||
}
|
||||
s->strct->Symbol = new PSymbolType(s->NodeName(), s->Type());
|
||||
syms->AddSymbol(s->strct->Symbol);
|
||||
|
@ -663,7 +664,7 @@ void ZCCCompiler::CreateClassTypes()
|
|||
}
|
||||
|
||||
if (c->cls->Flags & ZCC_Abstract)
|
||||
c->Type()->ObjectFlags |= OF_Abstract;
|
||||
c->ClassType()->bAbstract = true;
|
||||
|
||||
if (c->cls->Flags & ZCC_Version)
|
||||
{
|
||||
|
@ -683,21 +684,21 @@ void ZCCCompiler::CreateClassTypes()
|
|||
}
|
||||
|
||||
if (c->cls->Flags & ZCC_UIFlag)
|
||||
c->Type()->ObjectFlags = (c->Type()->ObjectFlags&~OF_Play) | OF_UI;
|
||||
c->Type()->ScopeFlags = EScopeFlags((c->Type()->ScopeFlags&~Scope_Play) | Scope_UI);
|
||||
if (c->cls->Flags & ZCC_Play)
|
||||
c->Type()->ObjectFlags = (c->Type()->ObjectFlags&~OF_UI) | OF_Play;
|
||||
if (parent->VMType->ObjectFlags & (OF_UI | OF_Play)) // parent is either ui or play
|
||||
c->Type()->ScopeFlags = EScopeFlags((c->Type()->ScopeFlags&~Scope_UI) | Scope_Play);
|
||||
if (parent->VMType->ScopeFlags & (Scope_UI | Scope_Play)) // parent is either ui or play
|
||||
{
|
||||
if (c->cls->Flags & (ZCC_UIFlag | ZCC_Play))
|
||||
{
|
||||
Error(c->cls, "Can't change class scope in class %s", c->NodeName().GetChars());
|
||||
}
|
||||
c->Type()->ObjectFlags = FScopeBarrier::ChangeSideInObjectFlags(c->Type()->ObjectFlags, FScopeBarrier::SideFromObjectFlags(parent->VMType->ObjectFlags));
|
||||
c->Type()->ScopeFlags = FScopeBarrier::ChangeSideInObjectFlags(c->Type()->ScopeFlags, FScopeBarrier::SideFromObjectFlags(parent->VMType->ScopeFlags));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
c->Type()->ObjectFlags = FScopeBarrier::ChangeSideInObjectFlags(c->Type()->ObjectFlags, FScopeBarrier::Side_Play);
|
||||
c->Type()->ScopeFlags = FScopeBarrier::ChangeSideInObjectFlags(c->Type()->ScopeFlags, FScopeBarrier::Side_Play);
|
||||
}
|
||||
|
||||
c->cls->Symbol = new PSymbolType(c->NodeName(), c->Type());
|
||||
|
@ -1104,7 +1105,7 @@ ZCC_ExprTypeRef *ZCCCompiler::NodeFromSymbolType(PSymbolType *sym, ZCC_Expressio
|
|||
ZCC_ExprTypeRef *ref = static_cast<ZCC_ExprTypeRef *>(AST.InitNode(sizeof(*ref), AST_ExprTypeRef, idnode));
|
||||
ref->Operation = PEX_TypeRef;
|
||||
ref->RefType = sym->Type;
|
||||
ref->Type = NewClassPointer(RUNTIME_CLASS(PType));
|
||||
ref->Type = NewClassPointer(RUNTIME_CLASS(DObject));
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
@ -1245,9 +1246,9 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
|
|||
{
|
||||
if (type != nullptr)
|
||||
{
|
||||
if (type->ObjectFlags & OF_UI)
|
||||
if (type->ScopeFlags & Scope_UI)
|
||||
varflags |= VARF_UI;
|
||||
if (type->ObjectFlags & OF_Play)
|
||||
if (type->ScopeFlags & Scope_Play)
|
||||
varflags |= VARF_Play;
|
||||
}
|
||||
if (field->Flags & ZCC_UIFlag)
|
||||
|
@ -2366,9 +2367,9 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
if (f->Flags & ZCC_FuncConst) varflags |= VARF_ReadOnly; // FuncConst method is internally marked as VARF_ReadOnly
|
||||
if (mVersion >= MakeVersion(2, 4, 0))
|
||||
{
|
||||
if (c->Type()->ObjectFlags & OF_UI)
|
||||
if (c->Type()->ScopeFlags & Scope_UI)
|
||||
varflags |= VARF_UI;
|
||||
if (c->Type()->ObjectFlags & OF_Play)
|
||||
if (c->Type()->ScopeFlags & Scope_Play)
|
||||
varflags |= VARF_Play;
|
||||
//if (f->Flags & ZCC_FuncConst)
|
||||
// varflags = FScopeBarrier::ChangeSideInFlags(varflags, FScopeBarrier::Side_PlainData); // const implies clearscope. this is checked a bit later to also not have ZCC_Play/ZCC_UIFlag.
|
||||
|
|
Loading…
Reference in a new issue