- fixed code generation for local dynamic arrays.

- removed some code repetition by inherit all variable types which reference a PField for a variable offset from a base class so that PField replacements can be done with one set of code.
This commit is contained in:
Christoph Oelckers 2017-02-06 22:57:42 +01:00
commit 96b2cb0a45
2 changed files with 40 additions and 121 deletions

View file

@ -1314,19 +1314,30 @@ public:
};
//==========================================================================
//
// FxMemberBase
//
//==========================================================================
class FxMemberBase : public FxExpression
{
public:
PField *membervar;
bool AddressRequested = false;
bool AddressWritable = true;
FxMemberBase(EFxType type, PField *f, const FScriptPosition &p);
};
//==========================================================================
//
// FxGlobalVariaböe
//
//==========================================================================
class FxGlobalVariable : public FxExpression
class FxGlobalVariable : public FxMemberBase
{
public:
PField *membervar;
bool AddressRequested;
bool AddressWritable;
FxGlobalVariable(PField*, const FScriptPosition&);
FxExpression *Resolve(FCompileContext&);
bool RequestAddress(FCompileContext &ctx, bool *writable);
@ -1343,19 +1354,17 @@ public:
ExpEmit Emit(VMFunctionBuilder *build);
};
//==========================================================================
//
// FxClassMember
//
//==========================================================================
class FxStructMember : public FxExpression
class FxStructMember : public FxMemberBase
{
public:
FxExpression *classx;
PField *membervar;
bool AddressRequested;
bool AddressWritable;
FxStructMember(FxExpression*, PField*, const FScriptPosition&);
~FxStructMember();
@ -1403,13 +1412,9 @@ public:
//
//==========================================================================
class FxStackVariable : public FxExpression
class FxStackVariable : public FxMemberBase
{
public:
PField *membervar;
bool AddressRequested;
bool AddressWritable;
FxStackVariable(PType *type, int offset, const FScriptPosition&);
~FxStackVariable();
void ReplaceField(PField *newfield);