mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add reference to contract in FunctionDefinition annotation
This commit is contained in:
parent
20e227afb5
commit
5ff02c12e2
@ -570,6 +570,7 @@ bool DeclarationRegistrationHelper::visit(ContractDefinition& _contract)
|
||||
m_globalContext.setCurrentContract(_contract);
|
||||
m_scopes[nullptr]->registerDeclaration(*m_globalContext.currentThis(), nullptr, false, true);
|
||||
m_scopes[nullptr]->registerDeclaration(*m_globalContext.currentSuper(), nullptr, false, true);
|
||||
m_currentContract = &_contract;
|
||||
|
||||
registerDeclaration(_contract, true);
|
||||
_contract.annotation().canonicalName = currentCanonicalName();
|
||||
@ -578,6 +579,7 @@ bool DeclarationRegistrationHelper::visit(ContractDefinition& _contract)
|
||||
|
||||
void DeclarationRegistrationHelper::endVisit(ContractDefinition&)
|
||||
{
|
||||
m_currentContract = nullptr;
|
||||
closeCurrentScope();
|
||||
}
|
||||
|
||||
@ -615,6 +617,7 @@ bool DeclarationRegistrationHelper::visit(FunctionDefinition& _function)
|
||||
{
|
||||
registerDeclaration(_function, true);
|
||||
m_currentFunction = &_function;
|
||||
_function.annotation().contract = m_currentContract;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -204,6 +204,7 @@ private:
|
||||
std::map<ASTNode const*, std::shared_ptr<DeclarationContainer>>& m_scopes;
|
||||
ASTNode const* m_currentScope = nullptr;
|
||||
VariableScope* m_currentFunction = nullptr;
|
||||
ContractDefinition const* m_currentContract = nullptr;
|
||||
langutil::ErrorReporter& m_errorReporter;
|
||||
GlobalContext& m_globalContext;
|
||||
};
|
||||
|
@ -109,6 +109,8 @@ struct FunctionDefinitionAnnotation: ASTAnnotation, DocumentedAnnotation
|
||||
/// The function this function overrides, if any. This is always the closest
|
||||
/// in the linearized inheritance hierarchy.
|
||||
FunctionDefinition const* superFunction = nullptr;
|
||||
/// Reference to the contract this function is defined in
|
||||
ContractDefinition const* contract = nullptr;
|
||||
};
|
||||
|
||||
struct EventDefinitionAnnotation: ASTAnnotation, DocumentedAnnotation
|
||||
|
Loading…
Reference in New Issue
Block a user