aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/ReferencesResolver.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-11-22 19:54:23 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-12-12 17:44:18 +0800
commit48c7ba72f3616a037fe3fe8cf1a490b121c416e3 (patch)
tree9bdcea998fa7e34d564d38510a34fef70f2c053f /libsolidity/analysis/ReferencesResolver.cpp
parent7ff9a85592cbb50b7a72654849582c780d7fc494 (diff)
downloaddexon-solidity-48c7ba72f3616a037fe3fe8cf1a490b121c416e3.tar
dexon-solidity-48c7ba72f3616a037fe3fe8cf1a490b121c416e3.tar.gz
dexon-solidity-48c7ba72f3616a037fe3fe8cf1a490b121c416e3.tar.bz2
dexon-solidity-48c7ba72f3616a037fe3fe8cf1a490b121c416e3.tar.lz
dexon-solidity-48c7ba72f3616a037fe3fe8cf1a490b121c416e3.tar.xz
dexon-solidity-48c7ba72f3616a037fe3fe8cf1a490b121c416e3.tar.zst
dexon-solidity-48c7ba72f3616a037fe3fe8cf1a490b121c416e3.zip
Simplify ConstantEvaluator.
Diffstat (limited to 'libsolidity/analysis/ReferencesResolver.cpp')
-rw-r--r--libsolidity/analysis/ReferencesResolver.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp
index d8030b97..9eee16af 100644
--- a/libsolidity/analysis/ReferencesResolver.cpp
+++ b/libsolidity/analysis/ReferencesResolver.cpp
@@ -146,9 +146,10 @@ void ReferencesResolver::endVisit(ArrayTypeName const& _typeName)
fatalTypeError(_typeName.baseType().location(), "Illegal base type of storage size zero for array.");
if (Expression const* length = _typeName.length())
{
- if (!length->annotation().type)
- ConstantEvaluator e(*length, m_errorReporter);
- auto const* lengthType = dynamic_cast<RationalNumberType const*>(length->annotation().type.get());
+ TypePointer lengthTypeGeneric = length->annotation().type;
+ if (!lengthTypeGeneric)
+ lengthTypeGeneric = ConstantEvaluator(m_errorReporter).evaluate(*length);
+ RationalNumberType const* lengthType = dynamic_cast<RationalNumberType const*>(lengthTypeGeneric.get());
if (!lengthType || !lengthType->mobileType())
fatalTypeError(length->location(), "Invalid array length, expected integer literal or constant expression.");
else if (lengthType->isFractional())