diff --git a/libdevcore/Common.h b/libdevcore/Common.h index 0967596e2..9fefea45a 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -80,6 +80,9 @@ using StringMap = std::map; using u256Map = std::map; using HexMap = std::map; +// String types. +using strings = std::vector; + // Fixed-length string types. using string32 = std::array; diff --git a/libsolidity/GlobalContext.cpp b/libsolidity/GlobalContext.cpp index 26a52fd10..92ca9548a 100644 --- a/libsolidity/GlobalContext.cpp +++ b/libsolidity/GlobalContext.cpp @@ -38,25 +38,25 @@ m_magicVariables(vector>{make_shared< make_shared("msg", make_shared(MagicType::Kind::MSG)), make_shared("tx", make_shared(MagicType::Kind::TX)), make_shared("suicide", - make_shared(vector{"address"}, vector{}, FunctionType::Location::SUICIDE)), + make_shared(strings{"address"}, strings{}, FunctionType::Location::SUICIDE)), make_shared("sha3", - make_shared(vector{"hash"}, vector{"hash"}, FunctionType::Location::SHA3)), + make_shared(strings{"hash"}, strings{"hash"}, FunctionType::Location::SHA3)), make_shared("log0", - make_shared(vector{"hash"},vector{}, FunctionType::Location::LOG0)), + make_shared(strings{"hash"},strings{}, FunctionType::Location::LOG0)), make_shared("log1", - make_shared(vector{"hash", "hash"},vector{}, FunctionType::Location::LOG1)), + make_shared(strings{"hash", "hash"},strings{}, FunctionType::Location::LOG1)), make_shared("log2", - make_shared(vector{"hash", "hash", "hash"},vector{}, FunctionType::Location::LOG2)), + make_shared(strings{"hash", "hash", "hash"},strings{}, FunctionType::Location::LOG2)), make_shared("log3", - make_shared(vector{"hash", "hash", "hash", "hash"},vector{}, FunctionType::Location::LOG3)), + make_shared(strings{"hash", "hash", "hash", "hash"},strings{}, FunctionType::Location::LOG3)), make_shared("log4", - make_shared(vector{"hash", "hash", "hash", "hash", "hash"},vector{}, FunctionType::Location::LOG4)), + make_shared(strings{"hash", "hash", "hash", "hash", "hash"},strings{}, FunctionType::Location::LOG4)), make_shared("sha256", - make_shared(vector{"hash"}, vector{"hash"}, FunctionType::Location::SHA256)), + make_shared(strings{"hash"}, strings{"hash"}, FunctionType::Location::SHA256)), make_shared("ecrecover", - make_shared(vector{"hash", "hash8", "hash", "hash"}, vector{"address"}, FunctionType::Location::ECRECOVER)), + make_shared(strings{"hash", "hash8", "hash", "hash"}, strings{"address"}, FunctionType::Location::ECRECOVER)), make_shared("ripemd160", - make_shared(vector{"hash"}, vector{"hash160"}, FunctionType::Location::RIPEMD160))}) + make_shared(strings{"hash"}, strings{"hash160"}, FunctionType::Location::RIPEMD160))}) { } diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp index b3eae2025..7ca1dc6d5 100644 --- a/libsolidity/Types.cpp +++ b/libsolidity/Types.cpp @@ -205,11 +205,11 @@ TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointe const MemberList IntegerType::AddressMemberList = MemberList({{"balance", make_shared(256)}, - {"callstring32", make_shared(vector{"string32"}, - vector{}, FunctionType::Location::BARE)}, - {"callstring32string32", make_shared(vector{"string32", "string32"}, - vector{}, FunctionType::Location::BARE)}, - {"send", make_shared(vector{"uint"}, vector{}, FunctionType::Location::SEND)}}); + {"callstring32", make_shared(strings{"string32"}, strings{}, + FunctionType::Location::BARE)}, + {"callstring32string32", make_shared(strings{"string32", "string32"}, + strings{}, FunctionType::Location::BARE)}, + {"send", make_shared(strings{"uint"}, strings{}, FunctionType::Location::SEND)}}); shared_ptr IntegerConstantType::fromLiteral(string const& _literal) { @@ -619,7 +619,7 @@ string FunctionType::getCanonicalSignature() const return ret + ")"; } -TypePointers FunctionType::parseElementaryTypeVector(vector const& _types) +TypePointers FunctionType::parseElementaryTypeVector(strings const& _types) { TypePointers pointers; pointers.reserve(_types.size()); diff --git a/libsolidity/Types.h b/libsolidity/Types.h index 031d45ea5..deabe1160 100644 --- a/libsolidity/Types.h +++ b/libsolidity/Types.h @@ -352,10 +352,10 @@ public: virtual Category getCategory() const override { return Category::FUNCTION; } explicit FunctionType(FunctionDefinition const& _function, bool _isInternal = true); - FunctionType(std::vector const& _parameterTypes, - std::vector const& _returnParameterTypes, + FunctionType(strings const& _parameterTypes, strings const& _returnParameterTypes, Location _location = Location::INTERNAL): - FunctionType(parseElementaryTypeVector(_parameterTypes), parseElementaryTypeVector(_returnParameterTypes), _location) {} + FunctionType(parseElementaryTypeVector(_parameterTypes), parseElementaryTypeVector(_returnParameterTypes), + _location) {} FunctionType(TypePointers const& _parameterTypes, TypePointers const& _returnParameterTypes, Location _location = Location::INTERNAL): m_parameterTypes(_parameterTypes), m_returnParameterTypes(_returnParameterTypes), @@ -375,7 +375,7 @@ public: std::string getCanonicalSignature() const; private: - static TypePointers parseElementaryTypeVector(std::vector const& _types); + static TypePointers parseElementaryTypeVector(strings const& _types); TypePointers m_parameterTypes; TypePointers m_returnParameterTypes;