Solidity natspec docstring test improvements

- Adding a test for docstring being between function signature and
  function body

- Properly checking for exceptions in parsing

- Small parser fix
This commit is contained in:
Lefteris Karapetsas 2014-11-28 11:17:18 +01:00
parent e3e90c4e6b
commit db7b118ece
2 changed files with 2 additions and 3 deletions

View File

@ -118,12 +118,12 @@ ASTPointer<FunctionDefinition> Parser::parseFunctionDefinition(bool _isPublic)
{
ASTNodeFactory nodeFactory(*this);
ASTPointer<ASTString> docstring;
expectToken(Token::FUNCTION);
if (m_scanner->getCurrentCommentLiteral() != "")
{
docstring = std::make_shared<ASTString>(m_scanner->getCurrentCommentLiteral());
m_scanner->clearCurrentCommentLiteral();
}
expectToken(Token::FUNCTION);
ASTPointer<ASTString> name(expectIdentifierToken());
ASTPointer<ParameterList> parameters(parseParameterList());
bool isDeclaredConst = false;

View File

@ -109,8 +109,7 @@ public:
class LiteralScope
{
public:
explicit LiteralScope(Scanner* _self, enum LiteralType _type)
: m_type(_type)
explicit LiteralScope(Scanner* _self, enum LiteralType _type): m_type(_type)
, m_scanner(_self)
, m_complete(false)
{