mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix shadowing error for inline assembly.
This commit is contained in:
@@ -274,28 +274,8 @@ void ReferencesResolver::operator()(yul::Identifier const& _identifier)
|
||||
void ReferencesResolver::operator()(yul::VariableDeclaration const& _varDecl)
|
||||
{
|
||||
for (auto const& identifier: _varDecl.variables)
|
||||
{
|
||||
validateYulIdentifierName(identifier.name, identifier.debugData->location);
|
||||
|
||||
|
||||
if (
|
||||
auto declarations = m_resolver.nameFromCurrentScope(identifier.name.str());
|
||||
!declarations.empty()
|
||||
)
|
||||
{
|
||||
SecondarySourceLocation ssl;
|
||||
for (auto const* decl: declarations)
|
||||
ssl.append("The shadowed declaration is here:", decl->location());
|
||||
if (!ssl.infos.empty())
|
||||
m_errorReporter.declarationError(
|
||||
3859_error,
|
||||
identifier.debugData->location,
|
||||
ssl,
|
||||
"This declaration shadows a declaration outside the inline assembly block."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (_varDecl.value)
|
||||
visit(*_varDecl.value);
|
||||
}
|
||||
@@ -385,4 +365,20 @@ void ReferencesResolver::validateYulIdentifierName(yul::YulString _name, SourceL
|
||||
_location,
|
||||
"The identifier name \"" + _name.str() + "\" is reserved."
|
||||
);
|
||||
|
||||
auto declarations = m_resolver.nameFromCurrentScope(_name.str());
|
||||
if (!declarations.empty())
|
||||
{
|
||||
SecondarySourceLocation ssl;
|
||||
for (auto const* decl: declarations)
|
||||
if (decl->location().hasText())
|
||||
ssl.append("The shadowed declaration is here:", decl->location());
|
||||
if (!ssl.infos.empty())
|
||||
m_errorReporter.declarationError(
|
||||
3859_error,
|
||||
_location,
|
||||
ssl,
|
||||
"This declaration shadows a declaration outside the inline assembly block."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user