aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast/AST.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-07-13 06:15:52 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-07-19 21:56:40 +0800
commit1b0ef0b785d195ca28aa756047da040b676f5fc9 (patch)
tree2b89a6c71387faedfcf9dd127f1dc1a938d73bfd /libsolidity/ast/AST.cpp
parent84f8e7a46712f7da46ac15d378f0de0491278363 (diff)
downloaddexon-solidity-1b0ef0b785d195ca28aa756047da040b676f5fc9.tar.gz
dexon-solidity-1b0ef0b785d195ca28aa756047da040b676f5fc9.tar.zst
dexon-solidity-1b0ef0b785d195ca28aa756047da040b676f5fc9.zip
Add sourceUnit() helper to Declaration
Diffstat (limited to 'libsolidity/ast/AST.cpp')
-rw-r--r--libsolidity/ast/AST.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp
index 724a908f..1e1e4839 100644
--- a/libsolidity/ast/AST.cpp
+++ b/libsolidity/ast/AST.cpp
@@ -84,13 +84,18 @@ SourceUnitAnnotation& SourceUnit::annotation() const
return dynamic_cast<SourceUnitAnnotation&>(*m_annotation);
}
-string Declaration::sourceUnitName() const
+SourceUnit const& Declaration::sourceUnit() const
{
solAssert(!!m_scope, "");
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;
+ return dynamic_cast<SourceUnit const&>(*scope);
+}
+
+string Declaration::sourceUnitName() const
+{
+ return sourceUnit().annotation().path;
}
ImportAnnotation& ImportDirective::annotation() const