From 6231916ddc5e5a51ef4fbeafc324c8607b4d4ff4 Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Fri, 9 Jun 2017 15:44:21 +0200 Subject: [PATCH] Generalize the warning --- libsolidity/analysis/NameAndTypeResolver.cpp | 21 +++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index 7e2a05b49183..7165cac21f86 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -26,6 +26,8 @@ #include #include +#include + using namespace std; namespace dev @@ -234,14 +236,19 @@ vector NameAndTypeResolver::cleanedDeclarations( void NameAndTypeResolver::warnVariablesNamedLikeInstructions(void) { - auto declarations = nameFromCurrentScope("returndatasize"); - for (Declaration const* const declaration : declarations) + for (auto const& instruction : c_instructions) { - solAssert(!!declaration, ""); - m_errorReporter.warning( - declaration->location(), - "Variable is shadowed in an inline assembly by an insturction of the same name" - ); + string instructionName{instruction.first}; // needs to copy because making it lower case. + boost::algorithm::to_lower(instructionName); + auto declarations = nameFromCurrentScope(instructionName); + for (Declaration const* const declaration : declarations) + { + solAssert(!!declaration, ""); + m_errorReporter.warning( + declaration->location(), + "Variable is shadowed in an inline assembly by an insturction of the same name" + ); + } } }