mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Metadata stamp.
This commit is contained in:
@@ -63,6 +63,14 @@ SourceUnitAnnotation& SourceUnit::annotation() const
|
||||
return static_cast<SourceUnitAnnotation&>(*m_annotation);
|
||||
}
|
||||
|
||||
string Declaration::sourceUnitName() const
|
||||
{
|
||||
ASTNode const* scope = m_scope;
|
||||
while (dynamic_cast<Declaration const*>(scope) && dynamic_cast<Declaration const*>(scope)->m_scope)
|
||||
scope = dynamic_cast<Declaration const*>(scope)->m_scope;
|
||||
return dynamic_cast<SourceUnit const&>(*scope).annotation().path;
|
||||
}
|
||||
|
||||
ImportAnnotation& ImportDirective::annotation() const
|
||||
{
|
||||
if (!m_annotation)
|
||||
|
||||
@@ -158,6 +158,10 @@ public:
|
||||
ASTNode const* scope() const { return m_scope; }
|
||||
void setScope(ASTNode const* _scope) { m_scope = _scope; }
|
||||
|
||||
/// @returns the source name this declaration is present in.
|
||||
/// Can be combined with annotation().canonicalName to form a globally unique name.
|
||||
std::string sourceUnitName() const;
|
||||
|
||||
virtual bool isLValue() const { return false; }
|
||||
virtual bool isPartOfExternalInterface() const { return false; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user