Deprecate the var keyword (and mark it an error as experimental 0.5.0 feature)

This commit is contained in:
Jimmy Vogel 2018-01-22 21:32:47 +00:00 committed by Alex Beregszaszi
parent 8795036919
commit dc5ad899d0
3 changed files with 17 additions and 0 deletions

View File

@ -9,6 +9,7 @@ Features:
* Inline Assembly: Support some restricted tokens (return, byte, address) as identifiers in Julia mode.
* SMT Checker: If-else branch conditions are taken into account in the SMT encoding of the program
variables.
* Syntax Checker: Deprecate the ``var`` keyword (and mark it an error as experimental 0.5.0 feature).
* Type Checker: Issue warning for using ``public`` visibility for interface functions.
Bugfixes:

View File

@ -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;
}

View File

@ -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 '_'.