mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Support variable declarations without an assignment in EVM
This commit is contained in:
parent
cee93d946d
commit
03abf792c5
@ -37,10 +37,19 @@ void CodeTransform::operator()(VariableDeclaration const& _varDecl)
|
|||||||
{
|
{
|
||||||
solAssert(m_scope, "");
|
solAssert(m_scope, "");
|
||||||
|
|
||||||
int expectedItems = _varDecl.variables.size();
|
int const expectedItems = _varDecl.variables.size();
|
||||||
int height = m_assembly.stackHeight();
|
int height = m_assembly.stackHeight();
|
||||||
boost::apply_visitor(*this, *_varDecl.value);
|
if (_varDecl.value)
|
||||||
expectDeposit(expectedItems, height);
|
{
|
||||||
|
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)
|
for (auto const& variable: _varDecl.variables)
|
||||||
{
|
{
|
||||||
auto& var = boost::get<Scope::Variable>(m_scope->identifiers.at(variable.name));
|
auto& var = boost::get<Scope::Variable>(m_scope->identifiers.at(variable.name));
|
||||||
|
Loading…
Reference in New Issue
Block a user