aboutsummaryrefslogtreecommitdiffstats
path: root/libjulia/backends
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-07-13 22:58:24 +0800
committerGitHub <noreply@github.com>2017-07-13 22:58:24 +0800
commitb5da5f6e42c9d60206d5045ace471c7b5839ed30 (patch)
treef1aa574f2a1312340a081997de690384206c8aa8 /libjulia/backends
parentd1c3ecc94a4c0b36ccfd310a0ccf15e9e9b4a8dd (diff)
parent8d90e6fc4e76ccf41d8ccb59c23920623269cd06 (diff)
downloaddexon-solidity-b5da5f6e42c9d60206d5045ace471c7b5839ed30.tar.gz
dexon-solidity-b5da5f6e42c9d60206d5045ace471c7b5839ed30.tar.zst
dexon-solidity-b5da5f6e42c9d60206d5045ace471c7b5839ed30.zip
Merge pull request #2504 from ethereum/inlineasm-decl-empty
Support variable declarations without an assignment in assembly
Diffstat (limited to 'libjulia/backends')
-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..704aa3c1 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 numVariables = _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(numVariables, height);
+ }
+ else
+ {
+ int variablesLeft = numVariables;
+ 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));