From a921bd0ae4afbd6eb55d65beb832546971a65dd4 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 13 Jun 2017 20:03:32 +0100 Subject: [PATCH] Display user friendly instruction name --- libsolidity/inlineasm/AsmAnalysis.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libsolidity/inlineasm/AsmAnalysis.cpp b/libsolidity/inlineasm/AsmAnalysis.cpp index a3d38cc9a..630e0abf8 100644 --- a/libsolidity/inlineasm/AsmAnalysis.cpp +++ b/libsolidity/inlineasm/AsmAnalysis.cpp @@ -447,18 +447,25 @@ void AsmAnalyzer::expectValidType(string const& type, SourceLocation const& _loc void AsmAnalyzer::warnOnFutureInstruction(solidity::Instruction _instr, SourceLocation const& _location) { + string instr; switch (_instr) { case solidity::Instruction::CREATE2: + instr = "create2"; + break; case solidity::Instruction::RETURNDATASIZE: + instr = "returndatasize"; + break; case solidity::Instruction::RETURNDATACOPY: - m_errorReporter.warning( - _location, - "The \"" + _instr + "\" instruction is only available after " + - "the Metropolis hard fork. Before that it acts as an invalid instruction." - ); + instr = "returndatacopy"; break; default: break; } + if (!instr.empty()) + m_errorReporter.warning( + _location, + "The \"" + instr + "\" instruction is only available after " + + "the Metropolis hard fork. Before that it acts as an invalid instruction." + ); }