aboutsummaryrefslogtreecommitdiffstats
path: root/Types.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-10-16 23:57:27 +0800
committerChristian <c@ethdev.com>2014-10-23 22:27:51 +0800
commita09e4c559d5631a0661b34d0f260612eac0c6e81 (patch)
tree7cb32617b4bfab8496ffd1dbe8478290b1ff49ed /Types.cpp
parentfd046d7c9088498fbb0bded6a8ca69554155f483 (diff)
downloaddexon-solidity-a09e4c559d5631a0661b34d0f260612eac0c6e81.tar.gz
dexon-solidity-a09e4c559d5631a0661b34d0f260612eac0c6e81.tar.zst
dexon-solidity-a09e4c559d5631a0661b34d0f260612eac0c6e81.zip
Type information for AST printer.
Diffstat (limited to 'Types.cpp')
-rw-r--r--Types.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Types.cpp b/Types.cpp
index 7634951a..ca393b7b 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -22,6 +22,7 @@
#include <libsolidity/Types.h>
#include <libsolidity/AST.h>
+#include <libdevcore/CommonIO.h>
namespace dev
{
@@ -130,6 +131,14 @@ bool IntegerType::acceptsUnaryOperator(Token::Value _operator) const
return _operator == Token::DELETE || (!isAddress() && _operator == Token::BIT_NOT);
}
+std::string IntegerType::toString() const
+{
+ if (isAddress())
+ return "address";
+ std::string prefix = isHash() ? "hash" : (isSigned() ? "int" : "uint");
+ return prefix + dev::toString(m_bits);
+}
+
bool BoolType::isExplicitlyConvertibleTo(Type const& _convertTo) const
{
// conversion to integer is fine, but not to address