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 /CompilerContext.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 'CompilerContext.cpp')
-rw-r--r-- | CompilerContext.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/CompilerContext.cpp b/CompilerContext.cpp index f2bb1de2..7cade367 100644 --- a/CompilerContext.cpp +++ b/CompilerContext.cpp @@ -37,15 +37,13 @@ void CompilerContext::addMagicGlobal(MagicVariableDeclaration const& _declaratio m_magicGlobals.insert(&_declaration); } -void CompilerContext::addStateVariable(VariableDeclaration const& _declaration) +void CompilerContext::addStateVariable( + VariableDeclaration const& _declaration, + u256 const& _storageOffset, + unsigned _byteOffset +) { - m_stateVariables[&_declaration] = m_stateVariablesSize; - bigint newSize = bigint(m_stateVariablesSize) + _declaration.getType()->getStorageSize(); - if (newSize >= bigint(1) << 256) - BOOST_THROW_EXCEPTION(TypeError() - << errinfo_comment("State variable does not fit in storage.") - << errinfo_sourceLocation(_declaration.getLocation())); - m_stateVariablesSize = u256(newSize); + m_stateVariables[&_declaration] = make_pair(_storageOffset, _byteOffset); } void CompilerContext::startFunction(Declaration const& _function) @@ -170,7 +168,7 @@ unsigned CompilerContext::currentToBaseStackOffset(unsigned _offset) const return m_asm.deposit() - _offset - 1; } -u256 CompilerContext::getStorageLocationOfVariable(const Declaration& _declaration) const +pair<u256, unsigned> CompilerContext::getStorageLocationOfVariable(const Declaration& _declaration) const { auto it = m_stateVariables.find(&_declaration); solAssert(it != m_stateVariables.end(), "Variable not found in storage."); |