aboutsummaryrefslogtreecommitdiffstats
path: root/AST.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-02-23 08:31:05 +0800
committerChristian <c@ethdev.com>2015-02-24 01:28:30 +0800
commit5d2323c91486cfcab9322b01d52ba35525e06272 (patch)
tree556109fcfcff6c1089732545701dfc397efbf848 /AST.cpp
parent754c804d191ad8f05d886566e599a82efbd38d8e (diff)
downloaddexon-solidity-5d2323c91486cfcab9322b01d52ba35525e06272.tar.gz
dexon-solidity-5d2323c91486cfcab9322b01d52ba35525e06272.tar.zst
dexon-solidity-5d2323c91486cfcab9322b01d52ba35525e06272.zip
Index and length access for dynamic arrays.
Diffstat (limited to 'AST.cpp')
-rw-r--r--AST.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/AST.cpp b/AST.cpp
index 17946115..c37e8c37 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -603,7 +603,17 @@ void MemberAccess::checkTypeRequirements()
if (!m_type)
BOOST_THROW_EXCEPTION(createTypeError("Member \"" + *m_memberName + "\" not found or not "
"visible in " + type.toString()));
- m_isLValue = (type.getCategory() == Type::Category::Struct);
+ // This should probably move somewhere else.
+ if (type.getCategory() == Type::Category::Struct)
+ m_isLValue = true;
+ else if (type.getCategory() == Type::Category::Array)
+ {
+ auto const& arrayType(dynamic_cast<ArrayType const&>(type));
+ m_isLValue = (*m_memberName == "length" &&
+ arrayType.getLocation() != ArrayType::Location::CallData && arrayType.isDynamicallySized());
+ }
+ else
+ m_isLValue = false;
}
void IndexAccess::checkTypeRequirements()