mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Mark appropriate constructors explicit
This commit is contained in:
parent
3cf2426e1a
commit
2a5772cff7
@ -157,7 +157,7 @@ template <> inline u256 exp10<0>()
|
|||||||
class ScopeGuard
|
class ScopeGuard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScopeGuard(std::function<void(void)> _f): m_f(_f) {}
|
explicit ScopeGuard(std::function<void(void)> _f): m_f(_f) {}
|
||||||
~ScopeGuard() { m_f(); }
|
~ScopeGuard() { m_f(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
enum ConstructFromHashType { AlignLeft, AlignRight, FailIfDifferent };
|
enum ConstructFromHashType { AlignLeft, AlignRight, FailIfDifferent };
|
||||||
|
|
||||||
/// Construct an empty hash.
|
/// Construct an empty hash.
|
||||||
FixedHash() { m_data.fill(0); }
|
explicit FixedHash() { m_data.fill(0); }
|
||||||
|
|
||||||
/// Construct from another hash, filling with zeroes or cropping as necessary.
|
/// Construct from another hash, filling with zeroes or cropping as necessary.
|
||||||
template <unsigned M> explicit FixedHash(FixedHash<M> const& _h, ConstructFromHashType _t = AlignLeft) { m_data.fill(0); unsigned c = std::min(M, N); for (unsigned i = 0; i < c; ++i) m_data[_t == AlignRight ? N - 1 - i : i] = _h[_t == AlignRight ? M - 1 - i : i]; }
|
template <unsigned M> explicit FixedHash(FixedHash<M> const& _h, ConstructFromHashType _t = AlignLeft) { m_data.fill(0); unsigned c = std::min(M, N); for (unsigned i = 0; i < c; ++i) m_data[_t == AlignRight ? N - 1 - i : i] = _h[_t == AlignRight ? M - 1 - i : i]; }
|
||||||
|
@ -45,7 +45,7 @@ using AssemblyItems = std::vector<AssemblyItem>;
|
|||||||
class BlockDeduplicator
|
class BlockDeduplicator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BlockDeduplicator(AssemblyItems& _items): m_items(_items) {}
|
explicit BlockDeduplicator(AssemblyItems& _items): m_items(_items) {}
|
||||||
/// @returns true if something was changed
|
/// @returns true if something was changed
|
||||||
bool deduplicate();
|
bool deduplicate();
|
||||||
/// @returns the tags that were replaced.
|
/// @returns the tags that were replaced.
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
using Id = ExpressionClasses::Id;
|
using Id = ExpressionClasses::Id;
|
||||||
using StoreOperation = KnownState::StoreOperation;
|
using StoreOperation = KnownState::StoreOperation;
|
||||||
|
|
||||||
CommonSubexpressionEliminator(KnownState const& _state): m_initialState(_state), m_state(_state) {}
|
explicit CommonSubexpressionEliminator(KnownState const& _state): m_initialState(_state), m_state(_state) {}
|
||||||
|
|
||||||
/// Feeds AssemblyItems into the eliminator and @returns the iterator pointing at the first
|
/// Feeds AssemblyItems into the eliminator and @returns the iterator pointing at the first
|
||||||
/// item that must be fed into a new instance of the eliminator.
|
/// item that must be fed into a new instance of the eliminator.
|
||||||
|
@ -50,7 +50,7 @@ struct GasPath
|
|||||||
class PathGasMeter
|
class PathGasMeter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PathGasMeter(AssemblyItems const& _items);
|
explicit PathGasMeter(AssemblyItems const& _items);
|
||||||
|
|
||||||
GasMeter::GasConsumption estimateMax(size_t _startIndex, std::shared_ptr<KnownState> const& _state);
|
GasMeter::GasConsumption estimateMax(size_t _startIndex, std::shared_ptr<KnownState> const& _state);
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ using TypePointer = std::shared_ptr<Type const>;
|
|||||||
class ArrayUtils
|
class ArrayUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ArrayUtils(CompilerContext& _context): m_context(_context) {}
|
explicit ArrayUtils(CompilerContext& _context): m_context(_context) {}
|
||||||
|
|
||||||
/// Copies an array to an array in storage. The arrays can be of different types only if
|
/// Copies an array to an array in storage. The arrays can be of different types only if
|
||||||
/// their storage representation is the same.
|
/// their storage representation is the same.
|
||||||
|
@ -33,7 +33,7 @@ class Type; // forward
|
|||||||
class CompilerUtils
|
class CompilerUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CompilerUtils(CompilerContext& _context): m_context(_context) {}
|
explicit CompilerUtils(CompilerContext& _context): m_context(_context) {}
|
||||||
|
|
||||||
/// Stores the initial value of the free-memory-pointer at its position;
|
/// Stores the initial value of the free-memory-pointer at its position;
|
||||||
void initialiseFreeMemoryPointer();
|
void initialiseFreeMemoryPointer();
|
||||||
|
@ -45,7 +45,7 @@ using namespace dev::solidity;
|
|||||||
class StackHeightChecker
|
class StackHeightChecker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StackHeightChecker(CompilerContext const& _context):
|
explicit StackHeightChecker(CompilerContext const& _context):
|
||||||
m_context(_context), stackHeight(m_context.stackHeight()) {}
|
m_context(_context), stackHeight(m_context.stackHeight()) {}
|
||||||
void check() { solAssert(m_context.stackHeight() == stackHeight, std::string("I sense a disturbance in the stack: ") + std::to_string(m_context.stackHeight()) + " vs " + std::to_string(stackHeight)); }
|
void check() { solAssert(m_context.stackHeight() == stackHeight, std::string("I sense a disturbance in the stack: ") + std::to_string(m_context.stackHeight()) + " vs " + std::to_string(stackHeight)); }
|
||||||
private:
|
private:
|
||||||
|
@ -52,7 +52,7 @@ using namespace dev::solidity::assembly;
|
|||||||
class EthAssemblyAdapter: public julia::AbstractAssembly
|
class EthAssemblyAdapter: public julia::AbstractAssembly
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EthAssemblyAdapter(eth::Assembly& _assembly):
|
explicit EthAssemblyAdapter(eth::Assembly& _assembly):
|
||||||
m_assembly(_assembly)
|
m_assembly(_assembly)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class ErrorReporter
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ErrorReporter(ErrorList& _errors):
|
explicit ErrorReporter(ErrorList& _errors):
|
||||||
m_errorList(_errors) { }
|
m_errorList(_errors) { }
|
||||||
|
|
||||||
ErrorReporter& operator=(ErrorReporter const& _errorReporter);
|
ErrorReporter& operator=(ErrorReporter const& _errorReporter);
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
/// Creates a new StandardCompiler.
|
/// Creates a new StandardCompiler.
|
||||||
/// @param _readFile callback to used to read files for import statements. Must return
|
/// @param _readFile callback to used to read files for import statements. Must return
|
||||||
/// and must not emit exceptions.
|
/// and must not emit exceptions.
|
||||||
StandardCompiler(ReadFile::Callback const& _readFile = ReadFile::Callback())
|
explicit StandardCompiler(ReadFile::Callback const& _readFile = ReadFile::Callback())
|
||||||
: m_compilerStack(_readFile), m_readFile(_readFile)
|
: m_compilerStack(_readFile), m_readFile(_readFile)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ namespace solidity
|
|||||||
class Parser::ASTNodeFactory
|
class Parser::ASTNodeFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ASTNodeFactory(Parser const& _parser):
|
explicit ASTNodeFactory(Parser const& _parser):
|
||||||
m_parser(_parser), m_location(_parser.position(), -1, _parser.sourceName()) {}
|
m_parser(_parser), m_location(_parser.position(), -1, _parser.sourceName()) {}
|
||||||
ASTNodeFactory(Parser const& _parser, ASTPointer<ASTNode> const& _childNode):
|
ASTNodeFactory(Parser const& _parser, ASTPointer<ASTNode> const& _childNode):
|
||||||
m_parser(_parser), m_location(_childNode->location()) {}
|
m_parser(_parser), m_location(_childNode->location()) {}
|
||||||
@ -69,7 +69,7 @@ private:
|
|||||||
class Parser::RecursionGuard
|
class Parser::RecursionGuard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RecursionGuard(Parser& _parser):
|
explicit RecursionGuard(Parser& _parser):
|
||||||
m_parser(_parser)
|
m_parser(_parser)
|
||||||
{
|
{
|
||||||
m_parser.increaseRecursionDepth();
|
m_parser.increaseRecursionDepth();
|
||||||
|
@ -35,7 +35,7 @@ class Scanner;
|
|||||||
class Parser: public ParserBase
|
class Parser: public ParserBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Parser(ErrorReporter& _errorReporter): ParserBase(_errorReporter) {}
|
explicit Parser(ErrorReporter& _errorReporter): ParserBase(_errorReporter) {}
|
||||||
|
|
||||||
ASTPointer<SourceUnit> parse(std::shared_ptr<Scanner> const& _scanner);
|
ASTPointer<SourceUnit> parse(std::shared_ptr<Scanner> const& _scanner);
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class Scanner;
|
|||||||
class ParserBase
|
class ParserBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ParserBase(ErrorReporter& errorReporter): m_errorReporter(errorReporter) {}
|
explicit ParserBase(ErrorReporter& errorReporter): m_errorReporter(errorReporter) {}
|
||||||
|
|
||||||
std::shared_ptr<std::string const> const& sourceName() const;
|
std::shared_ptr<std::string const> const& sourceName() const;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ public:
|
|||||||
std::string const& accountCreateIfNotExists(size_t _id);
|
std::string const& accountCreateIfNotExists(size_t _id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RPCSession(std::string const& _path);
|
explicit RPCSession(std::string const& _path);
|
||||||
|
|
||||||
inline std::string quote(std::string const& _arg) { return "\"" + _arg + "\""; }
|
inline std::string quote(std::string const& _arg) { return "\"" + _arg + "\""; }
|
||||||
/// Parse std::string replacing keywords to values
|
/// Parse std::string replacing keywords to values
|
||||||
|
Loading…
Reference in New Issue
Block a user