Skip to content

fix: handle constructor from reference to array #923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/lib/Metadata/Finalizers/Javadoc/Function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ isCopyOrMoveConstructorOrAssignment(FunctionInfo const& I)
auto const& paramRefType = get<RefType const&>(paramType);
auto const& paramRefPointee = paramRefType.PointeeType;
MRDOCS_CHECK_OR(paramRefPointee, false);
auto const& paramRefPointeeNamed = get<NamedTypeInfo const&>(paramRefPointee);
MRDOCS_CHECK_OR(paramRefPointeeNamed.Name, false);
auto const& paramName = paramRefPointeeNamed.Name;
auto const* paramRefPointeeNamed = get<NamedTypeInfo const*>(paramRefPointee);
if (!paramRefPointeeNamed)
Copy link
Collaborator

Choose a reason for hiding this comment

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

For reference, this could be MRDOCS_CHECK_OR(paramRefPointeeNamed, false).

MRDOCS_CHECK is that pattern people use with std::expected (like ? in Rust), so that code based on error types doesn't become impossible to read.

return false;
MRDOCS_CHECK_OR(paramRefPointeeNamed->Name, false);
auto const& paramName = paramRefPointeeNamed->Name;
MRDOCS_CHECK_OR(paramName, false);
auto const& paramRefPointeeNamedName = paramName->Name;
MRDOCS_CHECK_OR(!paramRefPointeeNamedName.empty(), false);
Expand Down
Loading