mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Move all references to scope into annotation
This commit is contained in:
parent
69fd185903
commit
6679f92c8a
@ -639,7 +639,7 @@ void DeclarationRegistrationHelper::endVisit(FunctionDefinition&)
|
|||||||
|
|
||||||
bool DeclarationRegistrationHelper::visit(TryCatchClause& _tryCatchClause)
|
bool DeclarationRegistrationHelper::visit(TryCatchClause& _tryCatchClause)
|
||||||
{
|
{
|
||||||
_tryCatchClause.setScope(m_currentScope);
|
_tryCatchClause.annotation().scope = m_currentScope;
|
||||||
enterNewSubScope(_tryCatchClause);
|
enterNewSubScope(_tryCatchClause);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -675,7 +675,7 @@ void DeclarationRegistrationHelper::endVisit(FunctionTypeName&)
|
|||||||
|
|
||||||
bool DeclarationRegistrationHelper::visit(Block& _block)
|
bool DeclarationRegistrationHelper::visit(Block& _block)
|
||||||
{
|
{
|
||||||
_block.setScope(m_currentScope);
|
_block.annotation().scope = m_currentScope;
|
||||||
enterNewSubScope(_block);
|
enterNewSubScope(_block);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -687,7 +687,7 @@ void DeclarationRegistrationHelper::endVisit(Block&)
|
|||||||
|
|
||||||
bool DeclarationRegistrationHelper::visit(ForStatement& _for)
|
bool DeclarationRegistrationHelper::visit(ForStatement& _for)
|
||||||
{
|
{
|
||||||
_for.setScope(m_currentScope);
|
_for.annotation().scope = m_currentScope;
|
||||||
enterNewSubScope(_for);
|
enterNewSubScope(_for);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -761,7 +761,7 @@ void DeclarationRegistrationHelper::registerDeclaration(Declaration& _declaratio
|
|||||||
|
|
||||||
registerDeclaration(*m_scopes[m_currentScope], _declaration, nullptr, nullptr, warnAboutShadowing, inactive, m_errorReporter);
|
registerDeclaration(*m_scopes[m_currentScope], _declaration, nullptr, nullptr, warnAboutShadowing, inactive, m_errorReporter);
|
||||||
|
|
||||||
_declaration.setScope(m_currentScope);
|
_declaration.annotation().scope = m_currentScope;
|
||||||
if (_opensScope)
|
if (_opensScope)
|
||||||
enterNewSubScope(_declaration);
|
enterNewSubScope(_declaration);
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,7 @@ public:
|
|||||||
virtual ~Scopable() = default;
|
virtual ~Scopable() = default;
|
||||||
/// @returns the scope this declaration resides in. Can be nullptr if it is the global scope.
|
/// @returns the scope this declaration resides in. Can be nullptr if it is the global scope.
|
||||||
/// Available only after name and type resolution step.
|
/// Available only after name and type resolution step.
|
||||||
ASTNode const* scope() const { return m_scope; }
|
ASTNode const* scope() const { return annotation().scope; }
|
||||||
void setScope(ASTNode const* _scope) { m_scope = _scope; }
|
|
||||||
|
|
||||||
/// @returns the source unit this scopable is present in.
|
/// @returns the source unit this scopable is present in.
|
||||||
SourceUnit const& sourceUnit() const;
|
SourceUnit const& sourceUnit() const;
|
||||||
@ -172,8 +171,7 @@ public:
|
|||||||
/// Can be combined with annotation().canonicalName (if present) to form a globally unique name.
|
/// Can be combined with annotation().canonicalName (if present) to form a globally unique name.
|
||||||
std::string sourceUnitName() const;
|
std::string sourceUnitName() const;
|
||||||
|
|
||||||
protected:
|
virtual ScopableAnnotation& annotation() const = 0;
|
||||||
ASTNode const* m_scope = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user