diff options
author | LianaHus <liana@ethdev.com> | 2015-08-21 23:57:57 +0800 |
---|---|---|
committer | LianaHus <liana@ethdev.com> | 2015-08-21 23:57:57 +0800 |
commit | 1af8ff01215f4d6ab5d5b3b1c4e2d1785a69c9c9 (patch) | |
tree | 8be884acdc58815c5463860c6ff147f37f548793 /libsolidity/AST.cpp | |
parent | 289b8146703521943e6106e5d3f178deb0117652 (diff) | |
download | dexon-solidity-1af8ff01215f4d6ab5d5b3b1c4e2d1785a69c9c9.tar.gz dexon-solidity-1af8ff01215f4d6ab5d5b3b1c4e2d1785a69c9c9.tar.zst dexon-solidity-1af8ff01215f4d6ab5d5b3b1c4e2d1785a69c9c9.zip |
add tests for state variables accessors. normal and constant
fixed the issue with accessors for constant state variables
Diffstat (limited to 'libsolidity/AST.cpp')
-rw-r--r-- | libsolidity/AST.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index 8bad6ccf..f7c84ccb 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -554,8 +554,11 @@ void VariableDeclaration::checkTypeRequirements() { if (!dynamic_cast<ContractDefinition const*>(getScope())) BOOST_THROW_EXCEPTION(createTypeError("Illegal use of \"constant\" specifier.")); - if ((m_type && !m_type->isValueType()) || !m_value) - BOOST_THROW_EXCEPTION(createTypeError("Unitialized \"constant\" variable.")); + if (!m_value) + BOOST_THROW_EXCEPTION(createTypeError("Uninitialized \"constant\" variable.")); + else if (!m_type->isValueType()) + // TODO: const is implemented only for uint, bytesXX and enums types. + BOOST_THROW_EXCEPTION(createTypeError("Illegal use of \"constant\" specifier. \"constant\" is not implemented for this type yet.")); } if (m_type) { |