aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/SyntaxChecker.cpp
diff options
context:
space:
mode:
authorJimmy Vogel <jim.e.vogel@gmail.com>2018-01-23 05:32:47 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-02-13 06:37:26 +0800
commitdc5ad899d0ff08aba7022a765e8ec363fa6c1f7e (patch)
tree3beb33290f36e670817b9119ddb68e78b7cf6621 /libsolidity/analysis/SyntaxChecker.cpp
parent8795036919f7a9de4a0ba7d7333a955d2edb78fe (diff)
downloaddexon-solidity-dc5ad899d0ff08aba7022a765e8ec363fa6c1f7e.tar.gz
dexon-solidity-dc5ad899d0ff08aba7022a765e8ec363fa6c1f7e.tar.zst
dexon-solidity-dc5ad899d0ff08aba7022a765e8ec363fa6c1f7e.zip
Deprecate the var keyword (and mark it an error as experimental 0.5.0 feature)
Diffstat (limited to 'libsolidity/analysis/SyntaxChecker.cpp')
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp
index b6cc04da..5a3745b0 100644
--- a/libsolidity/analysis/SyntaxChecker.cpp
+++ b/libsolidity/analysis/SyntaxChecker.cpp
@@ -224,3 +224,17 @@ bool SyntaxChecker::visit(FunctionTypeName const& _node)
return true;
}
+
+bool SyntaxChecker::visit(VariableDeclaration const& _declaration)
+{
+ bool const v050 = m_sourceUnit->annotation().experimentalFeatures.count(ExperimentalFeature::V050);
+
+ if (!_declaration.typeName())
+ {
+ if (v050)
+ m_errorReporter.syntaxError(_declaration.location(), "Use of the \"var\" keyword is deprecated.");
+ else
+ m_errorReporter.warning(_declaration.location(), "Use of the \"var\" keyword is deprecated.");
+ }
+ return true;
+}