mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
CommandLineInterface: Merge processInput() and actOnInput()
- The distinction between them is not as clear-cut as it should be. For example processInput() prints output in assembly mode.
This commit is contained in:
@@ -610,10 +610,10 @@ bool CommandLineInterface::processInput()
|
||||
return false;
|
||||
case InputMode::License:
|
||||
printLicense();
|
||||
return true;
|
||||
break;
|
||||
case InputMode::Version:
|
||||
printVersion();
|
||||
return true;
|
||||
break;
|
||||
case InputMode::StandardJson:
|
||||
{
|
||||
solAssert(m_standardJsonInput.has_value(), "");
|
||||
@@ -621,21 +621,25 @@ bool CommandLineInterface::processInput()
|
||||
StandardCompiler compiler(m_fileReader.reader(), m_options.formatting.json);
|
||||
sout() << compiler.compile(move(m_standardJsonInput.value())) << endl;
|
||||
m_standardJsonInput.reset();
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case InputMode::Assembler:
|
||||
{
|
||||
return assemble(m_options.assembly.inputLanguage, m_options.assembly.targetMachine);
|
||||
}
|
||||
if (!assemble(m_options.assembly.inputLanguage, m_options.assembly.targetMachine))
|
||||
return false;
|
||||
break;
|
||||
case InputMode::Linker:
|
||||
return link();
|
||||
if (!link())
|
||||
return false;
|
||||
writeLinkedFiles();
|
||||
break;
|
||||
case InputMode::Compiler:
|
||||
case InputMode::CompilerWithASTImport:
|
||||
return compile();
|
||||
if (!compile())
|
||||
return false;
|
||||
outputCompilationResults();
|
||||
}
|
||||
|
||||
solAssert(false, "");
|
||||
return false;
|
||||
return !m_outputFailed;
|
||||
}
|
||||
|
||||
void CommandLineInterface::printVersion()
|
||||
@@ -883,29 +887,6 @@ void CommandLineInterface::handleAst()
|
||||
}
|
||||
}
|
||||
|
||||
bool CommandLineInterface::actOnInput()
|
||||
{
|
||||
switch (m_options.input.mode)
|
||||
{
|
||||
case InputMode::Help:
|
||||
case InputMode::License:
|
||||
case InputMode::Version:
|
||||
case InputMode::StandardJson:
|
||||
case InputMode::Assembler:
|
||||
// Already done in "processInput" phase.
|
||||
break;
|
||||
case InputMode::Linker:
|
||||
writeLinkedFiles();
|
||||
break;
|
||||
case InputMode::Compiler:
|
||||
case InputMode::CompilerWithASTImport:
|
||||
outputCompilationResults();
|
||||
break;
|
||||
}
|
||||
|
||||
return !m_outputFailed;
|
||||
}
|
||||
|
||||
bool CommandLineInterface::link()
|
||||
{
|
||||
solAssert(m_options.input.mode == InputMode::Linker, "");
|
||||
|
||||
Reference in New Issue
Block a user