aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-05 06:28:28 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-08-10 06:41:46 +0800
commit690ed37fd4b90119ac69def3e308035d46af0c60 (patch)
treeded5b34f84009cbbc6af30064c145c45857207a0 /libsolidity
parentde9e758ef7c0a2f60d526bb94c834a4e3c2a737a (diff)
downloaddexon-solidity-690ed37fd4b90119ac69def3e308035d46af0c60.tar
dexon-solidity-690ed37fd4b90119ac69def3e308035d46af0c60.tar.gz
dexon-solidity-690ed37fd4b90119ac69def3e308035d46af0c60.tar.bz2
dexon-solidity-690ed37fd4b90119ac69def3e308035d46af0c60.tar.lz
dexon-solidity-690ed37fd4b90119ac69def3e308035d46af0c60.tar.xz
dexon-solidity-690ed37fd4b90119ac69def3e308035d46af0c60.tar.zst
dexon-solidity-690ed37fd4b90119ac69def3e308035d46af0c60.zip
Reject wildcard and multiple experimental pragmas
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp
index 8c92f439..39f788c4 100644
--- a/libsolidity/analysis/SyntaxChecker.cpp
+++ b/libsolidity/analysis/SyntaxChecker.cpp
@@ -77,23 +77,26 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
if (literals.size() == 0)
m_errorReporter.syntaxError(
_pragma.location(),
- "At least one experimental feature or the wildcard symbol \"*\" is required."
+ "Experimental feature name is missing."
+ );
+ else if (literals.size() > 1)
+ m_errorReporter.syntaxError(
+ _pragma.location(),
+ "Stray arguments."
);
else
{
- for (string const literal: literals)
+ string const literal = literals[0];
+ 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
{
- 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
- {
- m_sourceUnit->annotation().experimentalFeatures.insert(literal);
- m_errorReporter.warning(_pragma.location(), "Experimental features are turned on. Do not use experimental features on live deployments.");
- }
+ m_sourceUnit->annotation().experimentalFeatures.insert(literal);
+ m_errorReporter.warning(_pragma.location(), "Experimental features are turned on. Do not use experimental features on live deployments.");
}
}
}