-
Notifications
You must be signed in to change notification settings - Fork 6.2k
[solc] Refactor valid input modes. #13577
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
Conversation
solc/CommandLineInterface.cpp
Outdated
if ( | ||
m_options.input.mode == InputMode::Help || | ||
m_options.input.mode == InputMode::License || | ||
m_options.input.mode == InputMode::Version | ||
) | ||
if (std::set<InputMode>{InputMode::Help, InputMode::License, InputMode::Version}.count(m_options.input.mode) == 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I think the previous version was much more readable even though it was less concise :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll get set::contains
when™ we upgrade to c++20 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have our own version in CommonData.h
.
But it would still look pretty much the same. Not a big deal, just pointing out that sometimes the stupid way to do it is cleaner :)
@@ -424,13 +434,9 @@ void CommandLineInterface::handleGasEstimation(string const& _contract) | |||
|
|||
void CommandLineInterface::readInputFiles() | |||
{ | |||
solAssert(!m_standardJsonInput.has_value(), ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious because I've seen it all over the place - is this equivalent to your altered version where you don't pass ""
? I.e. will this just terminate with an empty message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this is equivalent to an empty message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until quite recently you could not skip the message (#12019). And it's just a tiny detail, so I don't think it makes sense to spend time replacing it all everywhere. We just sometimes remove the empty messages when we clean up code.
199ed76
to
cd440fc
Compare
Refactors
solc/CommandLineInterface.cpp
to make #12834 more readable.