diff options
-rw-r--r-- | ExpressionCompiler.cpp | 6 | ||||
-rw-r--r-- | Types.cpp | 2 | ||||
-rw-r--r-- | Types.h | 2 |
3 files changed, 10 insertions, 0 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp index 63132a12..3dbb4012 100644 --- a/ExpressionCompiler.cpp +++ b/ExpressionCompiler.cpp @@ -504,6 +504,12 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) } BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Invalid member access to " + type.toString())); } + case Type::Category::ByteArray: + { + solAssert(member == "length", "Illegal bytearray member."); + m_context << eth::Instruction::SLOAD; + break; + } default: BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Member access to unknown type.")); } @@ -541,6 +541,8 @@ unsigned ByteArrayType::getSizeOnStack() const return 1; } +const MemberList ByteArrayType::s_byteArrayMemberList = MemberList({{"length", make_shared<IntegerType >(256)}}); + bool ContractType::operator==(Type const& _other) const { if (_other.getCategory() != getCategory()) @@ -292,11 +292,13 @@ public: virtual bool operator==(const Type& _other) const override; virtual unsigned getSizeOnStack() const override; virtual std::string toString() const override { return "bytes"; } + virtual MemberList const& getMembers() const override { return s_byteArrayMemberList; } Location getLocation() const { return m_location; } private: Location m_location; + static const MemberList s_byteArrayMemberList; }; /** |