mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Solidity function AST nodes get documentation attribute
This commit is contained in:
parent
c4a43c64c2
commit
6ddfebafae
20
AST.h
20
AST.h
@ -174,13 +174,17 @@ class FunctionDefinition: public Declaration
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FunctionDefinition(Location const& _location, ASTPointer<ASTString> const& _name, bool _isPublic,
|
FunctionDefinition(Location const& _location, ASTPointer<ASTString> const& _name, bool _isPublic,
|
||||||
ASTPointer<ParameterList> const& _parameters,
|
std::string const& _documentation,
|
||||||
bool _isDeclaredConst,
|
ASTPointer<ParameterList> const& _parameters,
|
||||||
ASTPointer<ParameterList> const& _returnParameters,
|
bool _isDeclaredConst,
|
||||||
ASTPointer<Block> const& _body):
|
ASTPointer<ParameterList> const& _returnParameters,
|
||||||
Declaration(_location, _name), m_isPublic(_isPublic), m_parameters(_parameters),
|
ASTPointer<Block> const& _body):
|
||||||
m_isDeclaredConst(_isDeclaredConst), m_returnParameters(_returnParameters),
|
Declaration(_location, _name), m_isPublic(_isPublic),
|
||||||
m_body(_body) {}
|
m_parameters(_parameters),
|
||||||
|
m_isDeclaredConst(_isDeclaredConst),
|
||||||
|
m_returnParameters(_returnParameters),
|
||||||
|
m_body(_body),
|
||||||
|
m_documentation(_documentation) {}
|
||||||
virtual void accept(ASTVisitor& _visitor) override;
|
virtual void accept(ASTVisitor& _visitor) override;
|
||||||
|
|
||||||
bool isPublic() const { return m_isPublic; }
|
bool isPublic() const { return m_isPublic; }
|
||||||
@ -190,6 +194,7 @@ public:
|
|||||||
std::vector<ASTPointer<VariableDeclaration>> const& getReturnParameters() const { return m_returnParameters->getParameters(); }
|
std::vector<ASTPointer<VariableDeclaration>> const& getReturnParameters() const { return m_returnParameters->getParameters(); }
|
||||||
ASTPointer<ParameterList> const& getReturnParameterList() const { return m_returnParameters; }
|
ASTPointer<ParameterList> const& getReturnParameterList() const { return m_returnParameters; }
|
||||||
Block& getBody() { return *m_body; }
|
Block& getBody() { return *m_body; }
|
||||||
|
std::string& getDocumentation() { return m_documentation; }
|
||||||
|
|
||||||
void addLocalVariable(VariableDeclaration const& _localVariable) { m_localVariables.push_back(&_localVariable); }
|
void addLocalVariable(VariableDeclaration const& _localVariable) { m_localVariables.push_back(&_localVariable); }
|
||||||
std::vector<VariableDeclaration const*> const& getLocalVariables() const { return m_localVariables; }
|
std::vector<VariableDeclaration const*> const& getLocalVariables() const { return m_localVariables; }
|
||||||
@ -203,6 +208,7 @@ private:
|
|||||||
bool m_isDeclaredConst;
|
bool m_isDeclaredConst;
|
||||||
ASTPointer<ParameterList> m_returnParameters;
|
ASTPointer<ParameterList> m_returnParameters;
|
||||||
ASTPointer<Block> m_body;
|
ASTPointer<Block> m_body;
|
||||||
|
std::string m_documentation;
|
||||||
|
|
||||||
std::vector<VariableDeclaration const*> m_localVariables;
|
std::vector<VariableDeclaration const*> m_localVariables;
|
||||||
};
|
};
|
||||||
|
@ -142,8 +142,9 @@ ASTPointer<FunctionDefinition> Parser::parseFunctionDefinition(bool _isPublic)
|
|||||||
}
|
}
|
||||||
ASTPointer<Block> block = parseBlock();
|
ASTPointer<Block> block = parseBlock();
|
||||||
nodeFactory.setEndPositionFromNode(block);
|
nodeFactory.setEndPositionFromNode(block);
|
||||||
return nodeFactory.createNode<FunctionDefinition>(name, _isPublic, parameters,
|
return nodeFactory.createNode<FunctionDefinition>(name, _isPublic, m_scanner->getCurrentCommentLiteral(),
|
||||||
isDeclaredConst, returnParameters, block);
|
parameters,
|
||||||
|
isDeclaredConst, returnParameters, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASTPointer<StructDefinition> Parser::parseStructDefinition()
|
ASTPointer<StructDefinition> Parser::parseStructDefinition()
|
||||||
|
Loading…
Reference in New Issue
Block a user