Don't use identifiers starting with an underscore followed by an uppercase letter

This commit is contained in:
Jason Cobb
2020-02-17 12:44:39 -05:00
parent 2d1c4b770f
commit 6db0d50094
14 changed files with 74 additions and 74 deletions
+11 -11
View File
@@ -405,13 +405,13 @@ void NameAndTypeResolver::linearizeBaseContracts(ContractDefinition& _contract)
_contract.annotation().contractDependencies.insert(result.begin() + 1, result.end());
}
template <class _T>
vector<_T const*> NameAndTypeResolver::cThreeMerge(list<list<_T const*>>& _toMerge)
template <class T>
vector<T const*> NameAndTypeResolver::cThreeMerge(list<list<T const*>>& _toMerge)
{
// returns true iff _candidate appears only as last element of the lists
auto appearsOnlyAtHead = [&](_T const* _candidate) -> bool
auto appearsOnlyAtHead = [&](T const* _candidate) -> bool
{
for (list<_T const*> const& bases: _toMerge)
for (list<T const*> const& bases: _toMerge)
{
solAssert(!bases.empty(), "");
if (find(++bases.begin(), bases.end(), _candidate) != bases.end())
@@ -420,9 +420,9 @@ vector<_T const*> NameAndTypeResolver::cThreeMerge(list<list<_T const*>>& _toMer
return true;
};
// returns the next candidate to append to the linearized list or nullptr on failure
auto nextCandidate = [&]() -> _T const*
auto nextCandidate = [&]() -> T const*
{
for (list<_T const*> const& bases: _toMerge)
for (list<T const*> const& bases: _toMerge)
{
solAssert(!bases.empty(), "");
if (appearsOnlyAtHead(bases.front()))
@@ -431,7 +431,7 @@ vector<_T const*> NameAndTypeResolver::cThreeMerge(list<list<_T const*>>& _toMer
return nullptr;
};
// removes the given contract from all lists
auto removeCandidate = [&](_T const* _candidate)
auto removeCandidate = [&](T const* _candidate)
{
for (auto it = _toMerge.begin(); it != _toMerge.end();)
{
@@ -443,13 +443,13 @@ vector<_T const*> NameAndTypeResolver::cThreeMerge(list<list<_T const*>>& _toMer
}
};
_toMerge.remove_if([](list<_T const*> const& _bases) { return _bases.empty(); });
vector<_T const*> result;
_toMerge.remove_if([](list<T const*> const& _bases) { return _bases.empty(); });
vector<T const*> result;
while (!_toMerge.empty())
{
_T const* candidate = nextCandidate();
T const* candidate = nextCandidate();
if (!candidate)
return vector<_T const*>();
return vector<T const*>();
result.push_back(candidate);
removeCandidate(candidate);
}
+2 -2
View File
@@ -122,8 +122,8 @@ private:
void linearizeBaseContracts(ContractDefinition& _contract);
/// Computes the C3-merge of the given list of lists of bases.
/// @returns the linearized vector or an empty vector if linearization is not possible.
template <class _T>
static std::vector<_T const*> cThreeMerge(std::list<std::list<_T const*>>& _toMerge);
template <class T>
static std::vector<T const*> cThreeMerge(std::list<std::list<T const*>>& _toMerge);
/// Maps nodes declaring a scope to scopes, i.e. ContractDefinition and FunctionDeclaration,
/// where nullptr denotes the global scope. Note that structs are not scope since they do
+6 -6
View File
@@ -88,8 +88,8 @@ public:
}
/// @returns a copy of the vector containing only the nodes which derive from T.
template <class _T>
static std::vector<_T const*> filteredNodes(std::vector<ASTPointer<ASTNode>> const& _nodes);
template <class T>
static std::vector<T const*> filteredNodes(std::vector<ASTPointer<ASTNode>> const& _nodes);
/// Returns the source code location of this node.
SourceLocation const& location() const { return m_location; }
@@ -121,12 +121,12 @@ private:
SourceLocation m_location;
};
template <class _T>
std::vector<_T const*> ASTNode::filteredNodes(std::vector<ASTPointer<ASTNode>> const& _nodes)
template <class T>
std::vector<T const*> ASTNode::filteredNodes(std::vector<ASTPointer<ASTNode>> const& _nodes)
{
std::vector<_T const*> ret;
std::vector<T const*> ret;
for (auto const& n: _nodes)
if (auto const* nt = dynamic_cast<_T const*>(n.get()))
if (auto const* nt = dynamic_cast<T const*>(n.get()))
ret.push_back(nt);
return ret;
}
+1 -1
View File
@@ -204,7 +204,7 @@ private:
/// @param _fromMemory if decoding from memory instead of from calldata
/// @param _forUseOnStack if the decoded value is stored on stack or in memory.
std::string abiDecodingFunction(
Type const& _Type,
Type const& _type,
bool _fromMemory,
bool _forUseOnStack
);
+5 -5
View File
@@ -125,8 +125,8 @@ private:
void setLValueToStorageItem(Expression const& _expression);
/// Sets the current LValue to a new LValue constructed from the arguments.
/// Also retrieves the value if it was not requested by @a _expression.
template <class _LValueType, class... _Arguments>
void setLValue(Expression const& _expression, _Arguments const&... _arguments);
template <class LValueType, class... Arguments>
void setLValue(Expression const& _expression, Arguments const&... _arguments);
/// @returns true if the operator applied to the given type requires a cleanup prior to the
/// operation.
@@ -143,11 +143,11 @@ private:
};
template <class _LValueType, class... _Arguments>
void ExpressionCompiler::setLValue(Expression const& _expression, _Arguments const&... _arguments)
template <class LValueType, class... Arguments>
void ExpressionCompiler::setLValue(Expression const& _expression, Arguments const&... _arguments)
{
solAssert(!m_currentLValue, "Current LValue not reset before trying to set new one.");
std::unique_ptr<_LValueType> lvalue = std::make_unique<_LValueType>(m_context, _arguments...);
std::unique_ptr<LValueType> lvalue = std::make_unique<LValueType>(m_context, _arguments...);
if (_expression.annotation().lValueRequested)
m_currentLValue = move(lvalue);
else