aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/ReferencesResolver.cpp
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-09-07 00:59:50 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-09-11 20:52:23 +0800
commit1ce3581a522a94d9e9a4a84cf8cb63f626e1a14f (patch)
tree258433cfc4c6fced543ba9cf968995e09438c851 /libsolidity/analysis/ReferencesResolver.cpp
parent7d5c13981623f5f931444d227b163d9b0d995fd8 (diff)
downloaddexon-solidity-1ce3581a522a94d9e9a4a84cf8cb63f626e1a14f.tar.gz
dexon-solidity-1ce3581a522a94d9e9a4a84cf8cb63f626e1a14f.tar.zst
dexon-solidity-1ce3581a522a94d9e9a4a84cf8cb63f626e1a14f.zip
Accept ``address payable`` during parsing.
Diffstat (limited to 'libsolidity/analysis/ReferencesResolver.cpp')
-rw-r--r--libsolidity/analysis/ReferencesResolver.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp
index 8750b47b..4b678c3b 100644
--- a/libsolidity/analysis/ReferencesResolver.cpp
+++ b/libsolidity/analysis/ReferencesResolver.cpp
@@ -112,7 +112,20 @@ bool ReferencesResolver::visit(Identifier const& _identifier)
bool ReferencesResolver::visit(ElementaryTypeName const& _typeName)
{
- _typeName.annotation().type = Type::fromElementaryTypeName(_typeName.typeName());
+ if (!_typeName.annotation().type)
+ {
+ _typeName.annotation().type = Type::fromElementaryTypeName(_typeName.typeName());
+ if (_typeName.stateMutability().is_initialized())
+ {
+ // for non-address types this was already caught by the parser
+ solAssert(_typeName.annotation().type->category() == Type::Category::Address, "");
+ if (!(
+ *_typeName.stateMutability() == StateMutability::Payable ||
+ *_typeName.stateMutability() == StateMutability::NonPayable
+ ))
+ m_errorReporter.typeError(_typeName.location(), "Address types can only be payable or non-payable.");
+ }
+ }
return true;
}