From 869659802058a5f68b4d2af2e7559da3d9c55141 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 20 Oct 2014 16:28:24 +0200 Subject: Access modifier cleanup. --- AST.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'AST.h') diff --git a/AST.h b/AST.h index 319fc058..0f015ab3 100644 --- a/AST.h +++ b/AST.h @@ -58,6 +58,7 @@ public: } Location const& getLocation() const { return m_location; } + private: Location m_location; }; @@ -69,6 +70,7 @@ public: : ASTNode(_location), m_name(_name) {} const ASTString& getName() const { return *m_name; } + private: ASTPointer m_name; }; @@ -92,6 +94,7 @@ public: std::vector> const& getDefinedStructs() { return m_definedStructs; } std::vector> const& getStateVariables() { return m_stateVariables; } std::vector> const& getDefinedFunctions() { return m_definedFunctions; } + private: std::vector> m_definedStructs; std::vector> m_stateVariables; @@ -122,6 +125,7 @@ public: virtual void accept(ASTVisitor& _visitor) override; std::vector> const& getParameters() { return m_parameters; } + private: std::vector> m_parameters; }; @@ -145,6 +149,7 @@ public: ParameterList& getParameterList() { return *m_parameters; } ASTPointer const& getReturnParameterList() const { return m_returnParameters; } Block& getBody() { return *m_body; } + private: bool m_isPublic; ASTPointer m_parameters; @@ -168,6 +173,7 @@ public: //! declared and there is no assignment to the variable that fixes the type. std::shared_ptr const& getType() const { return m_type; } void setType(std::shared_ptr const& _type) { m_type = _type; } + private: ASTPointer m_typeName; ///< can be empty ("var") @@ -196,6 +202,7 @@ public: virtual std::shared_ptr toType() override { return Type::fromElementaryTypeName(m_type); } Token::Value getType() const { return m_type; } + private: Token::Value m_type; }; @@ -211,6 +218,7 @@ public: const ASTString& getName() const { return *m_name; } void setReferencedStruct(StructDefinition& _referencedStruct) { m_referencedStruct = &_referencedStruct; } StructDefinition const* getReferencedStruct() const { return m_referencedStruct; } + private: ASTPointer m_name; @@ -225,6 +233,7 @@ public: : TypeName(_location), m_keyType(_keyType), m_valueType(_valueType) {} virtual void accept(ASTVisitor& _visitor) override; virtual std::shared_ptr toType() override { return Type::fromMapping(*this); } + private: ASTPointer m_keyType; ASTPointer m_valueType; @@ -245,6 +254,7 @@ public: //! For expressions, this also returns the inferred type of the expression. For other //! statements, returns the empty pointer. virtual void checkTypeRequirements() = 0; + protected: //! Check that the inferred type for _expression is _expectedType or at least implicitly //! convertible to _expectedType. If not, throw exception. @@ -259,6 +269,7 @@ public: virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; + private: std::vector> m_statements; }; @@ -272,6 +283,7 @@ public: m_trueBody(_trueBody), m_falseBody(_falseBody) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; + private: ASTPointer m_condition; ASTPointer m_trueBody; @@ -293,6 +305,7 @@ public: : BreakableStatement(_location), m_condition(_condition), m_body(_body) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; + private: ASTPointer m_condition; ASTPointer m_body; @@ -323,6 +336,7 @@ public: virtual void checkTypeRequirements() override; void setFunctionReturnParameters(ParameterList& _parameters) { m_returnParameters = &_parameters; } + private: ASTPointer m_expression; //< value to return, optional @@ -348,6 +362,7 @@ class Expression: public Statement public: Expression(Location const& _location): Statement(_location) {} std::shared_ptr const& getType() const { return m_type; } + protected: //! Inferred type of the expression, only filled after a call to checkTypeRequirements(). std::shared_ptr m_type; @@ -369,6 +384,7 @@ public: virtual void checkTypeRequirements() override; Token::Value getAssignmentOperator() const { return m_assigmentOperator; } + private: ASTPointer m_leftHandSide; Token::Value m_assigmentOperator; @@ -387,6 +403,7 @@ public: Token::Value getOperator() const { return m_operator; } bool isPrefixOperation() const { return m_isPrefix; } + private: Token::Value m_operator; ASTPointer m_subExpression; @@ -403,6 +420,7 @@ public: virtual void checkTypeRequirements() override; Token::Value getOperator() const { return m_operator; } + private: ASTPointer m_left; Token::Value m_operator; @@ -420,6 +438,7 @@ public: : Expression(_location), m_expression(_expression), m_arguments(_arguments) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; + private: ASTPointer m_expression; std::vector> m_arguments; @@ -434,6 +453,7 @@ public: virtual void accept(ASTVisitor& _visitor) override; const ASTString& getMemberName() const { return *m_memberName; } virtual void checkTypeRequirements() override; + private: ASTPointer m_expression; ASTPointer m_memberName; @@ -447,6 +467,7 @@ public: : Expression(_location), m_base(_base), m_index(_index) {} virtual void accept(ASTVisitor& _visitor) override; virtual void checkTypeRequirements() override; + private: ASTPointer m_base; ASTPointer m_index; @@ -469,6 +490,7 @@ public: ASTString const& getName() const { return *m_name; } void setReferencedDeclaration(Declaration& _referencedDeclaration) { m_referencedDeclaration = &_referencedDeclaration; } Declaration* getReferencedDeclaration() { return m_referencedDeclaration; } + private: ASTPointer m_name; @@ -485,6 +507,7 @@ public: virtual void checkTypeRequirements() override; Token::Value getTypeToken() const { return m_typeToken; } + private: Token::Value m_typeToken; }; @@ -499,6 +522,7 @@ public: Token::Value getToken() const { return m_token; } ASTString const& getValue() const { return *m_value; } + private: Token::Value m_token; ASTPointer m_value; -- cgit