aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ExpressionCompiler.cpp6
-rw-r--r--Types.cpp2
-rw-r--r--Types.h2
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."));
}
diff --git a/Types.cpp b/Types.cpp
index b1029ec6..33cc8a1e 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -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())
diff --git a/Types.h b/Types.h
index 627bc76f..5a0e2c42 100644
--- a/Types.h
+++ b/Types.h
@@ -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;
};
/**