mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 06:53:40 +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 "symbols.h"
|
||||||
#include "dobjtype.h"
|
#include "dobjtype.h"
|
||||||
|
|
||||||
|
|
|
@ -367,8 +367,6 @@ static void MarkRoot()
|
||||||
}
|
}
|
||||||
Mark(SectorMarker);
|
Mark(SectorMarker);
|
||||||
Mark(interpolator.Head);
|
Mark(interpolator.Head);
|
||||||
// Mark global symbols
|
|
||||||
Namespaces.MarkSymbols();
|
|
||||||
// Mark bot stuff.
|
// Mark bot stuff.
|
||||||
Mark(bglobal.firstthing);
|
Mark(bglobal.firstthing);
|
||||||
Mark(bglobal.body1);
|
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_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_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_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;
|
template<class T> class TObjPtr;
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
#error You must #include "dobject.h" to get dobjtype.h
|
#error You must #include "dobject.h" to get dobjtype.h
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "memarena.h"
|
|
||||||
|
|
||||||
typedef std::pair<const class PType *, unsigned> FTypeAndOffset;
|
typedef std::pair<const class PType *, unsigned> FTypeAndOffset;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -28,8 +26,6 @@ class VMFunction;
|
||||||
class PClassType;
|
class PClassType;
|
||||||
struct FNamespaceManager;
|
struct FNamespaceManager;
|
||||||
|
|
||||||
extern FMemArena ClassDataAllocator;
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
TentativeClass = UINT_MAX,
|
TentativeClass = UINT_MAX,
|
||||||
|
|
|
@ -77,7 +77,6 @@ cycle_t ActionCycles;
|
||||||
|
|
||||||
class PActorInfo : public PCompoundType
|
class PActorInfo : public PCompoundType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PActorInfo, PCompoundType);
|
|
||||||
public:
|
public:
|
||||||
PActorInfo()
|
PActorInfo()
|
||||||
:PCompoundType(sizeof(FActorInfo), alignof(FActorInfo))
|
:PCompoundType(sizeof(FActorInfo), alignof(FActorInfo))
|
||||||
|
@ -113,8 +112,6 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PActorInfo, false, false)
|
|
||||||
|
|
||||||
void AddActorInfo(PClass *cls)
|
void AddActorInfo(PClass *cls)
|
||||||
{
|
{
|
||||||
auto type = new PActorInfo;
|
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;
|
int outerside = ctx.Function && ctx.Function->Variants.Size() ? FScopeBarrier::SideFromFlags(ctx.Function->Variants[0].Flags) : FScopeBarrier::Side_Virtual;
|
||||||
if (outerside == FScopeBarrier::Side_Virtual)
|
if (outerside == FScopeBarrier::Side_Virtual)
|
||||||
outerside = FScopeBarrier::SideFromObjectFlags(ctx.Class->ObjectFlags);
|
outerside = FScopeBarrier::SideFromObjectFlags(ctx.Class->ScopeFlags);
|
||||||
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"
|
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));
|
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);
|
int outerside = FScopeBarrier::SideFromFlags(CallingFunction->Variants[0].Flags);
|
||||||
if (outerside == FScopeBarrier::Side_Virtual)
|
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
|
build->Emit(OP_NEW, to.RegNum, from.RegNum, outerside+1); // +1 to ensure it's not 0
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -6947,7 +6947,7 @@ bool FxStructMember::RequestAddress(FCompileContext &ctx, bool *writable)
|
||||||
{
|
{
|
||||||
outerflags = ctx.Function->Variants[0].Flags;
|
outerflags = ctx.Function->Variants[0].Flags;
|
||||||
if (((outerflags & (VARF_VirtualScope | VARF_Virtual)) == (VARF_VirtualScope | VARF_Virtual)) && ctx.Class)
|
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());
|
FScopeBarrier scopeBarrier(outerflags, FScopeBarrier::FlagsFromSide(BarrierSide), membervar->SymbolName.GetChars());
|
||||||
if (!scopeBarrier.writable)
|
if (!scopeBarrier.writable)
|
||||||
|
@ -6991,7 +6991,7 @@ FxExpression *FxStructMember::Resolve(FCompileContext &ctx)
|
||||||
{
|
{
|
||||||
outerflags = ctx.Function->Variants[0].Flags;
|
outerflags = ctx.Function->Variants[0].Flags;
|
||||||
if (((outerflags & (VARF_VirtualScope | VARF_Virtual)) == (VARF_VirtualScope | VARF_Virtual)) && ctx.Class)
|
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());
|
FScopeBarrier scopeBarrier(outerflags, membervar->Flags, membervar->SymbolName.GetChars());
|
||||||
if (!scopeBarrier.readable)
|
if (!scopeBarrier.readable)
|
||||||
|
@ -7619,14 +7619,14 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
||||||
{
|
{
|
||||||
outerflags = ctx.Function->Variants[0].Flags;
|
outerflags = ctx.Function->Variants[0].Flags;
|
||||||
if (((outerflags & (VARF_VirtualScope | VARF_Virtual)) == (VARF_VirtualScope | VARF_Virtual)) && ctx.Class)
|
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 innerflags = afd->Variants[0].Flags;
|
||||||
int innerside = FScopeBarrier::SideFromFlags(innerflags);
|
int innerside = FScopeBarrier::SideFromFlags(innerflags);
|
||||||
// [ZZ] check this at compile time. this would work for most legit cases.
|
// [ZZ] check this at compile time. this would work for most legit cases.
|
||||||
if (innerside == FScopeBarrier::Side_Virtual)
|
if (innerside == FScopeBarrier::Side_Virtual)
|
||||||
{
|
{
|
||||||
innerside = FScopeBarrier::SideFromObjectFlags(ctx.Class->ObjectFlags);
|
innerside = FScopeBarrier::SideFromObjectFlags(ctx.Class->ScopeFlags);
|
||||||
innerflags = FScopeBarrier::FlagsFromSide(innerside);
|
innerflags = FScopeBarrier::FlagsFromSide(innerside);
|
||||||
}
|
}
|
||||||
FScopeBarrier scopeBarrier(outerflags, innerflags, MethodName.GetChars());
|
FScopeBarrier scopeBarrier(outerflags, innerflags, MethodName.GetChars());
|
||||||
|
@ -8300,14 +8300,14 @@ isresolved:
|
||||||
{
|
{
|
||||||
outerflags = ctx.Function->Variants[0].Flags;
|
outerflags = ctx.Function->Variants[0].Flags;
|
||||||
if (((outerflags & (VARF_VirtualScope | VARF_Virtual)) == (VARF_VirtualScope | VARF_Virtual)) && ctx.Class)
|
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 innerflags = afd->Variants[0].Flags;
|
||||||
int innerside = FScopeBarrier::SideFromFlags(innerflags);
|
int innerside = FScopeBarrier::SideFromFlags(innerflags);
|
||||||
// [ZZ] check this at compile time. this would work for most legit cases.
|
// [ZZ] check this at compile time. this would work for most legit cases.
|
||||||
if (innerside == FScopeBarrier::Side_Virtual)
|
if (innerside == FScopeBarrier::Side_Virtual)
|
||||||
{
|
{
|
||||||
innerside = FScopeBarrier::SideFromObjectFlags(cls->ObjectFlags);
|
innerside = FScopeBarrier::SideFromObjectFlags(cls->ScopeFlags);
|
||||||
innerflags = FScopeBarrier::FlagsFromSide(innerside);
|
innerflags = FScopeBarrier::FlagsFromSide(innerside);
|
||||||
}
|
}
|
||||||
else if (innerside != FScopeBarrier::Side_Clear)
|
else if (innerside != FScopeBarrier::Side_Clear)
|
||||||
|
@ -8938,11 +8938,11 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build)
|
||||||
|
|
||||||
if (innerside == FScopeBarrier::Side_Virtual)
|
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);
|
int outerside = FScopeBarrier::SideFromFlags(CallingFunction->Variants[0].Flags);
|
||||||
if (outerside == FScopeBarrier::Side_Virtual)
|
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.
|
// [ZZ] only emit if target side cannot be checked at compile time.
|
||||||
if (selfside == FScopeBarrier::Side_PlainData)
|
if (selfside == FScopeBarrier::Side_PlainData)
|
||||||
|
|
|
@ -19,11 +19,11 @@ int FScopeBarrier::SideFromFlags(int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
// same as above, but from object 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;
|
return Side_UI;
|
||||||
if (flags & OF_Play)
|
if (flags & Scope_Play)
|
||||||
return Side_Play;
|
return Side_Play;
|
||||||
return Side_PlainData;
|
return Side_PlainData;
|
||||||
}
|
}
|
||||||
|
@ -46,16 +46,16 @@ int FScopeBarrier::FlagsFromSide(int side)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int FScopeBarrier::ObjectFlagsFromSide(int side)
|
EScopeFlags FScopeBarrier::ObjectFlagsFromSide(int side)
|
||||||
{
|
{
|
||||||
switch (side)
|
switch (side)
|
||||||
{
|
{
|
||||||
case Side_Play:
|
case Side_Play:
|
||||||
return OF_Play;
|
return Scope_Play;
|
||||||
case Side_UI:
|
case Side_UI:
|
||||||
return OF_UI;
|
return Scope_UI;
|
||||||
default:
|
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.
|
// 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);
|
int f = int(flags);
|
||||||
flags |= ObjectFlagsFromSide(side);
|
f &= ~(Scope_UI | Scope_Play);
|
||||||
return flags;
|
f |= ObjectFlagsFromSide(side);
|
||||||
|
return (EScopeFlags)flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
FScopeBarrier::FScopeBarrier()
|
FScopeBarrier::FScopeBarrier()
|
||||||
|
@ -177,14 +178,14 @@ void FScopeBarrier::AddFlags(int flags1, int flags2, const char* name)
|
||||||
// these are for vmexec.h
|
// these are for vmexec.h
|
||||||
void FScopeBarrier::ValidateNew(PClass* cls, int outerside)
|
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"
|
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));
|
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)
|
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))
|
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));
|
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"
|
#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 PClass;
|
||||||
class VMFunction;
|
class VMFunction;
|
||||||
|
|
||||||
|
@ -34,11 +41,11 @@ struct FScopeBarrier
|
||||||
static int SideFromFlags(int flags);
|
static int SideFromFlags(int flags);
|
||||||
|
|
||||||
// same as above, but from object 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 FlagsFromSide(int side);
|
||||||
static int ObjectFlagsFromSide(int side);
|
static EScopeFlags ObjectFlagsFromSide(int side);
|
||||||
|
|
||||||
// used for errors
|
// used for errors
|
||||||
static const char* StringFromSide(int side);
|
static const char* StringFromSide(int side);
|
||||||
|
@ -46,7 +53,7 @@ struct FScopeBarrier
|
||||||
// this modifies VARF_ flags and sets the side properly.
|
// this modifies VARF_ flags and sets the side properly.
|
||||||
static int ChangeSideInFlags(int flags, int side);
|
static int ChangeSideInFlags(int flags, int side);
|
||||||
// this modifies OF_ flags and sets the side properly.
|
// 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();
|
||||||
FScopeBarrier(int flags1, int flags2, const char* name);
|
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
|
// [ZZ] DECORATE classes are always play
|
||||||
auto vmtype = type->VMType;
|
auto vmtype = type->VMType;
|
||||||
vmtype->ObjectFlags = FScopeBarrier::ChangeSideInObjectFlags(vmtype->ObjectFlags, FScopeBarrier::Side_Play);
|
vmtype->ScopeFlags = FScopeBarrier::ChangeSideInObjectFlags(vmtype->ScopeFlags, FScopeBarrier::Side_Play);
|
||||||
}
|
}
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
|
|
|
@ -47,7 +47,6 @@ FNamespaceManager Namespaces;
|
||||||
|
|
||||||
// Symbol tables ------------------------------------------------------------
|
// Symbol tables ------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PTypeBase, true, false);
|
|
||||||
IMPLEMENT_CLASS(PSymbol, true, false);
|
IMPLEMENT_CLASS(PSymbol, true, false);
|
||||||
IMPLEMENT_CLASS(PSymbolConst, false, false);
|
IMPLEMENT_CLASS(PSymbolConst, false, false);
|
||||||
IMPLEMENT_CLASS(PSymbolConstNumeric, false, false);
|
IMPLEMENT_CLASS(PSymbolConstNumeric, false, false);
|
||||||
|
@ -56,12 +55,6 @@ IMPLEMENT_CLASS(PSymbolTreeNode, false, false)
|
||||||
IMPLEMENT_CLASS(PSymbolType, false, false)
|
IMPLEMENT_CLASS(PSymbolType, false, false)
|
||||||
IMPLEMENT_CLASS(PSymbolVMFunction, false, false)
|
IMPLEMENT_CLASS(PSymbolVMFunction, false, false)
|
||||||
IMPLEMENT_CLASS(PFunction, 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()
|
void FNamespaceManager::ReleaseSymbols()
|
||||||
{
|
{
|
||||||
RemoveSymbols();
|
RemoveSymbols();
|
||||||
|
@ -559,7 +537,7 @@ int FNamespaceManager::RemoveSymbols()
|
||||||
for (auto ns : AllNamespaces)
|
for (auto ns : AllNamespaces)
|
||||||
{
|
{
|
||||||
count += ns->Symbols.Symbols.CountUsed();
|
count += ns->Symbols.Symbols.CountUsed();
|
||||||
ns->Symbols.ReleaseSymbols();
|
delete ns;
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
// Note: This must not be included by anything but dobject.h!
|
// Note: This must not be included by anything but dobject.h!
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __DOBJECT_H__
|
|
||||||
#error You must #include "dobject.h" to get symbols.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
class VMFunction;
|
class VMFunction;
|
||||||
class PType;
|
class PType;
|
||||||
|
@ -14,11 +10,18 @@ class PContainerType;
|
||||||
|
|
||||||
// Symbol information -------------------------------------------------------
|
// Symbol information -------------------------------------------------------
|
||||||
|
|
||||||
class PTypeBase : public DObject
|
class PTypeBase
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(PTypeBase, DObject)
|
|
||||||
|
|
||||||
public:
|
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
|
class PSymbol : public DObject
|
||||||
|
@ -249,15 +252,11 @@ private:
|
||||||
|
|
||||||
class PNamespace : public PTypeBase
|
class PNamespace : public PTypeBase
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PNamespace, PTypeBase)
|
|
||||||
HAS_OBJECT_POINTERS;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PSymbolTable Symbols;
|
PSymbolTable Symbols;
|
||||||
PNamespace *Parent;
|
PNamespace *Parent;
|
||||||
int FileNum; // This is for blocking DECORATE access to later files.
|
int FileNum; // This is for blocking DECORATE access to later files.
|
||||||
|
|
||||||
PNamespace() {}
|
|
||||||
PNamespace(int filenum, PNamespace *parent);
|
PNamespace(int filenum, PNamespace *parent);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -268,7 +267,6 @@ struct FNamespaceManager
|
||||||
|
|
||||||
FNamespaceManager();
|
FNamespaceManager();
|
||||||
PNamespace *NewNamespace(int filenum);
|
PNamespace *NewNamespace(int filenum);
|
||||||
size_t MarkSymbols();
|
|
||||||
void ReleaseSymbols();
|
void ReleaseSymbols();
|
||||||
int RemoveSymbols();
|
int RemoveSymbols();
|
||||||
};
|
};
|
||||||
|
|
|
@ -68,9 +68,6 @@ PPointer *TypeVoidPtr;
|
||||||
|
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PErrorType, false, false)
|
|
||||||
IMPLEMENT_CLASS(PVoidType, false, false)
|
|
||||||
|
|
||||||
void DumpTypeTable()
|
void DumpTypeTable()
|
||||||
{
|
{
|
||||||
int used = 0;
|
int used = 0;
|
||||||
|
@ -116,8 +113,6 @@ void DumpTypeTable()
|
||||||
|
|
||||||
/* PType ******************************************************************/
|
/* PType ******************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PType, true, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PType Parameterized Constructor
|
// PType Parameterized Constructor
|
||||||
|
@ -375,8 +370,6 @@ void PType::StaticInit()
|
||||||
|
|
||||||
/* PBasicType *************************************************************/
|
/* PBasicType *************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PBasicType, true, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PBasicType Parameterized Constructor
|
// PBasicType Parameterized Constructor
|
||||||
|
@ -392,8 +385,6 @@ PBasicType::PBasicType(unsigned int size, unsigned int align)
|
||||||
|
|
||||||
/* PCompoundType **********************************************************/
|
/* PCompoundType **********************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PCompoundType, true, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PBasicType Parameterized Constructor
|
// PBasicType Parameterized Constructor
|
||||||
|
@ -408,8 +399,6 @@ PCompoundType::PCompoundType(unsigned int size, unsigned int align)
|
||||||
|
|
||||||
/* PContainerType *************************************************************/
|
/* PContainerType *************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PContainerType, true, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PContainerType :: IsMatch
|
// PContainerType :: IsMatch
|
||||||
|
@ -418,7 +407,7 @@ IMPLEMENT_CLASS(PContainerType, true, false)
|
||||||
|
|
||||||
bool PContainerType::IsMatch(intptr_t id1, intptr_t id2) const
|
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;
|
FName name = (ENamedName)(intptr_t)id2;
|
||||||
|
|
||||||
return Outer == outer && TypeName == name;
|
return Outer == outer && TypeName == name;
|
||||||
|
@ -438,23 +427,6 @@ void PContainerType::GetTypeIDs(intptr_t &id1, intptr_t &id2) const
|
||||||
|
|
||||||
/* PInt *******************************************************************/
|
/* 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
|
// PInt Parameterized Constructor
|
||||||
|
@ -678,8 +650,6 @@ double PInt::GetValueFloat(void *addr) const
|
||||||
|
|
||||||
/* PBool ******************************************************************/
|
/* PBool ******************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PBool, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PInt :: SetValue
|
// PInt :: SetValue
|
||||||
|
@ -722,8 +692,6 @@ PBool::PBool()
|
||||||
|
|
||||||
/* PFloat *****************************************************************/
|
/* PFloat *****************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PFloat, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PFloat Parameterized Constructor
|
// PFloat Parameterized Constructor
|
||||||
|
@ -968,8 +936,6 @@ void PFloat::SetOps()
|
||||||
|
|
||||||
/* PString ****************************************************************/
|
/* PString ****************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PString, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PString Default Constructor
|
// PString Default Constructor
|
||||||
|
@ -1065,8 +1031,6 @@ void PString::DestroyValue(void *addr) const
|
||||||
|
|
||||||
/* PName ******************************************************************/
|
/* PName ******************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PName, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PName Default Constructor
|
// PName Default Constructor
|
||||||
|
@ -1116,8 +1080,6 @@ bool PName::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
||||||
|
|
||||||
/* PSpriteID ******************************************************************/
|
/* PSpriteID ******************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PSpriteID, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PName Default Constructor
|
// PName Default Constructor
|
||||||
|
@ -1159,8 +1121,6 @@ bool PSpriteID::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
||||||
|
|
||||||
/* PTextureID ******************************************************************/
|
/* PTextureID ******************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PTextureID, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PTextureID Default Constructor
|
// PTextureID Default Constructor
|
||||||
|
@ -1203,8 +1163,6 @@ bool PTextureID::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
||||||
|
|
||||||
/* PSound *****************************************************************/
|
/* PSound *****************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PSound, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PSound Default Constructor
|
// PSound Default Constructor
|
||||||
|
@ -1254,8 +1212,6 @@ bool PSound::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
||||||
|
|
||||||
/* PColor *****************************************************************/
|
/* PColor *****************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PColor, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PColor Default Constructor
|
// PColor Default Constructor
|
||||||
|
@ -1272,8 +1228,6 @@ PColor::PColor()
|
||||||
|
|
||||||
/* PStateLabel *****************************************************************/
|
/* PStateLabel *****************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PStateLabel, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PStateLabel Default Constructor
|
// PStateLabel Default Constructor
|
||||||
|
@ -1289,8 +1243,6 @@ PStateLabel::PStateLabel()
|
||||||
|
|
||||||
/* PPointer ***************************************************************/
|
/* PPointer ***************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PPointer, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PPointer - Default Constructor
|
// PPointer - Default Constructor
|
||||||
|
@ -1395,8 +1347,6 @@ bool PPointer::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
||||||
|
|
||||||
/* PObjectPointer **********************************************************/
|
/* PObjectPointer **********************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PObjectPointer, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PPointer :: GetStoreOp
|
// PPointer :: GetStoreOp
|
||||||
|
@ -1488,8 +1438,6 @@ PPointer *NewPointer(PClass *cls, bool isconst)
|
||||||
|
|
||||||
/* PStatePointer **********************************************************/
|
/* PStatePointer **********************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PStatePointer, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PStatePointer Default Constructor
|
// PStatePointer Default Constructor
|
||||||
|
@ -1531,8 +1479,6 @@ bool PStatePointer::ReadValue(FSerializer &ar, const char *key, void *addr) cons
|
||||||
|
|
||||||
/* PClassPointer **********************************************************/
|
/* PClassPointer **********************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PClassPointer,false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PClassPointer - Parameterized Constructor
|
// PClassPointer - Parameterized Constructor
|
||||||
|
@ -1641,20 +1587,6 @@ PClassPointer *NewClassPointer(PClass *restrict)
|
||||||
|
|
||||||
/* PEnum ******************************************************************/
|
/* PEnum ******************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PEnum, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// PEnum - Default Constructor
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
PEnum::PEnum()
|
|
||||||
: PInt(4, false)
|
|
||||||
{
|
|
||||||
mDescriptiveName = "Enum";
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PEnum - Parameterized Constructor
|
// PEnum - Parameterized Constructor
|
||||||
|
@ -1694,20 +1626,6 @@ PEnum *NewEnum(FName name, PTypeBase *outer)
|
||||||
|
|
||||||
/* PArray *****************************************************************/
|
/* PArray *****************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PArray, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// PArray - Default Constructor
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
PArray::PArray()
|
|
||||||
: ElementType(nullptr), ElementCount(0)
|
|
||||||
{
|
|
||||||
mDescriptiveName = "Array";
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PArray - Parameterized Constructor
|
// PArray - Parameterized Constructor
|
||||||
|
@ -1854,19 +1772,6 @@ PArray *NewArray(PType *type, unsigned int count)
|
||||||
|
|
||||||
/* PArray *****************************************************************/
|
/* PArray *****************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PStaticArray, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// PArray - Default Constructor
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
PStaticArray::PStaticArray()
|
|
||||||
{
|
|
||||||
mDescriptiveName = "ResizableArray";
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PArray - Parameterized Constructor
|
// PArray - Parameterized Constructor
|
||||||
|
@ -1928,22 +1833,6 @@ PStaticArray *NewStaticArray(PType *type)
|
||||||
|
|
||||||
/* PDynArray **************************************************************/
|
/* PDynArray **************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PDynArray, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// PDynArray - Default Constructor
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
PDynArray::PDynArray()
|
|
||||||
: ElementType(nullptr)
|
|
||||||
{
|
|
||||||
mDescriptiveName = "DynArray";
|
|
||||||
Size = sizeof(FArray);
|
|
||||||
Align = alignof(FArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PDynArray - Parameterized Constructor
|
// 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
|
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.
|
// Add to the list of pointer arrays for this class.
|
||||||
special->Push(offset);
|
special->Push(offset);
|
||||||
|
@ -2179,22 +2068,6 @@ PDynArray *NewDynArray(PType *type)
|
||||||
|
|
||||||
/* PMap *******************************************************************/
|
/* 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
|
// PMap - Parameterized Constructor
|
||||||
|
@ -2258,20 +2131,6 @@ PMap *NewMap(PType *keytype, PType *valuetype)
|
||||||
|
|
||||||
/* PStruct ****************************************************************/
|
/* PStruct ****************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PStruct, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// PStruct - Default Constructor
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
PStruct::PStruct()
|
|
||||||
{
|
|
||||||
mDescriptiveName = "Struct";
|
|
||||||
Size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PStruct - Parameterized Constructor
|
// PStruct - Parameterized Constructor
|
||||||
|
@ -2410,18 +2269,6 @@ PStruct *NewStruct(FName name, PTypeBase *outer, bool native)
|
||||||
|
|
||||||
/* PPrototype *************************************************************/
|
/* PPrototype *************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PPrototype, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// PPrototype - Default Constructor
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
PPrototype::PPrototype()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PPrototype - Parameterized Constructor
|
// PPrototype - Parameterized Constructor
|
||||||
|
@ -2459,20 +2306,6 @@ void PPrototype::GetTypeIDs(intptr_t &id1, intptr_t &id2) const
|
||||||
id2 = (intptr_t)&ReturnTypes;
|
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
|
// NewPrototype
|
||||||
|
@ -2496,8 +2329,6 @@ PPrototype *NewPrototype(const TArray<PType *> &rettypes, const TArray<PType *>
|
||||||
|
|
||||||
/* PClass *****************************************************************/
|
/* PClass *****************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PClassType, false, false)
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -2514,6 +2345,7 @@ PClassType::PClassType(PClass *cls)
|
||||||
ParentType = cls->ParentClass->VMType;
|
ParentType = cls->ParentClass->VMType;
|
||||||
assert(ParentType != nullptr);
|
assert(ParentType != nullptr);
|
||||||
Symbols.SetParentTable(&ParentType->Symbols);
|
Symbols.SetParentTable(&ParentType->Symbols);
|
||||||
|
ScopeFlags = ParentType->ScopeFlags;
|
||||||
}
|
}
|
||||||
cls->VMType = this;
|
cls->VMType = this;
|
||||||
mDescriptiveName.Format("Class<%s>", cls->TypeName.GetChars());
|
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->TypeTableType = type_name;
|
||||||
type->HashNext = TypeHash[bucket];
|
type->HashNext = TypeHash[bucket];
|
||||||
TypeHash[bucket] = type;
|
TypeHash[bucket] = type;
|
||||||
type->Release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -2625,7 +2456,6 @@ void FTypeTable::AddType(PType *type, FName type_name)
|
||||||
|
|
||||||
type->HashNext = TypeHash[bucket];
|
type->HashNext = TypeHash[bucket];
|
||||||
TypeHash[bucket] = type;
|
TypeHash[bucket] = type;
|
||||||
type->Release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "dobject.h"
|
#include "dobject.h"
|
||||||
#include "serializer.h"
|
#include "serializer.h"
|
||||||
|
#include "scripting/backend/scopebarrier.h"
|
||||||
|
|
||||||
// Variable/parameter/field flags -------------------------------------------
|
// Variable/parameter/field flags -------------------------------------------
|
||||||
|
|
||||||
|
@ -70,7 +71,6 @@ class PClassType;
|
||||||
struct ZCC_ExprConstant;
|
struct ZCC_ExprConstant;
|
||||||
class PType : public PTypeBase
|
class PType : public PTypeBase
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(PType, PTypeBase)
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
enum ETypeFlags
|
enum ETypeFlags
|
||||||
|
@ -99,6 +99,7 @@ public:
|
||||||
FString mDescriptiveName;
|
FString mDescriptiveName;
|
||||||
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;
|
||||||
|
|
||||||
PType(unsigned int size = 1, unsigned int align = 1);
|
PType(unsigned int size = 1, unsigned int align = 1);
|
||||||
virtual ~PType();
|
virtual ~PType();
|
||||||
|
@ -210,14 +211,12 @@ public:
|
||||||
|
|
||||||
class PErrorType : public PType
|
class PErrorType : public PType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PErrorType, PType);
|
|
||||||
public:
|
public:
|
||||||
PErrorType(int which = 1) : PType(0, which) {}
|
PErrorType(int which = 1) : PType(0, which) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class PVoidType : public PType
|
class PVoidType : public PType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PVoidType, PType);
|
|
||||||
public:
|
public:
|
||||||
PVoidType() : PType(0, 1) {}
|
PVoidType() : PType(0, 1) {}
|
||||||
};
|
};
|
||||||
|
@ -226,21 +225,18 @@ public:
|
||||||
|
|
||||||
class PBasicType : public PType
|
class PBasicType : public PType
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(PBasicType, PType);
|
|
||||||
protected:
|
protected:
|
||||||
PBasicType(unsigned int size = 1, unsigned int align = 1);
|
PBasicType(unsigned int size = 1, unsigned int align = 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PCompoundType : public PType
|
class PCompoundType : public PType
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(PCompoundType, PType);
|
|
||||||
protected:
|
protected:
|
||||||
PCompoundType(unsigned int size = 1, unsigned int align = 1);
|
PCompoundType(unsigned int size = 1, unsigned int align = 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PContainerType : public PCompoundType
|
class PContainerType : public PCompoundType
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(PContainerType, PCompoundType);
|
|
||||||
public:
|
public:
|
||||||
PTypeBase *Outer; // object this type is contained within
|
PTypeBase *Outer; // object this type is contained within
|
||||||
FName TypeName; // this type's name
|
FName TypeName; // this type's name
|
||||||
|
@ -266,7 +262,6 @@ public:
|
||||||
|
|
||||||
class PInt : public PBasicType
|
class PInt : public PBasicType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PInt, PBasicType);
|
|
||||||
public:
|
public:
|
||||||
PInt(unsigned int size, bool unsign, bool compatible = true);
|
PInt(unsigned int size, bool unsign, bool compatible = true);
|
||||||
|
|
||||||
|
@ -282,13 +277,11 @@ public:
|
||||||
bool Unsigned;
|
bool Unsigned;
|
||||||
bool IntCompatible;
|
bool IntCompatible;
|
||||||
protected:
|
protected:
|
||||||
PInt();
|
|
||||||
void SetOps();
|
void SetOps();
|
||||||
};
|
};
|
||||||
|
|
||||||
class PBool : public PInt
|
class PBool : public PInt
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PBool, PInt);
|
|
||||||
public:
|
public:
|
||||||
PBool();
|
PBool();
|
||||||
virtual void SetValue(void *addr, int val);
|
virtual void SetValue(void *addr, int val);
|
||||||
|
@ -299,7 +292,6 @@ public:
|
||||||
|
|
||||||
class PFloat : public PBasicType
|
class PFloat : public PBasicType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PFloat, PBasicType);
|
|
||||||
public:
|
public:
|
||||||
PFloat(unsigned int size = 8);
|
PFloat(unsigned int size = 8);
|
||||||
|
|
||||||
|
@ -333,7 +325,6 @@ private:
|
||||||
|
|
||||||
class PString : public PBasicType
|
class PString : public PBasicType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PString, PBasicType);
|
|
||||||
public:
|
public:
|
||||||
PString();
|
PString();
|
||||||
|
|
||||||
|
@ -348,7 +339,6 @@ public:
|
||||||
|
|
||||||
class PName : public PInt
|
class PName : public PInt
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PName, PInt);
|
|
||||||
public:
|
public:
|
||||||
PName();
|
PName();
|
||||||
|
|
||||||
|
@ -358,7 +348,6 @@ public:
|
||||||
|
|
||||||
class PSound : public PInt
|
class PSound : public PInt
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PSound, PInt);
|
|
||||||
public:
|
public:
|
||||||
PSound();
|
PSound();
|
||||||
|
|
||||||
|
@ -368,7 +357,6 @@ public:
|
||||||
|
|
||||||
class PSpriteID : public PInt
|
class PSpriteID : public PInt
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PSpriteID, PInt);
|
|
||||||
public:
|
public:
|
||||||
PSpriteID();
|
PSpriteID();
|
||||||
|
|
||||||
|
@ -378,7 +366,6 @@ public:
|
||||||
|
|
||||||
class PTextureID : public PInt
|
class PTextureID : public PInt
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PTextureID, PInt);
|
|
||||||
public:
|
public:
|
||||||
PTextureID();
|
PTextureID();
|
||||||
|
|
||||||
|
@ -388,14 +375,12 @@ public:
|
||||||
|
|
||||||
class PColor : public PInt
|
class PColor : public PInt
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PColor, PInt);
|
|
||||||
public:
|
public:
|
||||||
PColor();
|
PColor();
|
||||||
};
|
};
|
||||||
|
|
||||||
class PStateLabel : public PInt
|
class PStateLabel : public PInt
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PStateLabel, PInt);
|
|
||||||
public:
|
public:
|
||||||
PStateLabel();
|
PStateLabel();
|
||||||
};
|
};
|
||||||
|
@ -404,7 +389,6 @@ public:
|
||||||
|
|
||||||
class PPointer : public PBasicType
|
class PPointer : public PBasicType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PPointer, PBasicType);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef void(*WriteHandler)(FSerializer &ar, const char *key, const void *addr);
|
typedef void(*WriteHandler)(FSerializer &ar, const char *key, const void *addr);
|
||||||
|
@ -437,7 +421,6 @@ protected:
|
||||||
|
|
||||||
class PStatePointer : public PPointer
|
class PStatePointer : public PPointer
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PStatePointer, PPointer);
|
|
||||||
public:
|
public:
|
||||||
PStatePointer();
|
PStatePointer();
|
||||||
|
|
||||||
|
@ -448,7 +431,6 @@ public:
|
||||||
|
|
||||||
class PObjectPointer : public PPointer
|
class PObjectPointer : public PPointer
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PObjectPointer, PPointer);
|
|
||||||
public:
|
public:
|
||||||
PObjectPointer(PClass *pointedtype = nullptr, bool isconst = false);
|
PObjectPointer(PClass *pointedtype = nullptr, bool isconst = false);
|
||||||
|
|
||||||
|
@ -461,7 +443,6 @@ public:
|
||||||
|
|
||||||
class PClassPointer : public PPointer
|
class PClassPointer : public PPointer
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PClassPointer, PPointer);
|
|
||||||
public:
|
public:
|
||||||
PClassPointer(class PClass *restrict = nullptr);
|
PClassPointer(class PClass *restrict = nullptr);
|
||||||
|
|
||||||
|
@ -480,19 +461,15 @@ public:
|
||||||
|
|
||||||
class PEnum : public PInt
|
class PEnum : public PInt
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PEnum, PInt);
|
|
||||||
public:
|
public:
|
||||||
PEnum(FName name, PTypeBase *outer);
|
PEnum(FName name, PTypeBase *outer);
|
||||||
|
|
||||||
PTypeBase *Outer;
|
PTypeBase *Outer;
|
||||||
FName EnumName;
|
FName EnumName;
|
||||||
protected:
|
|
||||||
PEnum();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PArray : public PCompoundType
|
class PArray : public PCompoundType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PArray, PCompoundType);
|
|
||||||
public:
|
public:
|
||||||
PArray(PType *etype, unsigned int ecount);
|
PArray(PType *etype, unsigned int ecount);
|
||||||
|
|
||||||
|
@ -508,27 +485,19 @@ public:
|
||||||
|
|
||||||
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special) override;
|
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special) override;
|
||||||
void SetPointer(void *base, unsigned offset, TArray<size_t> *special) override;
|
void SetPointer(void *base, unsigned offset, TArray<size_t> *special) override;
|
||||||
|
|
||||||
protected:
|
|
||||||
PArray();//deleteme
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PStaticArray : public PArray
|
class PStaticArray : public PArray
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PStaticArray, PArray);
|
|
||||||
public:
|
public:
|
||||||
PStaticArray(PType *etype);
|
PStaticArray(PType *etype);
|
||||||
|
|
||||||
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
|
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
|
||||||
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const;
|
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const;
|
||||||
|
|
||||||
protected:
|
|
||||||
PStaticArray();// deleteme
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PDynArray : public PCompoundType
|
class PDynArray : public PCompoundType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PDynArray, PCompoundType);
|
|
||||||
public:
|
public:
|
||||||
PDynArray(PType *etype, PStruct *backing);
|
PDynArray(PType *etype, PStruct *backing);
|
||||||
|
|
||||||
|
@ -544,14 +513,10 @@ public:
|
||||||
void InitializeValue(void *addr, const void *def) const override;
|
void InitializeValue(void *addr, const void *def) const override;
|
||||||
void DestroyValue(void *addr) const override;
|
void DestroyValue(void *addr) const override;
|
||||||
void SetPointerArray(void *base, unsigned offset, TArray<size_t> *ptrofs = NULL) const override;
|
void SetPointerArray(void *base, unsigned offset, TArray<size_t> *ptrofs = NULL) const override;
|
||||||
|
|
||||||
protected:
|
|
||||||
PDynArray(); // deleteme
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PMap : public PCompoundType
|
class PMap : public PCompoundType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PMap, PCompoundType);
|
|
||||||
public:
|
public:
|
||||||
PMap(PType *keytype, PType *valtype);
|
PMap(PType *keytype, PType *valtype);
|
||||||
|
|
||||||
|
@ -560,14 +525,10 @@ public:
|
||||||
|
|
||||||
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
|
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
|
||||||
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const;
|
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const;
|
||||||
protected:
|
|
||||||
PMap(); // deleteme
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PStruct : public PContainerType
|
class PStruct : public PContainerType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PStruct, PContainerType);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PStruct(FName name, PTypeBase *outer, bool isnative = false);
|
PStruct(FName name, PTypeBase *outer, bool isnative = false);
|
||||||
|
|
||||||
|
@ -583,25 +544,18 @@ public:
|
||||||
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
|
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
|
||||||
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *specials) override;
|
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *specials) override;
|
||||||
void SetPointer(void *base, unsigned offset, TArray<size_t> *specials) override;
|
void SetPointer(void *base, unsigned offset, TArray<size_t> *specials) override;
|
||||||
|
|
||||||
protected:
|
|
||||||
PStruct(); // deleteme
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PPrototype : public PCompoundType
|
class PPrototype : public PCompoundType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PPrototype, PCompoundType);
|
|
||||||
public:
|
public:
|
||||||
PPrototype(const TArray<PType *> &rettypes, const TArray<PType *> &argtypes);
|
PPrototype(const TArray<PType *> &rettypes, const TArray<PType *> &argtypes);
|
||||||
|
|
||||||
TArray<PType *> ArgumentTypes;
|
TArray<PType *> ArgumentTypes;
|
||||||
TArray<PType *> ReturnTypes;
|
TArray<PType *> ReturnTypes;
|
||||||
|
|
||||||
size_t PropagateMark();
|
|
||||||
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
|
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
|
||||||
virtual void GetTypeIDs(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
|
class PClassType : public PContainerType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PClassType, PContainerType);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PClass *Descriptor;
|
PClass *Descriptor;
|
||||||
PClassType *ParentType;
|
PClassType *ParentType;
|
||||||
|
|
|
@ -527,6 +527,7 @@ void ZCCCompiler::CreateStructTypes()
|
||||||
s->strct->Type->mVersion = s->strct->Version;
|
s->strct->Type->mVersion = s->strct->Version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto &sf = s->Type()->ScopeFlags;
|
||||||
if (mVersion >= MakeVersion(2, 4, 0))
|
if (mVersion >= MakeVersion(2, 4, 0))
|
||||||
{
|
{
|
||||||
if ((s->strct->Flags & (ZCC_UIFlag | ZCC_Play)) == (ZCC_UIFlag | ZCC_Play))
|
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());
|
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());
|
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)
|
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)
|
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)
|
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
|
else
|
||||||
{
|
{
|
||||||
// old versions force 'play'.
|
// 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());
|
s->strct->Symbol = new PSymbolType(s->NodeName(), s->Type());
|
||||||
syms->AddSymbol(s->strct->Symbol);
|
syms->AddSymbol(s->strct->Symbol);
|
||||||
|
@ -663,7 +664,7 @@ void ZCCCompiler::CreateClassTypes()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->cls->Flags & ZCC_Abstract)
|
if (c->cls->Flags & ZCC_Abstract)
|
||||||
c->Type()->ObjectFlags |= OF_Abstract;
|
c->ClassType()->bAbstract = true;
|
||||||
|
|
||||||
if (c->cls->Flags & ZCC_Version)
|
if (c->cls->Flags & ZCC_Version)
|
||||||
{
|
{
|
||||||
|
@ -683,21 +684,21 @@ void ZCCCompiler::CreateClassTypes()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->cls->Flags & ZCC_UIFlag)
|
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)
|
if (c->cls->Flags & ZCC_Play)
|
||||||
c->Type()->ObjectFlags = (c->Type()->ObjectFlags&~OF_UI) | OF_Play;
|
c->Type()->ScopeFlags = EScopeFlags((c->Type()->ScopeFlags&~Scope_UI) | Scope_Play);
|
||||||
if (parent->VMType->ObjectFlags & (OF_UI | OF_Play)) // parent is either ui or play
|
if (parent->VMType->ScopeFlags & (Scope_UI | Scope_Play)) // parent is either ui or play
|
||||||
{
|
{
|
||||||
if (c->cls->Flags & (ZCC_UIFlag | ZCC_Play))
|
if (c->cls->Flags & (ZCC_UIFlag | ZCC_Play))
|
||||||
{
|
{
|
||||||
Error(c->cls, "Can't change class scope in class %s", c->NodeName().GetChars());
|
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
|
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());
|
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));
|
ZCC_ExprTypeRef *ref = static_cast<ZCC_ExprTypeRef *>(AST.InitNode(sizeof(*ref), AST_ExprTypeRef, idnode));
|
||||||
ref->Operation = PEX_TypeRef;
|
ref->Operation = PEX_TypeRef;
|
||||||
ref->RefType = sym->Type;
|
ref->RefType = sym->Type;
|
||||||
ref->Type = NewClassPointer(RUNTIME_CLASS(PType));
|
ref->Type = NewClassPointer(RUNTIME_CLASS(DObject));
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1245,9 +1246,9 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
|
||||||
{
|
{
|
||||||
if (type != nullptr)
|
if (type != nullptr)
|
||||||
{
|
{
|
||||||
if (type->ObjectFlags & OF_UI)
|
if (type->ScopeFlags & Scope_UI)
|
||||||
varflags |= VARF_UI;
|
varflags |= VARF_UI;
|
||||||
if (type->ObjectFlags & OF_Play)
|
if (type->ScopeFlags & Scope_Play)
|
||||||
varflags |= VARF_Play;
|
varflags |= VARF_Play;
|
||||||
}
|
}
|
||||||
if (field->Flags & ZCC_UIFlag)
|
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 (f->Flags & ZCC_FuncConst) varflags |= VARF_ReadOnly; // FuncConst method is internally marked as VARF_ReadOnly
|
||||||
if (mVersion >= MakeVersion(2, 4, 0))
|
if (mVersion >= MakeVersion(2, 4, 0))
|
||||||
{
|
{
|
||||||
if (c->Type()->ObjectFlags & OF_UI)
|
if (c->Type()->ScopeFlags & Scope_UI)
|
||||||
varflags |= VARF_UI;
|
varflags |= VARF_UI;
|
||||||
if (c->Type()->ObjectFlags & OF_Play)
|
if (c->Type()->ScopeFlags & Scope_Play)
|
||||||
varflags |= VARF_Play;
|
varflags |= VARF_Play;
|
||||||
//if (f->Flags & ZCC_FuncConst)
|
//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.
|
// 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