Browse Source

Fix: Storage offset of first struct member should be zero.

cl-refactor
Christian 10 years ago
parent
commit
92b0ff7a10
  1. 2
      libsolidity/Types.cpp

2
libsolidity/Types.cpp

@ -295,9 +295,9 @@ u256 StructType::getStorageOffsetOfMember(string const& _name) const
u256 offset; u256 offset;
for (ASTPointer<VariableDeclaration> variable: m_struct.getMembers()) for (ASTPointer<VariableDeclaration> variable: m_struct.getMembers())
{ {
offset += variable->getType()->getStorageSize();
if (variable->getName() == _name) if (variable->getName() == _name)
return offset; return offset;
offset += variable->getType()->getStorageSize();
} }
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Storage offset of non-existing member requested.")); BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Storage offset of non-existing member requested."));
} }

Loading…
Cancel
Save