diff options
author | Jimmy Vogel <jim.e.vogel@gmail.com> | 2018-01-23 05:32:47 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-02-13 06:37:26 +0800 |
commit | dc5ad899d0ff08aba7022a765e8ec363fa6c1f7e (patch) | |
tree | 3beb33290f36e670817b9119ddb68e78b7cf6621 /libsolidity/analysis/SyntaxChecker.cpp | |
parent | 8795036919f7a9de4a0ba7d7333a955d2edb78fe (diff) | |
download | dexon-solidity-dc5ad899d0ff08aba7022a765e8ec363fa6c1f7e.tar dexon-solidity-dc5ad899d0ff08aba7022a765e8ec363fa6c1f7e.tar.gz dexon-solidity-dc5ad899d0ff08aba7022a765e8ec363fa6c1f7e.tar.bz2 dexon-solidity-dc5ad899d0ff08aba7022a765e8ec363fa6c1f7e.tar.lz dexon-solidity-dc5ad899d0ff08aba7022a765e8ec363fa6c1f7e.tar.xz 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.cpp | 14 |
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; +} |