Skip to content

[natspec] Introduce AST node for structured documentation - #7834

Merged
chriseth merged 3 commits into
developfrom
docstring-ast-node
Jan 30, 2020
Merged

[natspec] Introduce AST node for structured documentation#7834
chriseth merged 3 commits into
developfrom
docstring-ast-node

Conversation

@erak

@erak erak commented Nov 28, 2019

Copy link
Copy Markdown
Collaborator

Part of #7835.

The idea behind this PR is to introduce a new AST node which is added as a subnode for all AST nodes that can be documented using a formal specification, here NatSpec (contract, function, event and modifier definitions). For all other nodes the documentation is still a plain string.

Comment thread libsolidity/ast/AST_accept.h Outdated
Comment thread libsolidity/analysis/DocStringAnalyser.cpp Outdated
Comment thread libsolidity/ast/ASTJsonConverter.cpp Outdated
@erak
erak force-pushed the docstring-ast-node branch from 8b8f512 to eaf27b5 Compare November 28, 2019 15:20
@axic
axic changed the base branch from develop_060 to develop December 10, 2019 13:20
@erak
erak changed the base branch from develop to breaking December 18, 2019 15:48
@erak erak changed the title Introduce DocString AST node [natspec] Introduce DocString AST node Dec 18, 2019
@erak
erak force-pushed the docstring-ast-node branch from eaf27b5 to 5d6b554 Compare January 23, 2020 11:23
@erak
erak changed the base branch from breaking to develop January 23, 2020 11:23
Comment thread libsolidity/parsing/Parser.cpp Outdated
Comment thread test/libsolidity/ASTJSON/documentation.json Outdated
@erak
erak force-pushed the docstring-ast-node branch from 5d6b554 to 4f5ffba Compare January 25, 2020 16:56
Comment thread libsolidity/ast/AST.h Outdated
@erak
erak force-pushed the docstring-ast-node branch 2 times, most recently from f8f8511 to 0334aef Compare January 29, 2020 22:27
@erak erak changed the title [natspec] Introduce DocString AST node [natspec] Introduce AST node for formal documentation Jan 29, 2020
@erak
erak marked this pull request as ready for review January 29, 2020 22:33
Comment thread liblangutil/Scanner.cpp
Comment thread libsolidity/ast/ASTAnnotations.h
Comment thread libsolidity/ast/ASTJsonConverter.cpp Outdated
Comment thread libsolidity/ast/AST.h Outdated
Comment thread libsolidity/ast/ASTJsonImporter.cpp Outdated
Comment thread libsolidity/parsing/Parser.cpp Outdated
ASTPointer<FormalDocumentation> Parser::parseFormalDocumentation()
{
ASTNodeFactory nodeFactory{*this};
nodeFactory.setLocation(m_scanner->currentCommentLocation());

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the location is set manually, and therefore https://github.com/ethereum/solidity/pull/7834/files#r372670260 is needed.

Comment thread libsolidity/ast/ASTJsonConverter.cpp Outdated
Comment thread libsolidity/ast/AST_accept.h
Comment thread libsolidity/parsing/Parser.cpp Outdated
@erak
erak force-pushed the docstring-ast-node branch from 0334aef to c4f2f1d Compare January 30, 2020 16:21
@erak erak changed the title [natspec] Introduce AST node for formal documentation [natspec] Introduce AST node for structured documentation Jan 30, 2020
Comment thread libsolidity/ast/AST.h Outdated
@erak
erak force-pushed the docstring-ast-node branch from ed1b089 to 574b30d Compare January 30, 2020 16:35
Comment thread Changelog.md Outdated
Comment thread libsolidity/ast/AST.h Outdated
Comment thread libsolidity/ast/AST.h Outdated
Marenz
Marenz previously approved these changes Jan 30, 2020
Comment thread libsolidity/ast/Types.cpp
}

ASTPointer<ASTString> FunctionType::documentation() const
ASTPointer<StructuredDocumentation> FunctionType::documentation() const

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should maybe change this later so that it returns a plain pointer to StructuredDocumentation. I don't see why we should create a new shared_ptr below in the failure case.

@chriseth

Copy link
Copy Markdown
Contributor

Looks good apart from the small changes to the comments!

@chriseth
chriseth merged commit 2098dba into develop Jan 30, 2020
@chriseth
chriseth deleted the docstring-ast-node branch January 30, 2020 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants