Merge pull request #1087 from chriseth/sol_changeProtectedToInheritable

Rename "protected" to "inheritable".
This commit is contained in:
Gav Wood 2015-02-18 14:10:08 +01:00
commit a2f5ea88b8
4 changed files with 9 additions and 9 deletions

6
AST.h
View File

@ -133,7 +133,7 @@ class Declaration: public ASTNode
{ {
public: public:
/// Visibility ordered from restricted to unrestricted. /// Visibility ordered from restricted to unrestricted.
enum class Visibility { Default, Private, Protected, Public, External }; enum class Visibility { Default, Private, Inheritable, Public, External };
Declaration(Location const& _location, ASTPointer<ASTString> const& _name, Declaration(Location const& _location, ASTPointer<ASTString> const& _name,
Visibility _visibility = Visibility::Default): Visibility _visibility = Visibility::Default):
@ -144,7 +144,7 @@ public:
Visibility getVisibility() const { return m_visibility == Visibility::Default ? getDefaultVisibility() : m_visibility; } 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 isVisibleInContract() const { return getVisibility() != Visibility::External; }
bool isVisibleInDerivedContracts() const { return isVisibleInContract() && getVisibility() >= Visibility::Protected; } bool isVisibleInDerivedContracts() const { return isVisibleInContract() && getVisibility() >= Visibility::Inheritable; }
/// @returns the scope this declaration resides in. Can be nullptr if it is the global scope. /// @returns the scope this declaration resides in. Can be nullptr if it is the global scope.
/// Available only after name and type resolution step. /// Available only after name and type resolution step.
@ -453,7 +453,7 @@ public:
bool isIndexed() const { return m_isIndexed; } bool isIndexed() const { return m_isIndexed; }
protected: protected:
Visibility getDefaultVisibility() const override { return Visibility::Protected; } Visibility getDefaultVisibility() const override { return Visibility::Inheritable; }
private: private:
ASTPointer<TypeName> m_typeName; ///< can be empty ("var") ASTPointer<TypeName> m_typeName; ///< can be empty ("var")

View File

@ -186,8 +186,8 @@ Declaration::Visibility Parser::parseVisibilitySpecifier(Token::Value _token)
Declaration::Visibility visibility(Declaration::Visibility::Default); Declaration::Visibility visibility(Declaration::Visibility::Default);
if (_token == Token::Public) if (_token == Token::Public)
visibility = Declaration::Visibility::Public; visibility = Declaration::Visibility::Public;
else if (_token == Token::Protected) else if (_token == Token::Inheritable)
visibility = Declaration::Visibility::Protected; visibility = Declaration::Visibility::Inheritable;
else if (_token == Token::Private) else if (_token == Token::Private)
visibility = Declaration::Visibility::Private; visibility = Declaration::Visibility::Private;
else if (_token == Token::External) else if (_token == Token::External)

View File

@ -162,7 +162,7 @@ namespace solidity
K(New, "new", 0) \ K(New, "new", 0) \
K(Public, "public", 0) \ K(Public, "public", 0) \
K(Private, "private", 0) \ K(Private, "private", 0) \
K(Protected, "protected", 0) \ K(Inheritable, "inheritable", 0) \
K(Return, "return", 0) \ K(Return, "return", 0) \
K(Returns, "returns", 0) \ K(Returns, "returns", 0) \
K(Struct, "struct", 0) \ K(Struct, "struct", 0) \
@ -380,7 +380,7 @@ public:
static bool isCountOp(Value op) { return op == Inc || op == Dec; } static bool isCountOp(Value op) { return op == Inc || op == Dec; }
static bool isShiftOp(Value op) { return (SHL <= op) && (op <= SHR); } static bool isShiftOp(Value op) { return (SHL <= op) && (op <= SHR); }
static bool isVisibilitySpecifier(Value op) { return isVariableVisibilitySpecifier(op) || op == External; } static bool isVisibilitySpecifier(Value op) { return isVariableVisibilitySpecifier(op) || op == External; }
static bool isVariableVisibilitySpecifier(Value op) { return op == Public || op == Private || op == Protected; } static bool isVariableVisibilitySpecifier(Value op) { return op == Public || op == Private || op == Inheritable; }
static bool isEtherSubdenomination(Value op) { return op == SubWei || op == SubSzabo || op == SubFinney || op == Token::SubEther; } static bool isEtherSubdenomination(Value op) { return op == SubWei || op == SubSzabo || op == SubFinney || op == Token::SubEther; }
// Returns a string corresponding to the JS token string // Returns a string corresponding to the JS token string

View File

@ -6,10 +6,10 @@ ContractPart = StateVariableDeclaration | StructDefinition | ModifierDefinition
InheritanceSpecifier = Identifier ( '(' Expression ( ',' Expression )* ')' )? InheritanceSpecifier = Identifier ( '(' Expression ( ',' Expression )* ')' )?
StructDefinition = 'struct' Identifier '{' StructDefinition = 'struct' Identifier '{'
( VariableDeclaration (';' VariableDeclaration)* )? '} ( VariableDeclaration (';' VariableDeclaration)* )? '}
StateVariableDeclaration = TypeName ( 'public' | 'protected' | 'private' )? Identifier ';' StateVariableDeclaration = TypeName ( 'public' | 'inheritable' | 'private' )? Identifier ';'
ModifierDefinition = 'modifier' Identifier ParameterList? Block ModifierDefinition = 'modifier' Identifier ParameterList? Block
FunctionDefinition = 'function' Identifier ParameterList FunctionDefinition = 'function' Identifier ParameterList
( Identifier | 'constant' | 'public' | 'protected' | 'private' )* ( Identifier | 'constant' | 'external' | 'public' | 'inheritable' | 'private' )*
( 'returns' ParameterList )? Block ( 'returns' ParameterList )? Block
EnumValue = Identifier EnumValue = Identifier