diff options
author | chriseth <c@ethdev.com> | 2015-06-05 17:07:50 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-06-05 20:44:05 +0800 |
commit | f4d1acc563a972ee4f5a44c690cd3fdd1783ae97 (patch) | |
tree | b2814613dff69ffe8f1e14ef6160dcc0902eb3c4 /AST.cpp | |
parent | 4987eec3d1e87868e091850d31af58e054ab5ee5 (diff) | |
download | dexon-solidity-f4d1acc563a972ee4f5a44c690cd3fdd1783ae97.tar.gz dexon-solidity-f4d1acc563a972ee4f5a44c690cd3fdd1783ae97.tar.zst dexon-solidity-f4d1acc563a972ee4f5a44c690cd3fdd1783ae97.zip |
Ability to specify the storage location of a reference type.
Diffstat (limited to 'AST.cpp')
-rw-r--r-- | AST.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -528,6 +528,17 @@ void VariableDeclaration::checkTypeRequirements() BOOST_THROW_EXCEPTION(createTypeError("Internal type is not allowed for public state variables.")); } +bool VariableDeclaration::isFunctionParameter() const +{ + auto const* function = dynamic_cast<FunctionDefinition const*>(getScope()); + if (!function) + return false; + for (auto const& variable: function->getParameters() + function->getReturnParameters()) + if (variable.get() == this) + return true; + return false; +} + bool VariableDeclaration::isExternalFunctionParameter() const { auto const* function = dynamic_cast<FunctionDefinition const*>(getScope()); @@ -879,7 +890,7 @@ void MemberAccess::checkTypeRequirements(TypePointers const* _argumentTypes) { auto const& arrayType(dynamic_cast<ArrayType const&>(type)); m_isLValue = (*m_memberName == "length" && - arrayType.getLocation() != ArrayType::Location::CallData && arrayType.isDynamicallySized()); + arrayType.location() != ReferenceType::Location::CallData && arrayType.isDynamicallySized()); } else m_isLValue = false; @@ -902,7 +913,7 @@ void IndexAccess::checkTypeRequirements(TypePointers const*) m_type = make_shared<FixedBytesType>(1); else m_type = type.getBaseType(); - m_isLValue = type.getLocation() != ArrayType::Location::CallData; + m_isLValue = type.location() != ReferenceType::Location::CallData; break; } case Type::Category::Mapping: @@ -919,7 +930,7 @@ void IndexAccess::checkTypeRequirements(TypePointers const*) { TypeType const& type = dynamic_cast<TypeType const&>(*m_base->getType()); if (!m_index) - m_type = make_shared<TypeType>(make_shared<ArrayType>(ArrayType::Location::Memory, type.getActualType())); + m_type = make_shared<TypeType>(make_shared<ArrayType>(ReferenceType::Location::Memory, type.getActualType())); else { m_index->checkTypeRequirements(nullptr); @@ -927,7 +938,7 @@ void IndexAccess::checkTypeRequirements(TypePointers const*) if (!length) BOOST_THROW_EXCEPTION(m_index->createTypeError("Integer constant expected.")); m_type = make_shared<TypeType>(make_shared<ArrayType>( - ArrayType::Location::Memory, type.getActualType(), length->literalValue(nullptr))); + ReferenceType::Location::Memory, type.getActualType(), length->literalValue(nullptr))); } break; } |