aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorAlexander Arlt <alexander.arlt@arlt-labs.com>2018-03-07 02:26:49 +0800
committerAlexander Arlt <alexander.arlt@arlt-labs.com>2018-08-09 03:53:35 +0800
commitf76d4d59197db344613de18d1bfcead34a5e42ba (patch)
treeea3d504c5fd8b165ce9b3a690e18df54eb5b8dde /libsolidity/analysis
parentd634d20b5b0dac3e5caf1741073fa123fdd56ab9 (diff)
downloaddexon-solidity-f76d4d59197db344613de18d1bfcead34a5e42ba.tar.gz
dexon-solidity-f76d4d59197db344613de18d1bfcead34a5e42ba.tar.zst
dexon-solidity-f76d4d59197db344613de18d1bfcead34a5e42ba.zip
Fix: natspec annotations on constructors
- natspec annotations on constructore where ignored.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/DocStringAnalyser.cpp34
-rw-r--r--libsolidity/analysis/DocStringAnalyser.h11
2 files changed, 39 insertions, 6 deletions
diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp
index b3fb5258..c1b97def 100644
--- a/libsolidity/analysis/DocStringAnalyser.cpp
+++ b/libsolidity/analysis/DocStringAnalyser.cpp
@@ -48,7 +48,10 @@ bool DocStringAnalyser::visit(ContractDefinition const& _contract)
bool DocStringAnalyser::visit(FunctionDefinition const& _function)
{
- handleCallable(_function, _function, _function.annotation());
+ if (_function.isConstructor())
+ handleConstructor(_function, _function, _function.annotation());
+ else
+ handleCallable(_function, _function, _function.annotation());
return true;
}
@@ -66,15 +69,11 @@ bool DocStringAnalyser::visit(EventDefinition const& _event)
return true;
}
-void DocStringAnalyser::handleCallable(
+void DocStringAnalyser::checkParameters(
CallableDeclaration const& _callable,
- Documented const& _node,
DocumentedAnnotation& _annotation
)
{
- static const set<string> validTags = set<string>{"author", "dev", "notice", "return", "param"};
- parseDocStrings(_node, _annotation, validTags, "functions");
-
set<string> validParams;
for (auto const& p: _callable.parameters())
validParams.insert(p->name());
@@ -89,6 +88,29 @@ void DocStringAnalyser::handleCallable(
i->second.paramName +
"\" not found in the parameter list of the function."
);
+
+}
+
+void DocStringAnalyser::handleConstructor(
+ CallableDeclaration const& _callable,
+ Documented const& _node,
+ DocumentedAnnotation& _annotation
+)
+{
+ static const set<string> validTags = set<string>{"author", "dev", "notice", "param"};
+ parseDocStrings(_node, _annotation, validTags, "constructor");
+ checkParameters(_callable, _annotation);
+}
+
+void DocStringAnalyser::handleCallable(
+ CallableDeclaration const& _callable,
+ Documented const& _node,
+ DocumentedAnnotation& _annotation
+)
+{
+ static const set<string> validTags = set<string>{"author", "dev", "notice", "return", "param"};
+ parseDocStrings(_node, _annotation, validTags, "functions");
+ checkParameters(_callable, _annotation);
}
void DocStringAnalyser::parseDocStrings(
diff --git a/libsolidity/analysis/DocStringAnalyser.h b/libsolidity/analysis/DocStringAnalyser.h
index 158b4060..5d339428 100644
--- a/libsolidity/analysis/DocStringAnalyser.h
+++ b/libsolidity/analysis/DocStringAnalyser.h
@@ -48,6 +48,17 @@ private:
virtual bool visit(ModifierDefinition const& _modifier) override;
virtual bool visit(EventDefinition const& _event) override;
+ void checkParameters(
+ CallableDeclaration const& _callable,
+ DocumentedAnnotation& _annotation
+ );
+
+ void handleConstructor(
+ CallableDeclaration const& _callable,
+ Documented const& _node,
+ DocumentedAnnotation& _annotation
+ );
+
void handleCallable(
CallableDeclaration const& _callable,
Documented const& _node,