aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libjulia/backends/evm/EVMCodeTransform.cpp15
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));