mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Blocks and for loops can be scopes.
This commit is contained in:
1 parent
5f20129e65
commit
e6d48bb72a
6 files changed
+78
-6
No files matched your search
+10
-2
@@ -415,6 +415,15 @@ bool VariableDeclaration::isLValue() const
|
||||
return !isExternalCallableParameter() && !m_isConstant;
|
||||
}
|
||||
|
||||
bool VariableDeclaration::isLocalVariable() const
|
||||
{
|
||||
auto s = scope();
|
||||
return
|
||||
dynamic_cast<CallableDeclaration const*>(s) ||
|
||||
dynamic_cast<Block const*>(s) ||
|
||||
dynamic_cast<ForStatement const*>(s);
|
||||
}
|
||||
|
||||
bool VariableDeclaration::isCallableParameter() const
|
||||
{
|
||||
auto const* callable = dynamic_cast<CallableDeclaration const*>(scope());
|
||||
@@ -460,8 +469,7 @@ bool VariableDeclaration::isExternalCallableParameter() const
|
||||
|
||||
bool VariableDeclaration::canHaveAutoType() const
|
||||
{
|
||||
auto const* callable = dynamic_cast<CallableDeclaration const*>(scope());
|
||||
return (!!callable && !isCallableParameter());
|
||||
return isLocalVariable() && !isCallableParameter();
|
||||
}
|
||||
|
||||
TypePointer VariableDeclaration::type() const
|
||||
|
||||
Reference in new issue
Block a user