aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-06-15 04:03:32 +0800
committerGitHub <noreply@github.com>2017-06-15 04:03:32 +0800
commit42b61171d981ceccd5f79af5508db92b4f2ad54b (patch)
tree8ab6ee34bb8f15fa40e2509a8eda06f3d867d761 /libsolidity
parentf008ddf83646f6002a61a123cc94ad195a35dce4 (diff)
parentc20cdd0a0574c350b5cde7b38e87321479cecab3 (diff)
downloaddexon-solidity-42b61171d981ceccd5f79af5508db92b4f2ad54b.tar.gz
dexon-solidity-42b61171d981ceccd5f79af5508db92b4f2ad54b.tar.zst
dexon-solidity-42b61171d981ceccd5f79af5508db92b4f2ad54b.zip
Merge pull request #2192 from winsvega/develop
add STATICCALL instruction
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/inlineasm/AsmAnalysis.cpp28
1 files changed, 11 insertions, 17 deletions
diff --git a/libsolidity/inlineasm/AsmAnalysis.cpp b/libsolidity/inlineasm/AsmAnalysis.cpp
index 630e0abf..1a529118 100644
--- a/libsolidity/inlineasm/AsmAnalysis.cpp
+++ b/libsolidity/inlineasm/AsmAnalysis.cpp
@@ -29,6 +29,7 @@
#include <libsolidity/interface/Utils.h>
#include <boost/range/adaptor/reversed.hpp>
+#include <boost/algorithm/string.hpp>
#include <memory>
#include <functional>
@@ -447,25 +448,18 @@ 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:
- instr = "returndatacopy";
- break;
- default:
- break;
- }
- if (!instr.empty())
+ static set<solidity::Instruction> futureInstructions{
+ solidity::Instruction::CREATE2,
+ solidity::Instruction::RETURNDATACOPY,
+ solidity::Instruction::RETURNDATASIZE,
+ solidity::Instruction::STATICCALL
+ };
+ if (futureInstructions.count(_instr))
m_errorReporter.warning(
_location,
- "The \"" + instr + "\" instruction is only available after " +
+ "The \"" +
+ boost::to_lower_copy(instructionInfo(_instr).name)
+ + "\" instruction is only available after " +
"the Metropolis hard fork. Before that it acts as an invalid instruction."
);
}