Added warning for uninitialized variables in ZScript
https://forum.zdoom.org/viewtopic.php?t=57868
This commit is contained in:
parent
dac5777a70
commit
8104ef5189
2 changed files with 39 additions and 6 deletions
|
|
@ -1425,6 +1425,7 @@ class FxLocalVariable : public FxExpression
|
|||
public:
|
||||
FxLocalVariableDeclaration *Variable;
|
||||
bool AddressRequested;
|
||||
bool IsLocalVariable; // false for function parameter and true otherwise
|
||||
int RegOffset;
|
||||
|
||||
FxLocalVariable(FxLocalVariableDeclaration*, const FScriptPosition&);
|
||||
|
|
@ -1442,7 +1443,9 @@ public:
|
|||
class FxStackVariable : public FxMemberBase
|
||||
{
|
||||
public:
|
||||
FxStackVariable(PType *type, int offset, const FScriptPosition&);
|
||||
FxLocalVariableDeclaration *Variable;
|
||||
|
||||
FxStackVariable(FxLocalVariableDeclaration*, const FScriptPosition&);
|
||||
~FxStackVariable();
|
||||
FxExpression *Resolve(FCompileContext&);
|
||||
bool RequestAddress(FCompileContext &ctx, bool *writable);
|
||||
|
|
@ -2121,6 +2124,7 @@ class FxLocalVariableDeclaration : public FxExpression
|
|||
{
|
||||
friend class FxCompoundStatement;
|
||||
friend class FxLocalVariable;
|
||||
friend class FxStackVariable;
|
||||
friend class FxStaticArrayVariable;
|
||||
|
||||
FName Name;
|
||||
|
|
@ -2130,6 +2134,7 @@ class FxLocalVariableDeclaration : public FxExpression
|
|||
public:
|
||||
int StackOffset = -1;
|
||||
int RegNum = -1;
|
||||
bool IsInitialized = false;
|
||||
|
||||
FxLocalVariableDeclaration(PType *type, FName name, FxExpression *initval, int varflags, const FScriptPosition &p);
|
||||
~FxLocalVariableDeclaration();
|
||||
|
|
@ -2137,7 +2142,7 @@ public:
|
|||
ExpEmit Emit(VMFunctionBuilder *build);
|
||||
void Release(VMFunctionBuilder *build);
|
||||
void SetReg(ExpEmit reginfo);
|
||||
|
||||
void WarnIfUninitialized(const FScriptPosition &varPos) const;
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue