mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
libsolidity: Remove dead code wrt. VariableDeclaration::canHaveAutoType()
Closes #4667
This commit is contained in:
parent
d33e5683f5
commit
4c90ddf64a
@ -292,9 +292,17 @@ void ReferencesResolver::endVisit(VariableDeclaration const& _variable)
|
||||
if (_variable.annotation().type)
|
||||
return;
|
||||
|
||||
TypePointer type;
|
||||
if (_variable.typeName())
|
||||
if (!_variable.typeName())
|
||||
{
|
||||
// This can still happen in very unusual cases where a developer uses constructs, such as
|
||||
// `var a;`, however, such code will have generated errors already.
|
||||
// However, we cannot blindingly solAssert() for that here, as the TypeChecker (which is
|
||||
// invoking ReferencesResolver) is generating it, so the error is most likely(!) generated
|
||||
// after this step.
|
||||
return;
|
||||
}
|
||||
|
||||
TypePointer type;
|
||||
type = _variable.typeName()->annotation().type;
|
||||
using Location = VariableDeclaration::Location;
|
||||
Location varLoc = _variable.referenceLocation();
|
||||
@ -416,10 +424,6 @@ void ReferencesResolver::endVisit(VariableDeclaration const& _variable)
|
||||
typeError(_variable.location(), "Data location can only be given for array or struct types.");
|
||||
|
||||
_variable.annotation().type = type;
|
||||
}
|
||||
else if (!_variable.canHaveAutoType())
|
||||
typeError(_variable.location(), "Explicit type needed.");
|
||||
// otherwise we have a "var"-declaration whose type is resolved by the first assignment
|
||||
}
|
||||
|
||||
void ReferencesResolver::typeError(SourceLocation const& _location, string const& _description)
|
||||
|
@ -466,11 +466,6 @@ bool VariableDeclaration::isExternalCallableParameter() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VariableDeclaration::canHaveAutoType() const
|
||||
{
|
||||
return isLocalVariable() && !isCallableParameter();
|
||||
}
|
||||
|
||||
TypePointer VariableDeclaration::type() const
|
||||
{
|
||||
return annotation().type;
|
||||
|
@ -696,7 +696,6 @@ public:
|
||||
bool isExternalCallableParameter() const;
|
||||
/// @returns true if the type of the variable does not need to be specified, i.e. it is declared
|
||||
/// in the body of a function or modifier.
|
||||
bool canHaveAutoType() const;
|
||||
bool isStateVariable() const { return m_isStateVariable; }
|
||||
bool isIndexed() const { return m_isIndexed; }
|
||||
bool isConstant() const { return m_isConstant; }
|
||||
|
Loading…
Reference in New Issue
Block a user