Type#GetLoadDependencies(): VERIFY() that no nullptr is returned#10155
Merged
Type#GetLoadDependencies(): VERIFY() that no nullptr is returned#10155
Conversation
yhabteab
reviewed
Sep 18, 2024
66bb803 to
6a11cf1
Compare
yhabteab
reviewed
Sep 18, 2024
If a specific type shall return no deps, the base method already does that.
3a77ff8 to
d298508
Compare
d298508 to
c24713a
Compare
yhabteab
reviewed
Sep 19, 2024
Comment on lines
+386
to
+387
| for (auto& dep : klass.LoadDependencies) | ||
| m_Impl << "\t\tauto type" << dep << " (GetByName(\"" << dep << "\").get());" << std::endl; |
Member
There was a problem hiding this comment.
That's much better, but why are you using two different loops for declaring and verifying them? Can't you just combine them like that?
Suggested change
| for (auto& dep : klass.LoadDependencies) | |
| m_Impl << "\t\tauto type" << dep << " (GetByName(\"" << dep << "\").get());" << std::endl; | |
| for (auto& dep : klass.LoadDependencies) { | |
| m_Impl << "\t\tauto type" << dep << " (GetByName(\"" << dep << "\").get());" << std::endl; | |
| m_Impl << "\t\tVERIFY(type" << dep << ");" << std::endl; | |
| } | |
| m_Impl << std::endl << "\t\treturn std::unordered_set<Type*>{"; |
Member
Author
There was a problem hiding this comment.
But I prefer this:
const std::unordered_set<Type*>& TypeImpl<Service>::GetLoadDependencies() const
{
static const auto deps ([] {
auto typeApiListener (GetByName("ApiListener").get());
auto typeEndpoint (GetByName("Endpoint").get());
auto typeHost (GetByName("Host").get());
auto typeZone (GetByName("Zone").get());
VERIFY(typeApiListener);
VERIFY(typeEndpoint);
VERIFY(typeHost);
VERIFY(typeZone);
return std::unordered_set{ typeApiListener, typeEndpoint, typeHost, typeZone, };
}());
return deps;
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.