aboutsummaryrefslogtreecommitdiffstats
path: root/libjulia
diff options
context:
space:
mode:
Diffstat (limited to 'libjulia')
-rw-r--r--libjulia/backends/evm/EVMCodeTransform.cpp14
-rw-r--r--libjulia/backends/evm/EVMCodeTransform.h1
2 files changed, 13 insertions, 2 deletions
diff --git a/libjulia/backends/evm/EVMCodeTransform.cpp b/libjulia/backends/evm/EVMCodeTransform.cpp
index e0b11cf3..66f593e8 100644
--- a/libjulia/backends/evm/EVMCodeTransform.cpp
+++ b/libjulia/backends/evm/EVMCodeTransform.cpp
@@ -60,9 +60,12 @@ void CodeTransform::operator()(VariableDeclaration const& _varDecl)
void CodeTransform::operator()(Assignment const& _assignment)
{
- visitExpression(*_assignment.value);
+ int height = m_assembly.stackHeight();
+ boost::apply_visitor(*this, *_assignment.value);
+ expectDeposit(_assignment.variableNames.size(), height);
+
m_assembly.setSourceLocation(_assignment.location);
- generateAssignment(_assignment.variableName);
+ generateMultiAssignment(_assignment.variableNames);
checkStackHeight(&_assignment);
}
@@ -469,6 +472,13 @@ void CodeTransform::finalizeBlock(Block const& _block, int blockStartStackHeight
checkStackHeight(&_block);
}
+void CodeTransform::generateMultiAssignment(vector<Identifier> const& _variableNames)
+{
+ solAssert(m_scope, "");
+ for (auto const& variableName: _variableNames | boost::adaptors::reversed)
+ generateAssignment(variableName);
+}
+
void CodeTransform::generateAssignment(Identifier const& _variableName)
{
solAssert(m_scope, "");
diff --git a/libjulia/backends/evm/EVMCodeTransform.h b/libjulia/backends/evm/EVMCodeTransform.h
index 2c0fd10c..951c8a50 100644
--- a/libjulia/backends/evm/EVMCodeTransform.h
+++ b/libjulia/backends/evm/EVMCodeTransform.h
@@ -124,6 +124,7 @@ private:
/// to @a _blackStartStackHeight.
void finalizeBlock(solidity::assembly::Block const& _block, int _blockStartStackHeight);
+ void generateMultiAssignment(std::vector<solidity::assembly::Identifier> const& _variableNames);
void generateAssignment(solidity::assembly::Identifier const& _variableName);
/// Determines the stack height difference to the given variables. Throws