aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/inlineasm
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-04-25 19:15:42 +0800
committerchriseth <chris@ethereum.org>2017-04-25 22:49:04 +0800
commit1d712c7d6490616846de4ec9569ca627e62ea2c1 (patch)
treef3036aaab6076f6248148db9be9f92aa540055ac /libsolidity/inlineasm
parente841b23bfd57607511d620ed34ef96188bbadec6 (diff)
downloaddexon-solidity-1d712c7d6490616846de4ec9569ca627e62ea2c1.tar.gz
dexon-solidity-1d712c7d6490616846de4ec9569ca627e62ea2c1.tar.zst
dexon-solidity-1d712c7d6490616846de4ec9569ca627e62ea2c1.zip
Fix storage access tests.
Diffstat (limited to 'libsolidity/inlineasm')
-rw-r--r--libsolidity/inlineasm/AsmAnalysis.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/libsolidity/inlineasm/AsmAnalysis.cpp b/libsolidity/inlineasm/AsmAnalysis.cpp
index 80cabe2e..97ec8b1f 100644
--- a/libsolidity/inlineasm/AsmAnalysis.cpp
+++ b/libsolidity/inlineasm/AsmAnalysis.cpp
@@ -79,6 +79,7 @@ bool AsmAnalyzer::operator()(assembly::Literal const& _literal)
bool AsmAnalyzer::operator()(assembly::Identifier const& _identifier)
{
+ size_t numErrorsBefore = m_errors.size();
bool success = true;
if (m_currentScope->lookup(_identifier.name, Scope::Visitor(
[&](Scope::Variable const& _var)
@@ -117,11 +118,13 @@ bool AsmAnalyzer::operator()(assembly::Identifier const& _identifier)
stackSize = m_resolver(_identifier, IdentifierContext::RValue);
if (stackSize == size_t(-1))
{
- m_errors.push_back(make_shared<Error>(
- Error::Type::DeclarationError,
- "Identifier not found.",
- _identifier.location
- ));
+ // Only add an error message if the callback did not do it.
+ if (numErrorsBefore == m_errors.size())
+ m_errors.push_back(make_shared<Error>(
+ Error::Type::DeclarationError,
+ "Identifier not found.",
+ _identifier.location
+ ));
success = false;
}
m_stackHeight += stackSize == size_t(-1) ? 1 : stackSize;
@@ -292,6 +295,7 @@ bool AsmAnalyzer::operator()(Block const& _block)
bool AsmAnalyzer::checkAssignment(assembly::Identifier const& _variable, size_t _valueSize)
{
bool success = true;
+ size_t numErrorsBefore = m_errors.size();
size_t variableSize(-1);
if (Scope::Identifier const* var = m_currentScope->lookup(_variable.name))
{
@@ -320,11 +324,13 @@ bool AsmAnalyzer::checkAssignment(assembly::Identifier const& _variable, size_t
variableSize = m_resolver(_variable, IdentifierContext::LValue);
if (variableSize == size_t(-1))
{
- m_errors.push_back(make_shared<Error>(
- Error::Type::DeclarationError,
- "Variable not found or variable not lvalue.",
- _variable.location
- ));
+ // Only add message if the callback did not.
+ if (numErrorsBefore == m_errors.size())
+ m_errors.push_back(make_shared<Error>(
+ Error::Type::DeclarationError,
+ "Variable not found or variable not lvalue.",
+ _variable.location
+ ));
success = false;
}
if (_valueSize == size_t(-1))