aboutsummaryrefslogtreecommitdiffstats
path: root/Types.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-01-12 19:46:52 +0800
committerChristian <c@ethdev.com>2015-01-12 19:46:52 +0800
commit307a83e1dea95cd144a955aa0891476e7dd159de (patch)
tree5adca427a0debe24ba729bd3cd917c821c92ebca /Types.cpp
parent94cff9684f8b1d4a5e2eeba58444a99e32e8a7ae (diff)
downloaddexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar
dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar.gz
dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar.bz2
dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar.lz
dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar.xz
dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar.zst
dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.zip
More convenient function type construction.
Diffstat (limited to 'Types.cpp')
-rw-r--r--Types.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/Types.cpp b/Types.cpp
index eda022cc..b3eae202 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -35,7 +35,7 @@ namespace solidity
shared_ptr<Type const> Type::fromElementaryTypeName(Token::Value _typeToken)
{
- solAssert(Token::isElementaryTypeName(_typeToken), "");
+ solAssert(Token::isElementaryTypeName(_typeToken), "Elementary type name expected.");
if (Token::INT <= _typeToken && _typeToken <= Token::HASH256)
{
@@ -204,18 +204,12 @@ TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointe
}
const MemberList IntegerType::AddressMemberList =
- MemberList({{"balance",
- make_shared<IntegerType >(256)},
- {"callstring32",
- make_shared<FunctionType>(TypePointers({make_shared<StaticStringType>(32)}),
- TypePointers(), FunctionType::Location::BARE)},
- {"callstring32string32",
- make_shared<FunctionType>(TypePointers({make_shared<StaticStringType>(32),
- make_shared<StaticStringType>(32)}),
- TypePointers(), FunctionType::Location::BARE)},
- {"send",
- make_shared<FunctionType>(TypePointers({make_shared<IntegerType>(256)}),
- TypePointers(), FunctionType::Location::SEND)}});
+ MemberList({{"balance", make_shared<IntegerType >(256)},
+ {"callstring32", make_shared<FunctionType>(vector<string>{"string32"},
+ vector<string>{}, FunctionType::Location::BARE)},
+ {"callstring32string32", make_shared<FunctionType>(vector<string>{"string32", "string32"},
+ vector<string>{}, FunctionType::Location::BARE)},
+ {"send", make_shared<FunctionType>(vector<string>{"uint"}, vector<string>{}, FunctionType::Location::SEND)}});
shared_ptr<IntegerConstantType const> IntegerConstantType::fromLiteral(string const& _literal)
{
@@ -625,6 +619,15 @@ string FunctionType::getCanonicalSignature() const
return ret + ")";
}
+TypePointers FunctionType::parseElementaryTypeVector(vector<string> const& _types)
+{
+ TypePointers pointers;
+ pointers.reserve(_types.size());
+ for (string const& type: _types)
+ pointers.push_back(Type::fromElementaryTypeName(Token::fromIdentifierOrKeyword(type)));
+ return pointers;
+}
+
bool MappingType::operator==(Type const& _other) const
{
if (_other.getCategory() != getCategory())