Merge pull request #6003 from ethereum/moreStyleChecks

Even more style checks.
This commit is contained in:
Daniel Kirchner
2019-02-15 11:52:32 +01:00
committed by GitHub
24 changed files with 51 additions and 47 deletions
+3 -3
View File
@@ -42,7 +42,7 @@ bool DocStringAnalyser::analyseDocStrings(SourceUnit const& _sourceUnit)
bool DocStringAnalyser::visit(ContractDefinition const& _contract)
{
static const set<string> validTags = set<string>{"author", "title", "dev", "notice"};
static set<string> const validTags = set<string>{"author", "title", "dev", "notice"};
parseDocStrings(_contract, _contract.annotation(), validTags, "contracts");
return true;
@@ -99,7 +99,7 @@ void DocStringAnalyser::handleConstructor(
DocumentedAnnotation& _annotation
)
{
static const set<string> validTags = set<string>{"author", "dev", "notice", "param"};
static set<string> const validTags = set<string>{"author", "dev", "notice", "param"};
parseDocStrings(_node, _annotation, validTags, "constructor");
checkParameters(_callable, _annotation);
}
@@ -110,7 +110,7 @@ void DocStringAnalyser::handleCallable(
DocumentedAnnotation& _annotation
)
{
static const set<string> validTags = set<string>{"author", "dev", "notice", "return", "param"};
static set<string> const validTags = set<string>{"author", "dev", "notice", "return", "param"};
parseDocStrings(_node, _annotation, validTags, "functions");
checkParameters(_callable, _annotation);
}
+2 -2
View File
@@ -35,13 +35,13 @@ enum class ExperimentalFeature
TestOnlyAnalysis
};
static const std::map<ExperimentalFeature, bool> ExperimentalFeatureOnlyAnalysis =
static std::map<ExperimentalFeature, bool> const ExperimentalFeatureOnlyAnalysis =
{
{ ExperimentalFeature::SMTChecker, true },
{ ExperimentalFeature::TestOnlyAnalysis, true },
};
static const std::map<std::string, ExperimentalFeature> ExperimentalFeatureNames =
static std::map<std::string, ExperimentalFeature> const ExperimentalFeatureNames =
{
{ "ABIEncoderV2", ExperimentalFeature::ABIEncoderV2 },
{ "SMTChecker", ExperimentalFeature::SMTChecker },
+6 -6
View File
@@ -37,11 +37,11 @@ namespace dev
namespace solidity
{
const unsigned CompilerUtils::dataStartOffset = 4;
const size_t CompilerUtils::freeMemoryPointer = 64;
const size_t CompilerUtils::zeroPointer = CompilerUtils::freeMemoryPointer + 32;
const size_t CompilerUtils::generalPurposeMemoryStart = CompilerUtils::zeroPointer + 32;
const unsigned CompilerUtils::identityContractAddress = 4;
unsigned const CompilerUtils::dataStartOffset = 4;
size_t const CompilerUtils::freeMemoryPointer = 64;
size_t const CompilerUtils::zeroPointer = CompilerUtils::freeMemoryPointer + 32;
size_t const CompilerUtils::generalPurposeMemoryStart = CompilerUtils::zeroPointer + 32;
unsigned const CompilerUtils::identityContractAddress = 4;
static_assert(CompilerUtils::freeMemoryPointer >= 64, "Free memory pointer must not overlap with scratch area.");
static_assert(CompilerUtils::zeroPointer >= CompilerUtils::freeMemoryPointer + 32, "Zero pointer must not overlap with free memory pointer.");
@@ -652,7 +652,7 @@ void CompilerUtils::convertType(
bool chopSignBitsPending = _chopSignBits && targetTypeCategory == Type::Category::Integer;
if (chopSignBitsPending)
{
const IntegerType& targetIntegerType = dynamic_cast<const IntegerType &>(_targetType);
IntegerType const& targetIntegerType = dynamic_cast<IntegerType const&>(_targetType);
chopSignBitsPending = targetIntegerType.isSigned();
}
+5 -5
View File
@@ -273,18 +273,18 @@ public:
/// Bytes we need to the start of call data.
/// - The size in bytes of the function (hash) identifier.
static const unsigned dataStartOffset;
static unsigned const dataStartOffset;
/// Position of the free-memory-pointer in memory;
static const size_t freeMemoryPointer;
static size_t const freeMemoryPointer;
/// Position of the memory slot that is always zero.
static const size_t zeroPointer;
static size_t const zeroPointer;
/// Starting offset for memory available to the user (aka the contract).
static const size_t generalPurposeMemoryStart;
static size_t const generalPurposeMemoryStart;
private:
/// Address of the precompiled identity contract.
static const unsigned identityContractAddress;
static unsigned const identityContractAddress;
/// Stores the given string in memory.
/// Stack pre: mempos
+1 -1
View File
@@ -355,7 +355,7 @@ bool hasPayableFunctions(ContractDefinition const& _contract)
void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contract)
{
map<FixedHash<4>, FunctionTypePointer> interfaceFunctions = _contract.interfaceFunctions();
map<FixedHash<4>, const eth::AssemblyItem> callDataUnpackerEntryPoints;
map<FixedHash<4>, eth::AssemblyItem const> callDataUnpackerEntryPoints;
if (_contract.isLibrary())
{
+1 -1
View File
@@ -473,7 +473,7 @@ void StorageByteArrayElement::setToZero(SourceLocation const&, bool _removeRefer
m_context << Instruction::SWAP1 << Instruction::SSTORE;
}
StorageArrayLength::StorageArrayLength(CompilerContext& _compilerContext, const ArrayType& _arrayType):
StorageArrayLength::StorageArrayLength(CompilerContext& _compilerContext, ArrayType const& _arrayType):
LValue(_compilerContext, _arrayType.memberType("length").get()),
m_arrayType(_arrayType)
{
+2 -2
View File
@@ -65,7 +65,7 @@ smt::Expression SymbolicVariable::increaseIndex()
SymbolicBoolVariable::SymbolicBoolVariable(
TypePointer _type,
string const& _uniqueName,
smt::SolverInterface&_interface
smt::SolverInterface& _interface
):
SymbolicVariable(move(_type), _uniqueName, _interface)
{
@@ -102,7 +102,7 @@ SymbolicFixedBytesVariable::SymbolicFixedBytesVariable(
SymbolicFunctionVariable::SymbolicFunctionVariable(
TypePointer _type,
string const& _uniqueName,
smt::SolverInterface&_interface
smt::SolverInterface& _interface
):
SymbolicVariable(move(_type), _uniqueName, _interface),
m_declaration(m_interface.newVariable(currentName(), smtSort(*m_type)))
+1 -1
View File
@@ -118,7 +118,7 @@ string Natspec::extractDoc(multimap<string, DocTag> const& _tags, string const&
return value;
}
Json::Value Natspec::devDocumentation(std::multimap<std::string, DocTag> const &_tags)
Json::Value Natspec::devDocumentation(std::multimap<std::string, DocTag> const& _tags)
{
Json::Value json(Json::objectValue);
auto dev = extractDoc(_tags, "dev");
+1 -1
View File
@@ -59,7 +59,7 @@ private:
/// @param _tags docTags that are used.
/// @return A JSON representation
/// of the contract's developer documentation
static Json::Value devDocumentation(std::multimap<std::string, DocTag> const &_tags);
static Json::Value devDocumentation(std::multimap<std::string, DocTag> const& _tags);
};
} //solidity NS