aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-03-14 23:21:29 +0800
committerGitHub <noreply@github.com>2018-03-14 23:21:29 +0800
commitc3f07b5294893414fd8ed1a04972fe52426ec9a9 (patch)
treee31fd1166fc530a99dec0078ced80af8161c5103
parenta5d9b05acbcbfadeb4c956f70db6f24cf226ed46 (diff)
parent9d079fd1261e40339157bff6fd46de96ae844562 (diff)
downloaddexon-solidity-c3f07b5294893414fd8ed1a04972fe52426ec9a9.tar.gz
dexon-solidity-c3f07b5294893414fd8ed1a04972fe52426ec9a9.tar.zst
dexon-solidity-c3f07b5294893414fd8ed1a04972fe52426ec9a9.zip
Merge pull request #3730 from ethereum/docstringBug
DocStringParser: Fix error message for empty parameter description.
-rw-r--r--Changelog.md1
-rw-r--r--libsolidity/parsing/DocStringParser.cpp10
-rw-r--r--test/libsolidity/syntaxTests/docstring_empty_description.sol6
3 files changed, 10 insertions, 7 deletions
diff --git a/Changelog.md b/Changelog.md
index 648af66c..a0ad6242 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -6,6 +6,7 @@ Bugfixes:
* Code Generator: Properly skip unneeded storgae array cleanup when not reducing length.
* Commandline interface: Support ``--evm-version constantinople`` properly.
* Standard JSON: Support ``constantinople`` as ``evmVersion`` properly.
+ * DocString Parser: Fix error message for empty descriptions.
### 0.4.21 (2018-03-07)
diff --git a/libsolidity/parsing/DocStringParser.cpp b/libsolidity/parsing/DocStringParser.cpp
index 0409de72..d058d556 100644
--- a/libsolidity/parsing/DocStringParser.cpp
+++ b/libsolidity/parsing/DocStringParser.cpp
@@ -119,21 +119,17 @@ DocStringParser::iter DocStringParser::parseDocTagParam(iter _pos, iter _end)
return _end;
}
auto nameEndPos = firstSpaceOrTab(nameStartPos, _end);
- if (nameEndPos == _end)
- {
- appendError("End of param name not found: " + string(nameStartPos, _end));
- return _end;
- }
auto paramName = string(nameStartPos, nameEndPos);
auto descStartPos = skipWhitespace(nameEndPos, _end);
- if (descStartPos == _end)
+ auto nlPos = find(descStartPos, _end, '\n');
+
+ if (descStartPos == nlPos)
{
appendError("No description given for param " + paramName);
return _end;
}
- auto nlPos = find(descStartPos, _end, '\n');
auto paramDesc = string(descStartPos, nlPos);
newTag("param");
m_lastTag->paramName = paramName;
diff --git a/test/libsolidity/syntaxTests/docstring_empty_description.sol b/test/libsolidity/syntaxTests/docstring_empty_description.sol
new file mode 100644
index 00000000..0caa1b23
--- /dev/null
+++ b/test/libsolidity/syntaxTests/docstring_empty_description.sol
@@ -0,0 +1,6 @@
+contract C {
+ /// @param id
+ function vote(uint id) public;
+}
+// ----
+// DocstringParsingError: No description given for param id