|
@ -20,12 +20,12 @@ |
|
|
* Solidity compiler. |
|
|
* Solidity compiler. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
#include <libsolidity/Compiler.h> |
|
|
#include <algorithm> |
|
|
#include <algorithm> |
|
|
#include <boost/range/adaptor/reversed.hpp> |
|
|
#include <boost/range/adaptor/reversed.hpp> |
|
|
#include <libevmcore/Instruction.h> |
|
|
#include <libevmcore/Instruction.h> |
|
|
#include <libevmcore/Assembly.h> |
|
|
#include <libevmcore/Assembly.h> |
|
|
#include <libsolidity/AST.h> |
|
|
#include <libsolidity/AST.h> |
|
|
#include <libsolidity/Compiler.h> |
|
|
|
|
|
#include <libsolidity/ExpressionCompiler.h> |
|
|
#include <libsolidity/ExpressionCompiler.h> |
|
|
#include <libsolidity/CompilerUtils.h> |
|
|
#include <libsolidity/CompilerUtils.h> |
|
|
|
|
|
|
|
@ -274,19 +274,8 @@ void Compiler::appendReturnValuePacker(TypePointers const& _typeParameters) |
|
|
|
|
|
|
|
|
void Compiler::registerStateVariables(ContractDefinition const& _contract) |
|
|
void Compiler::registerStateVariables(ContractDefinition const& _contract) |
|
|
{ |
|
|
{ |
|
|
vector<VariableDeclaration const*> variables; |
|
|
for (auto const& var: ContractType(_contract).getStateVariables()) |
|
|
for (ContractDefinition const* contract: boost::adaptors::reverse(_contract.getLinearizedBaseContracts())) |
|
|
m_context.addStateVariable(*get<0>(var), get<1>(var), get<2>(var)); |
|
|
for (ASTPointer<VariableDeclaration> const& variable: contract->getStateVariables()) |
|
|
|
|
|
if (!variable->isConstant()) |
|
|
|
|
|
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) |
|
|
void Compiler::initializeStateVariables(ContractDefinition const& _contract) |
|
|