diff --git a/liblangutil/SourceLocation.h b/liblangutil/SourceLocation.h index 66cef52fb..ea9958933 100644 --- a/liblangutil/SourceLocation.h +++ b/liblangutil/SourceLocation.h @@ -59,6 +59,13 @@ struct SourceLocation return start <= _other.start && _other.end <= end; } + bool containsOffset(int _pos) const + { + if (!hasText() || _pos < 0) + return false; + return start <= _pos && _pos < end; + } + bool intersects(SourceLocation const& _other) const { if (!hasText() || !_other.hasText() || !equalSources(_other)) diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index c229252a8..b7d5db805 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -246,7 +246,10 @@ public: /// @returns the declared name. ASTString const& name() const { return *m_name; } + + /// @returns the location of the declared name itself or empty location if not available or unknown. SourceLocation const& nameLocation() const noexcept { return m_nameLocation; } + bool noVisibilitySpecified() const { return m_visibility == Visibility::Default; } Visibility visibility() const { return m_visibility == Visibility::Default ? defaultVisibility() : m_visibility; } bool isPublic() const { return visibility() >= Visibility::Public; }