diff options
author | chriseth <c@ethdev.com> | 2015-03-14 02:48:24 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-03-17 01:07:14 +0800 |
commit | 02595abf6ac1c30c7c0125c5a705cd2c85974838 (patch) | |
tree | b824309b77c9be95bd81b50e6e4cc6b457b3b9a9 /Compiler.cpp | |
parent | 7f64584b7fb151459500ade84612d3cd48f13f18 (diff) | |
download | dexon-solidity-02595abf6ac1c30c7c0125c5a705cd2c85974838.tar dexon-solidity-02595abf6ac1c30c7c0125c5a705cd2c85974838.tar.gz dexon-solidity-02595abf6ac1c30c7c0125c5a705cd2c85974838.tar.bz2 dexon-solidity-02595abf6ac1c30c7c0125c5a705cd2c85974838.tar.lz dexon-solidity-02595abf6ac1c30c7c0125c5a705cd2c85974838.tar.xz dexon-solidity-02595abf6ac1c30c7c0125c5a705cd2c85974838.tar.zst dexon-solidity-02595abf6ac1c30c7c0125c5a705cd2c85974838.zip |
Fetch and store packed values.
Diffstat (limited to 'Compiler.cpp')
-rw-r--r-- | Compiler.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Compiler.cpp b/Compiler.cpp index 0f4e89de..db61cc4a 100644 --- a/Compiler.cpp +++ b/Compiler.cpp @@ -274,10 +274,19 @@ void Compiler::appendReturnValuePacker(TypePointers const& _typeParameters) void Compiler::registerStateVariables(ContractDefinition const& _contract) { + vector<VariableDeclaration const*> variables; for (ContractDefinition const* contract: boost::adaptors::reverse(_contract.getLinearizedBaseContracts())) for (ASTPointer<VariableDeclaration> const& variable: contract->getStateVariables()) if (!variable->isConstant()) - m_context.addStateVariable(*variable); + variables.push_back(variable.get()); + TypePointers types; + for (auto variable: variables) + types.push_back(variable->getType()); + StorageOffsets offsets; + offsets.computeOffsets(types); + for (size_t index = 0; index < variables.size(); ++index) + if (auto const* offset = offsets.getOffset(index)) + m_context.addStateVariable(*variables[index], offset->first, offset->second); } void Compiler::initializeStateVariables(ContractDefinition const& _contract) |