Declare CBotVar::m_token as const
parent
477dc0cae7
commit
6e273e7e33
|
@ -49,7 +49,7 @@ namespace CBot
|
||||||
long CBotVar::m_identcpt = 0;
|
long CBotVar::m_identcpt = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
CBotVar::CBotVar( )
|
CBotVar::CBotVar( ) : m_token(nullptr)
|
||||||
{
|
{
|
||||||
m_pMyThis = nullptr;
|
m_pMyThis = nullptr;
|
||||||
m_pUserPtr = nullptr;
|
m_pUserPtr = nullptr;
|
||||||
|
@ -62,9 +62,17 @@ CBotVar::CBotVar( )
|
||||||
m_mPrivate = ProtectionLevel::Public;
|
m_mPrivate = ProtectionLevel::Public;
|
||||||
}
|
}
|
||||||
|
|
||||||
CBotVar::CBotVar(const CBotToken &name) : CBotVar()
|
CBotVar::CBotVar(const CBotToken &name) : m_token(new CBotToken(name))
|
||||||
{
|
{
|
||||||
m_token = new CBotToken(name);
|
m_pMyThis = nullptr;
|
||||||
|
m_pUserPtr = nullptr;
|
||||||
|
m_InitExpr = nullptr;
|
||||||
|
m_LimExpr = nullptr;
|
||||||
|
m_type = -1;
|
||||||
|
m_binit = InitType::UNDEF;
|
||||||
|
m_ident = 0;
|
||||||
|
m_bStatic = false;
|
||||||
|
m_mPrivate = ProtectionLevel::Public;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -650,7 +650,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! The corresponding token, defines the variable name
|
//! The corresponding token, defines the variable name
|
||||||
CBotToken* m_token;
|
CBotToken* const m_token;
|
||||||
//! Type of value.
|
//! Type of value.
|
||||||
CBotTypResult m_type;
|
CBotTypResult m_type;
|
||||||
//! Initialization status
|
//! Initialization status
|
||||||
|
|
|
@ -31,12 +31,11 @@ namespace CBot
|
||||||
{
|
{
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
CBotVarArray::CBotVarArray(const CBotToken& name, CBotTypResult& type)
|
CBotVarArray::CBotVarArray(const CBotToken& name, CBotTypResult& type) : CBotVar(name)
|
||||||
{
|
{
|
||||||
if ( !type.Eq(CBotTypArrayPointer) &&
|
if ( !type.Eq(CBotTypArrayPointer) &&
|
||||||
!type.Eq(CBotTypArrayBody)) assert(0);
|
!type.Eq(CBotTypArrayBody)) assert(0);
|
||||||
|
|
||||||
m_token = new CBotToken(name);
|
|
||||||
m_next = nullptr;
|
m_next = nullptr;
|
||||||
m_pMyThis = nullptr;
|
m_pMyThis = nullptr;
|
||||||
m_pUserPtr = nullptr;
|
m_pUserPtr = nullptr;
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace CBot
|
||||||
std::set<CBotVarClass*> CBotVarClass::m_instances{};
|
std::set<CBotVarClass*> CBotVarClass::m_instances{};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
CBotVarClass::CBotVarClass(const CBotToken& name, const CBotTypResult& type)
|
CBotVarClass::CBotVarClass(const CBotToken& name, const CBotTypResult& type) : CBotVar(name)
|
||||||
{
|
{
|
||||||
if ( !type.Eq(CBotTypClass) &&
|
if ( !type.Eq(CBotTypClass) &&
|
||||||
!type.Eq(CBotTypIntrinsic) && // by convenience there accepts these types
|
!type.Eq(CBotTypIntrinsic) && // by convenience there accepts these types
|
||||||
|
@ -44,7 +44,6 @@ CBotVarClass::CBotVarClass(const CBotToken& name, const CBotTypResult& type)
|
||||||
!type.Eq(CBotTypArrayPointer) &&
|
!type.Eq(CBotTypArrayPointer) &&
|
||||||
!type.Eq(CBotTypArrayBody)) assert(0);
|
!type.Eq(CBotTypArrayBody)) assert(0);
|
||||||
|
|
||||||
m_token = new CBotToken(name);
|
|
||||||
m_next = nullptr;
|
m_next = nullptr;
|
||||||
m_pMyThis = nullptr;
|
m_pMyThis = nullptr;
|
||||||
m_pUserPtr = OBJECTCREATED;//nullptr;
|
m_pUserPtr = OBJECTCREATED;//nullptr;
|
||||||
|
|
|
@ -32,14 +32,13 @@ namespace CBot
|
||||||
{
|
{
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
CBotVarPointer::CBotVarPointer(const CBotToken& name, CBotTypResult& type)
|
CBotVarPointer::CBotVarPointer(const CBotToken& name, CBotTypResult& type) : CBotVar(name)
|
||||||
{
|
{
|
||||||
if ( !type.Eq(CBotTypPointer) &&
|
if ( !type.Eq(CBotTypPointer) &&
|
||||||
!type.Eq(CBotTypNullPointer) &&
|
!type.Eq(CBotTypNullPointer) &&
|
||||||
!type.Eq(CBotTypClass) && // for convenience accepts Class and Intrinsic
|
!type.Eq(CBotTypClass) && // for convenience accepts Class and Intrinsic
|
||||||
!type.Eq(CBotTypIntrinsic) ) assert(0);
|
!type.Eq(CBotTypIntrinsic) ) assert(0);
|
||||||
|
|
||||||
m_token = new CBotToken(name);
|
|
||||||
m_next = nullptr;
|
m_next = nullptr;
|
||||||
m_pMyThis = nullptr;
|
m_pMyThis = nullptr;
|
||||||
m_pUserPtr = nullptr;
|
m_pUserPtr = nullptr;
|
||||||
|
|
Loading…
Reference in New Issue