aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/SyntaxChecker.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-10-05 17:58:25 +0800
committerchriseth <c@ethdev.com>2016-10-25 19:45:50 +0800
commit762f7ac2508d119d1d1b66002c5498663a8d482f (patch)
tree6371ca861d6de7717d1bf6070df87ccb4d6c3d0a /libsolidity/analysis/SyntaxChecker.cpp
parent2f7c847ce40fe6726d270a2997b380177ab6e03e (diff)
downloaddexon-solidity-762f7ac2508d119d1d1b66002c5498663a8d482f.tar.gz
dexon-solidity-762f7ac2508d119d1d1b66002c5498663a8d482f.tar.zst
dexon-solidity-762f7ac2508d119d1d1b66002c5498663a8d482f.zip
Suggest correct version for pragma and complain about pre-release version.
Diffstat (limited to 'libsolidity/analysis/SyntaxChecker.cpp')
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp
index dc8c1806..dbaa15ed 100644
--- a/libsolidity/analysis/SyntaxChecker.cpp
+++ b/libsolidity/analysis/SyntaxChecker.cpp
@@ -52,13 +52,22 @@ void SyntaxChecker::endVisit(SourceUnit const& _sourceUnit)
{
if (!m_versionPragmaFound)
{
+ string errorString("Source file does not specify required compiler version!");
+ SemVerVersion recommendedVersion{string(VersionString)};
+ if (!recommendedVersion.isPrerelease())
+ errorString +=
+ "Consider adding \"pragma solidity ^" +
+ to_string(recommendedVersion.major()) +
+ string(".") +
+ to_string(recommendedVersion.minor()) +
+ string(".") +
+ to_string(recommendedVersion.patch());
+ string(";\"");
+
auto err = make_shared<Error>(Error::Type::Warning);
*err <<
errinfo_sourceLocation(_sourceUnit.location()) <<
- errinfo_comment(
- string("Source file does not specify required compiler version! ") +
- string("Consider adding \"pragma solidity ^") + VersionNumber + string(";\".")
- );
+ errinfo_comment(errorString);
m_errors.push_back(err);
}
}