aboutsummaryrefslogtreecommitdiffstats
path: root/AST.h
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-02-14 07:43:02 +0800
committerChristian <c@ethdev.com>2015-02-17 02:24:07 +0800
commit3e29ec2cb2075fc6734a0f350503c393fbeeb3d6 (patch)
tree21012d2ea633c1473d057daea4f3b4ff7e60a574 /AST.h
parent500cb69f12a1e048258b1ebb9fa5ea858433ffff (diff)
downloaddexon-solidity-3e29ec2cb2075fc6734a0f350503c393fbeeb3d6.tar.gz
dexon-solidity-3e29ec2cb2075fc6734a0f350503c393fbeeb3d6.tar.zst
dexon-solidity-3e29ec2cb2075fc6734a0f350503c393fbeeb3d6.zip
"external" visibility specifier.
Diffstat (limited to 'AST.h')
-rw-r--r--AST.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/AST.h b/AST.h
index 51d8031a..c40e24d1 100644
--- a/AST.h
+++ b/AST.h
@@ -133,7 +133,8 @@ class Declaration: public ASTNode
{
public:
enum class LValueType { None, Local, Storage };
- enum class Visibility { Default, Public, Protected, Private };
+ /// Visibility ordered from restricted to unrestricted.
+ enum class Visibility { Default, Private, Protected, Public, External };
Declaration(Location const& _location, ASTPointer<ASTString> const& _name,
Visibility _visibility = Visibility::Default):
@@ -142,7 +143,9 @@ public:
/// @returns the declared name.
ASTString const& getName() const { return *m_name; }
Visibility getVisibility() const { return m_visibility == Visibility::Default ? getDefaultVisibility() : m_visibility; }
- bool isPublic() const { return getVisibility() == Visibility::Public; }
+ bool isPublic() const { return getVisibility() >= Visibility::Public; }
+ bool isVisibleInContract() const { return getVisibility() != Visibility::External; }
+ bool isVisibleInDerivedContracts() const { return isVisibleInContract() && getVisibility() >= Visibility::Protected; }
/// @returns the scope this declaration resides in. Can be nullptr if it is the global scope.
/// Available only after name and type resolution step.