aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-02-13 15:40:41 +0800
committerGitHub <noreply@github.com>2018-02-13 15:40:41 +0800
commit729c6a95f8615586969e206b0b796011b3824adf (patch)
treeaa1589d686284c102e654aa177da8242f2050eb2 /libsolidity
parenta75d4ec60e0512197caa8a21996c45850d99091f (diff)
parent573aa01fd2a208a119a77fe75129d76a59392abc (diff)
downloaddexon-solidity-729c6a95f8615586969e206b0b796011b3824adf.tar
dexon-solidity-729c6a95f8615586969e206b0b796011b3824adf.tar.gz
dexon-solidity-729c6a95f8615586969e206b0b796011b3824adf.tar.bz2
dexon-solidity-729c6a95f8615586969e206b0b796011b3824adf.tar.lz
dexon-solidity-729c6a95f8615586969e206b0b796011b3824adf.tar.xz
dexon-solidity-729c6a95f8615586969e206b0b796011b3824adf.tar.zst
dexon-solidity-729c6a95f8615586969e206b0b796011b3824adf.zip
Merge pull request #3425 from jevogel/3301
Deprecate the var keyword in SyntaxChecker
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp14
-rw-r--r--libsolidity/analysis/SyntaxChecker.h2
2 files changed, 16 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;
+}
diff --git a/libsolidity/analysis/SyntaxChecker.h b/libsolidity/analysis/SyntaxChecker.h
index d5d72f14..871bf0a9 100644
--- a/libsolidity/analysis/SyntaxChecker.h
+++ b/libsolidity/analysis/SyntaxChecker.h
@@ -69,6 +69,8 @@ private:
virtual bool visit(FunctionDefinition const& _function) override;
virtual bool visit(FunctionTypeName const& _node) override;
+ virtual bool visit(VariableDeclaration const& _declaration) override;
+
ErrorReporter& m_errorReporter;
/// Flag that indicates whether a function modifier actually contains '_'.