Skip to content

Commit

Permalink
fix: identification of duplicate @returns (cppalliance#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdkrystian authored Jul 3, 2024
1 parent bb7d201 commit 057778c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/lib/AST/ParseJavadoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,22 +954,21 @@ visitBlockCommandComment(
case CommandTraits::KCI_returns:
case CommandTraits::KCI_result:
{
doc::Returns returns;
auto scope = enterScope(returns);
// Scope scope(returns, block_);
visitChildren(C->getParagraph());

auto itr = std::ranges::find_if(
jd_.getBlocks(),
[&](const std::unique_ptr<doc::Block> & b)
{
return b->kind != doc::Kind::returns;
return b->kind == doc::Kind::returns;
});
if (itr != jd_.getBlocks().end())
{
report::warn("{}: Duplicate @returns statement", C->getBeginLoc().printToString(sm_));
}

doc::Returns returns;
auto scope = enterScope(returns);
// Scope scope(returns, block_);
visitChildren(C->getParagraph());
jd_.emplace_back(std::move(returns));
return;
}
Expand Down

0 comments on commit 057778c

Please sign in to comment.