Reject wildcard and multiple experimental pragmas

This commit is contained in:
Alex Beregszaszi 2017-08-04 23:28:28 +01:00
parent de9e758ef7
commit 690ed37fd4

View File

@ -77,12 +77,16 @@ 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))
@ -96,7 +100,6 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
}
}
}
}
else if (_pragma.literals()[0] == "solidity")
{
vector<Token::Value> tokens(_pragma.tokens().begin() + 1, _pragma.tokens().end());