diff options
author | Christian <c@ethdev.com> | 2015-02-20 22:52:30 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-02-21 22:10:01 +0800 |
commit | 5e3208317922d20a5b3b760df872a589d87bf94d (patch) | |
tree | 982cb7d888c7ae395de3f533c8e8d1bdd27c5c27 /ExpressionCompiler.cpp | |
parent | 75498a48d83277240605b43e27197be36c02ce23 (diff) | |
download | dexon-solidity-5e3208317922d20a5b3b760df872a589d87bf94d.tar.gz dexon-solidity-5e3208317922d20a5b3b760df872a589d87bf94d.tar.zst dexon-solidity-5e3208317922d20a5b3b760df872a589d87bf94d.zip |
Parsing of array types and basic implementation.
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r-- | ExpressionCompiler.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp index 461dfef1..cdad4840 100644 --- a/ExpressionCompiler.cpp +++ b/ExpressionCompiler.cpp @@ -530,20 +530,21 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) m_context << enumType->getMemberValue(_memberAccess.getMemberName()); break; } - case Type::Category::ByteArray: + case Type::Category::Array: { - solAssert(member == "length", "Illegal bytearray member."); - auto const& type = dynamic_cast<ByteArrayType const&>(*_memberAccess.getExpression().getType()); + solAssert(member == "length", "Illegal array member."); + auto const& type = dynamic_cast<ArrayType const&>(*_memberAccess.getExpression().getType()); + solAssert(type.isByteArray(), "Non byte arrays not yet implemented here."); switch (type.getLocation()) { - case ByteArrayType::Location::CallData: + case ArrayType::Location::CallData: m_context << eth::Instruction::SWAP1 << eth::Instruction::POP; break; - case ByteArrayType::Location::Storage: + case ArrayType::Location::Storage: m_context << eth::Instruction::SLOAD; break; default: - solAssert(false, "Unsupported byte array location."); + solAssert(false, "Unsupported array location."); break; } break; @@ -1135,11 +1136,11 @@ void ExpressionCompiler::LValue::storeValue(Type const& _sourceType, Location co else { solAssert(_sourceType.getCategory() == m_dataType->getCategory(), "Wrong type conversation for assignment."); - if (m_dataType->getCategory() == Type::Category::ByteArray) + if (m_dataType->getCategory() == Type::Category::Array) { CompilerUtils(*m_context).copyByteArrayToStorage( - dynamic_cast<ByteArrayType const&>(*m_dataType), - dynamic_cast<ByteArrayType const&>(_sourceType)); + dynamic_cast<ArrayType const&>(*m_dataType), + dynamic_cast<ArrayType const&>(_sourceType)); if (_move) *m_context << eth::Instruction::POP; } @@ -1210,8 +1211,8 @@ void ExpressionCompiler::LValue::setToZero(Location const& _location) const break; } case LValueType::Storage: - if (m_dataType->getCategory() == Type::Category::ByteArray) - CompilerUtils(*m_context).clearByteArray(dynamic_cast<ByteArrayType const&>(*m_dataType)); + if (m_dataType->getCategory() == Type::Category::Array) + CompilerUtils(*m_context).clearByteArray(dynamic_cast<ArrayType const&>(*m_dataType)); else if (m_dataType->getCategory() == Type::Category::Struct) { // stack layout: ref |