aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-03 03:21:20 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-08-10 06:41:46 +0800
commitde9e758ef7c0a2f60d526bb94c834a4e3c2a737a (patch)
tree2e7fa15622bbac70fb14b647ad0437bc4f99121c /libsolidity
parente44da40835670e667eda0ca30467fa52328a9075 (diff)
downloaddexon-solidity-de9e758ef7c0a2f60d526bb94c834a4e3c2a737a.tar.gz
dexon-solidity-de9e758ef7c0a2f60d526bb94c834a4e3c2a737a.tar.zst
dexon-solidity-de9e758ef7c0a2f60d526bb94c834a4e3c2a737a.zip
Reject unsupported experimental feature names
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp
index db3e0a7a..8c92f439 100644
--- a/libsolidity/analysis/SyntaxChecker.cpp
+++ b/libsolidity/analysis/SyntaxChecker.cpp
@@ -69,6 +69,9 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
m_errorReporter.syntaxError(_pragma.location(), "Invalid pragma \"" + _pragma.literals()[0] + "\"");
else if (_pragma.literals()[0] == "experimental")
{
+ /// TODO: fill this out
+ static const set<string> validFeatures = set<string>{};
+
solAssert(m_sourceUnit, "");
vector<string> literals(_pragma.literals().begin() + 1, _pragma.literals().end());
if (literals.size() == 0)
@@ -82,6 +85,8 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
{
if (literal.empty())
m_errorReporter.syntaxError(_pragma.location(), "Empty experimental feature name is invalid.");
+ else if (!validFeatures.count(literal))
+ m_errorReporter.syntaxError(_pragma.location(), "Unsupported experimental feature name.");
else if (m_sourceUnit->annotation().experimentalFeatures.count(literal))
m_errorReporter.syntaxError(_pragma.location(), "Duplicate experimental feature name.");
else