diff options
author | chriseth <c@ethdev.com> | 2014-12-01 19:43:32 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2014-12-01 19:43:32 +0800 |
commit | 3fc2708d657525162567b663a07cf8cb5b1c59aa (patch) | |
tree | c55b76eaef68afea87f2318e1ddbf1bdfe1fee2d /AST.h | |
parent | 4b0d949df3cb006773aabaf34e638ab4639e7044 (diff) | |
parent | 4b845073105bc76793a72a092630fc3bc5077882 (diff) | |
download | dexon-solidity-3fc2708d657525162567b663a07cf8cb5b1c59aa.tar.gz dexon-solidity-3fc2708d657525162567b663a07cf8cb5b1c59aa.tar.zst dexon-solidity-3fc2708d657525162567b663a07cf8cb5b1c59aa.zip |
Merge pull request #545 from LefterisJP/sol_com_in_ast
Solidity function AST nodes get documentation attribute
Diffstat (limited to 'AST.h')
-rw-r--r-- | AST.h | 27 |
1 files changed, 19 insertions, 8 deletions
@@ -173,14 +173,21 @@ private: class FunctionDefinition: public Declaration { public: - FunctionDefinition(Location const& _location, ASTPointer<ASTString> const& _name, bool _isPublic, - ASTPointer<ParameterList> const& _parameters, - bool _isDeclaredConst, - ASTPointer<ParameterList> const& _returnParameters, - ASTPointer<Block> const& _body): - Declaration(_location, _name), m_isPublic(_isPublic), m_parameters(_parameters), - m_isDeclaredConst(_isDeclaredConst), m_returnParameters(_returnParameters), - m_body(_body) {} + FunctionDefinition(Location const& _location, ASTPointer<ASTString> const& _name, + bool _isPublic, + ASTPointer<ASTString> const& _documentation, + ASTPointer<ParameterList> const& _parameters, + bool _isDeclaredConst, + ASTPointer<ParameterList> const& _returnParameters, + ASTPointer<Block> const& _body): + Declaration(_location, _name), m_isPublic(_isPublic), + m_parameters(_parameters), + m_isDeclaredConst(_isDeclaredConst), + m_returnParameters(_returnParameters), + m_body(_body), + m_documentation(_documentation) + {} + virtual void accept(ASTVisitor& _visitor) override; bool isPublic() const { return m_isPublic; } @@ -190,6 +197,9 @@ public: std::vector<ASTPointer<VariableDeclaration>> const& getReturnParameters() const { return m_returnParameters->getParameters(); } ASTPointer<ParameterList> const& getReturnParameterList() const { return m_returnParameters; } Block& getBody() { return *m_body; } + /// @return A shared pointer of an ASTString. + /// Can contain a nullptr in which case indicates absence of documentation + ASTPointer<ASTString> const& getDocumentation() { return m_documentation; } void addLocalVariable(VariableDeclaration const& _localVariable) { m_localVariables.push_back(&_localVariable); } std::vector<VariableDeclaration const*> const& getLocalVariables() const { return m_localVariables; } @@ -203,6 +213,7 @@ private: bool m_isDeclaredConst; ASTPointer<ParameterList> m_returnParameters; ASTPointer<Block> m_body; + ASTPointer<ASTString> m_documentation; std::vector<VariableDeclaration const*> m_localVariables; }; |