diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-05-20 00:06:26 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-09-20 17:16:23 +0800 |
commit | 3b813ed29569dde02b965c97c9fdd60469876f66 (patch) | |
tree | 20a5ea09ab0bc99d48acabb0e567affb6c381ca4 /libsolidity/inlineasm/AsmAnalysis.cpp | |
parent | c0b3e5b0785efd1b601cff470d3e3d4a71b2c283 (diff) | |
download | dexon-solidity-3b813ed29569dde02b965c97c9fdd60469876f66.tar dexon-solidity-3b813ed29569dde02b965c97c9fdd60469876f66.tar.gz dexon-solidity-3b813ed29569dde02b965c97c9fdd60469876f66.tar.bz2 dexon-solidity-3b813ed29569dde02b965c97c9fdd60469876f66.tar.lz dexon-solidity-3b813ed29569dde02b965c97c9fdd60469876f66.tar.xz dexon-solidity-3b813ed29569dde02b965c97c9fdd60469876f66.tar.zst dexon-solidity-3b813ed29569dde02b965c97c9fdd60469876f66.zip |
Support multiple assignment in inline assembly
Diffstat (limited to 'libsolidity/inlineasm/AsmAnalysis.cpp')
-rw-r--r-- | libsolidity/inlineasm/AsmAnalysis.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/libsolidity/inlineasm/AsmAnalysis.cpp b/libsolidity/inlineasm/AsmAnalysis.cpp index 76b0bbd5..e5bdc90f 100644 --- a/libsolidity/inlineasm/AsmAnalysis.cpp +++ b/libsolidity/inlineasm/AsmAnalysis.cpp @@ -163,11 +163,25 @@ bool AsmAnalyzer::operator()(assembly::StackAssignment const& _assignment) bool AsmAnalyzer::operator()(assembly::Assignment const& _assignment) { + int const expectedItems = _assignment.variableNames.size(); + solAssert(expectedItems >= 1, ""); int const stackHeight = m_stackHeight; bool success = boost::apply_visitor(*this, *_assignment.value); - solAssert(m_stackHeight >= stackHeight, "Negative value size."); - if (!checkAssignment(_assignment.variableName, m_stackHeight - stackHeight)) - success = false; + if ((m_stackHeight - stackHeight) != expectedItems) + { + m_errorReporter.declarationError( + _assignment.location, + "Variable count does not match number of values (" + + to_string(expectedItems) + + " vs. " + + to_string(m_stackHeight - stackHeight) + + ")" + ); + return false; + } + for (auto const& variableName: _assignment.variableNames) + if (!checkAssignment(variableName, 1)) + success = false; m_info.stackHeightInfo[&_assignment] = m_stackHeight; return success; } |