diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-17 08:14:15 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-22 17:51:46 +0800 |
commit | e2cfc9ee92158169b5dd058074f25d67959e9875 (patch) | |
tree | 90cb281b48f95bdcc9904ed12def22bffcb88fb7 /libsolidity/codegen | |
parent | c94b1f81730c27480cb5813a7a909511613c14c5 (diff) | |
download | dexon-solidity-e2cfc9ee92158169b5dd058074f25d67959e9875.tar.gz dexon-solidity-e2cfc9ee92158169b5dd058074f25d67959e9875.tar.zst dexon-solidity-e2cfc9ee92158169b5dd058074f25d67959e9875.zip |
Mark a lot of functions const (where possible)
Diffstat (limited to 'libsolidity/codegen')
-rw-r--r-- | libsolidity/codegen/ABIFunctions.cpp | 2 | ||||
-rw-r--r-- | libsolidity/codegen/ABIFunctions.h | 2 | ||||
-rw-r--r-- | libsolidity/codegen/Compiler.h | 6 | ||||
-rw-r--r-- | libsolidity/codegen/CompilerContext.h | 4 | ||||
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 2 | ||||
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.h | 2 |
6 files changed, 9 insertions, 9 deletions
diff --git a/libsolidity/codegen/ABIFunctions.cpp b/libsolidity/codegen/ABIFunctions.cpp index a2938ed7..2313473f 100644 --- a/libsolidity/codegen/ABIFunctions.cpp +++ b/libsolidity/codegen/ABIFunctions.cpp @@ -1056,7 +1056,7 @@ string ABIFunctions::createFunction(string const& _name, function<string ()> con return _name; } -size_t ABIFunctions::headSize(TypePointers const& _targetTypes) +size_t ABIFunctions::headSize(TypePointers const& _targetTypes) const { size_t headSize = 0; for (auto const& t: _targetTypes) diff --git a/libsolidity/codegen/ABIFunctions.h b/libsolidity/codegen/ABIFunctions.h index 76f4b467..103df5ae 100644 --- a/libsolidity/codegen/ABIFunctions.h +++ b/libsolidity/codegen/ABIFunctions.h @@ -162,7 +162,7 @@ private: std::string createFunction(std::string const& _name, std::function<std::string()> const& _creator); /// @returns the size of the static part of the encoding of the given types. - size_t headSize(TypePointers const& _targetTypes); + size_t headSize(TypePointers const& _targetTypes) const; /// Map from function name to code for a multi-use function. std::map<std::string, std::string> m_requestedFunctions; diff --git a/libsolidity/codegen/Compiler.h b/libsolidity/codegen/Compiler.h index eef078c1..8c63ea9c 100644 --- a/libsolidity/codegen/Compiler.h +++ b/libsolidity/codegen/Compiler.h @@ -51,9 +51,9 @@ public: ContractDefinition const& _contract, std::map<ContractDefinition const*, eth::Assembly const*> const& _contracts ); - eth::Assembly const& assembly() { return m_context.assembly(); } - eth::LinkerObject assembledObject() { return m_context.assembledObject(); } - eth::LinkerObject runtimeObject() { return m_context.assembledRuntimeObject(m_runtimeSub); } + eth::Assembly const& assembly() const { return m_context.assembly(); } + eth::LinkerObject assembledObject() const { return m_context.assembledObject(); } + eth::LinkerObject runtimeObject() const { return m_context.assembledRuntimeObject(m_runtimeSub); } /// @arg _sourceCodes is the map of input files to source code strings /// @arg _inJsonFromat shows whether the out should be in Json format Json::Value streamAssembly(std::ostream& _stream, StringMap const& _sourceCodes = StringMap(), bool _inJsonFormat = false) const diff --git a/libsolidity/codegen/CompilerContext.h b/libsolidity/codegen/CompilerContext.h index 583360ea..96cbf6c1 100644 --- a/libsolidity/codegen/CompilerContext.h +++ b/libsolidity/codegen/CompilerContext.h @@ -208,8 +208,8 @@ public: return m_asm->stream(_stream, "", _sourceCodes, _inJsonFormat); } - eth::LinkerObject const& assembledObject() { return m_asm->assemble(); } - eth::LinkerObject const& assembledRuntimeObject(size_t _subIndex) { return m_asm->sub(_subIndex).assemble(); } + eth::LinkerObject const& assembledObject() const { return m_asm->assemble(); } + eth::LinkerObject const& assembledRuntimeObject(size_t _subIndex) const { return m_asm->sub(_subIndex).assemble(); } /** * Helper class to pop the visited nodes stack when a scope closes diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 55d35c44..639bfc32 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -1811,7 +1811,7 @@ void ExpressionCompiler::setLValueToStorageItem(Expression const& _expression) setLValue<StorageItem>(_expression, *_expression.annotation().type); } -bool ExpressionCompiler::cleanupNeededForOp(Type::Category _type, Token::Value _op) +bool ExpressionCompiler::cleanupNeededForOp(Type::Category _type, Token::Value _op) const { if (Token::isCompareOp(_op) || Token::isShiftOp(_op)) return true; diff --git a/libsolidity/codegen/ExpressionCompiler.h b/libsolidity/codegen/ExpressionCompiler.h index 3b8cf1c6..5f6c3d64 100644 --- a/libsolidity/codegen/ExpressionCompiler.h +++ b/libsolidity/codegen/ExpressionCompiler.h @@ -119,7 +119,7 @@ private: /// @returns true if the operator applied to the given type requires a cleanup prior to the /// operation. - bool cleanupNeededForOp(Type::Category _type, Token::Value _op); + bool cleanupNeededForOp(Type::Category _type, Token::Value _op) const; /// @returns the CompilerUtils object containing the current context. CompilerUtils utils(); |