aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/SyntaxChecker.cpp
diff options
context:
space:
mode:
authorRhett Aultman <rhett.aultman@meraki.net>2017-09-20 23:52:10 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-09-30 00:50:25 +0800
commite434437eb71e03483232a55aac8c53928fe63d38 (patch)
tree637552965700a6a3d350f2a2626a7d46ab5c3762 /libsolidity/analysis/SyntaxChecker.cpp
parent466cce58dffc66054e9df223f49a9219e6f5f4cd (diff)
downloaddexon-solidity-e434437eb71e03483232a55aac8c53928fe63d38.tar.gz
dexon-solidity-e434437eb71e03483232a55aac8c53928fe63d38.tar.zst
dexon-solidity-e434437eb71e03483232a55aac8c53928fe63d38.zip
Unary + now a synax error (experimental 0.5.0)
The unary + was deprecated with a warning, but will be elevated to an error in 0.5.0. This adds the syntax error for the 0.5.0 pragma, and for a true 0.5.0 release we should consider removing the operator from the parser.
Diffstat (limited to 'libsolidity/analysis/SyntaxChecker.cpp')
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp
index 187eb26f..0ca4b86c 100644
--- a/libsolidity/analysis/SyntaxChecker.cpp
+++ b/libsolidity/analysis/SyntaxChecker.cpp
@@ -182,8 +182,15 @@ bool SyntaxChecker::visit(Throw const& _throwStatement)
bool SyntaxChecker::visit(UnaryOperation const& _operation)
{
+ bool const v050 = m_sourceUnit->annotation().experimentalFeatures.count(ExperimentalFeature::V050);
+
if (_operation.getOperator() == Token::Add)
- m_errorReporter.warning(_operation.location(), "Use of unary + is deprecated.");
+ {
+ if (v050)
+ m_errorReporter.syntaxError(_operation.location(), "Use of unary + is deprecated.");
+ else
+ m_errorReporter.warning(_operation.location(), "Use of unary + is deprecated.");
+ }
return true;
}