diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-07-02 18:21:34 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-07-13 21:18:18 +0800 |
commit | 03abf792c5b5e462b0d8135bf6d02fbb7bf0fe5d (patch) | |
tree | 78e1576c690d66aa11f75bbc97903d6b2199b841 /libjulia/backends | |
parent | cee93d946d798a4076ab5df5f32c5687608defe8 (diff) | |
download | dexon-solidity-03abf792c5b5e462b0d8135bf6d02fbb7bf0fe5d.tar.gz dexon-solidity-03abf792c5b5e462b0d8135bf6d02fbb7bf0fe5d.tar.zst dexon-solidity-03abf792c5b5e462b0d8135bf6d02fbb7bf0fe5d.zip |
Support variable declarations without an assignment in EVM
Diffstat (limited to 'libjulia/backends')
-rw-r--r-- | libjulia/backends/evm/EVMCodeTransform.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libjulia/backends/evm/EVMCodeTransform.cpp b/libjulia/backends/evm/EVMCodeTransform.cpp index efbe5647..a4967dbd 100644 --- a/libjulia/backends/evm/EVMCodeTransform.cpp +++ b/libjulia/backends/evm/EVMCodeTransform.cpp @@ -37,10 +37,19 @@ void CodeTransform::operator()(VariableDeclaration const& _varDecl) { solAssert(m_scope, ""); - int expectedItems = _varDecl.variables.size(); + int const expectedItems = _varDecl.variables.size(); int height = m_assembly.stackHeight(); - boost::apply_visitor(*this, *_varDecl.value); - expectDeposit(expectedItems, height); + if (_varDecl.value) + { + boost::apply_visitor(*this, *_varDecl.value); + expectDeposit(expectedItems, height); + } + else + { + int variablesLeft = expectedItems; + while (variablesLeft--) + m_assembly.appendConstant(u256(0)); + } for (auto const& variable: _varDecl.variables) { auto& var = boost::get<Scope::Variable>(m_scope->identifiers.at(variable.name)); |