This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch debian/master in repository colobot.
commit ca548e29029df2c4c7eab818b9fc8713e3f8e22f Author: krzys-h <krzy...@interia.pl> Date: Sat Sep 24 17:04:47 2016 +0200 Update CBotFieldExpr::ProtectionError docs --- src/CBot/CBotInstr/CBotExprRetVar.cpp | 2 +- src/CBot/CBotInstr/CBotExprVar.cpp | 4 ++-- src/CBot/CBotInstr/CBotFieldExpr.cpp | 4 ++-- src/CBot/CBotInstr/CBotFieldExpr.h | 20 ++++++++++++-------- src/CBot/CBotInstr/CBotLeftExpr.cpp | 5 +++-- src/CBot/CBotTypResult.h | 2 +- 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/CBot/CBotInstr/CBotExprRetVar.cpp b/src/CBot/CBotInstr/CBotExprRetVar.cpp index c0e0e18..643a469 100644 --- a/src/CBot/CBotInstr/CBotExprRetVar.cpp +++ b/src/CBot/CBotInstr/CBotExprRetVar.cpp @@ -110,7 +110,7 @@ CBotInstr* CBotExprRetVar::Compile(CBotToken*& p, CBotCStack* pStack, bool bMeth if (var != nullptr) { i->SetUniqNum(var->GetUniqNum()); - if (CBotFieldExpr::ProtectionError(pStk, preVar, var)) + if (CBotFieldExpr::CheckProtectionError(pStk, preVar, var)) { pStk->SetError(CBotErrPrivate, pp); goto err; diff --git a/src/CBot/CBotInstr/CBotExprVar.cpp b/src/CBot/CBotInstr/CBotExprVar.cpp index 1963d30..a15c9c9 100644 --- a/src/CBot/CBotInstr/CBotExprVar.cpp +++ b/src/CBot/CBotInstr/CBotExprVar.cpp @@ -67,7 +67,7 @@ CBotInstr* CBotExprVar::Compile(CBotToken*& p, CBotCStack* pStack, CBotVar::Prot if (ident > 0 && ident < 9000) { - if (CBotFieldExpr::ProtectionError(pStk, nullptr, var, privat)) + if (CBotFieldExpr::CheckProtectionError(pStk, nullptr, var, privat)) { pStk->SetError(CBotErrPrivate, p); goto err; @@ -137,7 +137,7 @@ CBotInstr* CBotExprVar::Compile(CBotToken*& p, CBotCStack* pStack, CBotVar::Prot if (var != nullptr) { i->SetUniqNum(var->GetUniqNum()); - if (CBotFieldExpr::ProtectionError(pStk, preVar, var, privat)) + if (CBotFieldExpr::CheckProtectionError(pStk, preVar, var, privat)) { pStk->SetError(CBotErrPrivate, pp); goto err; diff --git a/src/CBot/CBotInstr/CBotFieldExpr.cpp b/src/CBot/CBotInstr/CBotFieldExpr.cpp index 1d12a65..09ac5f8 100644 --- a/src/CBot/CBotInstr/CBotFieldExpr.cpp +++ b/src/CBot/CBotInstr/CBotFieldExpr.cpp @@ -135,8 +135,8 @@ std::string CBotFieldExpr::GetDebugData() } //////////////////////////////////////////////////////////////////////////////// -bool CBotFieldExpr::ProtectionError(CBotCStack* pStack, CBotVar* pPrev, CBotVar* pVar, - CBotVar::ProtectionLevel privat) +bool CBotFieldExpr::CheckProtectionError(CBotCStack* pStack, CBotVar* pPrev, CBotVar* pVar, + CBotVar::ProtectionLevel privat) { CBotVar::ProtectionLevel varPriv = pVar->GetPrivate(); diff --git a/src/CBot/CBotInstr/CBotFieldExpr.h b/src/CBot/CBotInstr/CBotFieldExpr.h index 2ee2851..67ab2f0 100644 --- a/src/CBot/CBotInstr/CBotFieldExpr.h +++ b/src/CBot/CBotInstr/CBotFieldExpr.h @@ -66,15 +66,19 @@ public: void RestoreStateVar(CBotStack* &pj, bool bMain) override; /*! - * \brief ProtectionError Test if access to a variable is not allowed. - * \param pStack - * \param pPrev - * \param pVar - * \param privat - * \return True if pVar is protected in the current context. + * \brief Check if access to a variable is allowed or not depending on public/private/protected setting + * + * If this function returns true, the caller is responsible for failing the compilation with ::CBotErrPrivate error. + * This function doesn't set the error flag itself. + * + * \param pStack Current compilation stack frame + * \param pPrev Class instance which variable to check is part of, or nullptr if not part of a class + * \param pVar Variable to check + * \param privat CBotVar::ProtectionLevel::ReadOnly if requesting read-only access, anything else otherwise + * \return true if pVar is inaccessible in the current context, false if access should be allowed */ - static bool ProtectionError(CBotCStack* pStack, CBotVar* pPrev, CBotVar* pVar, - CBotVar::ProtectionLevel privat = CBotVar::ProtectionLevel::Protected); + static bool CheckProtectionError(CBotCStack* pStack, CBotVar* pPrev, CBotVar* pVar, + CBotVar::ProtectionLevel privat = CBotVar::ProtectionLevel::Protected); protected: virtual const std::string GetDebugName() override { return "CBotFieldExpr"; } diff --git a/src/CBot/CBotInstr/CBotLeftExpr.cpp b/src/CBot/CBotInstr/CBotLeftExpr.cpp index 8201137..4678ff8 100644 --- a/src/CBot/CBotInstr/CBotLeftExpr.cpp +++ b/src/CBot/CBotInstr/CBotLeftExpr.cpp @@ -64,7 +64,7 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack) inst->m_nIdent = var->GetUniqNum(); if (inst->m_nIdent > 0 && inst->m_nIdent < 9000) { - if (CBotFieldExpr::ProtectionError(pStk, nullptr, var, CBotVar::ProtectionLevel::ReadOnly)) + if (CBotFieldExpr::CheckProtectionError(pStk, nullptr, var, CBotVar::ProtectionLevel::ReadOnly)) { pStk->SetError(CBotErrPrivate, p); goto err; @@ -128,7 +128,8 @@ CBotLeftExpr* CBotLeftExpr::Compile(CBotToken* &p, CBotCStack* pStack) var = var->GetItem(p->GetString()); // get item correspondent if (var != nullptr) { - if (CBotFieldExpr::ProtectionError(pStk, preVar, var, CBotVar::ProtectionLevel::ReadOnly)) + if (CBotFieldExpr::CheckProtectionError(pStk, preVar, var, + CBotVar::ProtectionLevel::ReadOnly)) { pStk->SetError(CBotErrPrivate, pp); goto err; diff --git a/src/CBot/CBotTypResult.h b/src/CBot/CBotTypResult.h index cd8d746..00683ca 100644 --- a/src/CBot/CBotTypResult.h +++ b/src/CBot/CBotTypResult.h @@ -106,7 +106,7 @@ public: /** * \brief Returns ::CBotType or ::CBotError stored in this object - * \param mode Mode, see ::GetTypeMode enum + * \param mode Mode, see GetTypeMode enum */ int GetType(GetTypeMode mode = GetTypeMode::NORMAL) const; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git _______________________________________________ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits