Use version string (including prerelease) for pragma matching.

This commit is contained in:
chriseth 2016-08-23 17:03:23 +02:00
parent 3c412ed2f6
commit d87450b9b2

View File

@ -75,12 +75,13 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
vector<string> literals(_pragma.literals().begin() + 1, _pragma.literals().end()); vector<string> literals(_pragma.literals().begin() + 1, _pragma.literals().end());
SemVerMatchExpressionParser parser(tokens, literals); SemVerMatchExpressionParser parser(tokens, literals);
auto matchExpression = parser.parse(); auto matchExpression = parser.parse();
SemVerVersion currentVersion{string(VersionNumber)}; SemVerVersion currentVersion{string(VersionString)};
if (!matchExpression.matches(currentVersion)) if (!matchExpression.matches(currentVersion))
syntaxError( syntaxError(
_pragma.location(), _pragma.location(),
"Source file requires different compiler version (current compiler is " + "Source file requires different compiler version (current compiler is " +
string(VersionNumber) + ")." string(VersionString) + " - note that nightly builds are considered to be "
"strictly less than the released version"
); );
m_versionPragmaFound = true; m_versionPragmaFound = true;
} }