CommandLineInterface: Disallow --output-dir, --gas and --combined-json in assembly mode

This commit is contained in:
Kamil Śliwak 2020-05-30 00:32:35 +02:00
parent 0d7b3ae503
commit 4bd078ed7e
5 changed files with 22 additions and 10 deletions

View File

@ -1190,6 +1190,22 @@ bool CommandLineInterface::processInput()
if (m_args.count(g_argAssemble) || m_args.count(g_argStrictAssembly) || m_args.count(g_argYul))
{
vector<string> const nonAssemblyModeOptions = {
// TODO: The list is not complete. Add more.
g_argOutputDir,
g_argGas,
g_argCombinedJson,
g_strOptimizeYul,
g_strNoOptimizeYul,
};
if (countEnabledOptions(nonAssemblyModeOptions) >= 1)
{
serr() << "The following options are invalid in assembly mode: ";
serr() << joinOptionNames(nonAssemblyModeOptions) << ". ";
serr() << "Optimization is disabled by default and can be enabled with --" << g_argOptimize << "." << endl;
return false;
}
// switch to assembly mode
m_onlyAssemble = true;
using Input = yul::AssemblyStack::Language;
@ -1197,16 +1213,6 @@ bool CommandLineInterface::processInput()
Input inputLanguage = m_args.count(g_argYul) ? Input::Yul : (m_args.count(g_argStrictAssembly) ? Input::StrictAssembly : Input::Assembly);
Machine targetMachine = Machine::EVM;
bool optimize = m_args.count(g_argOptimize);
if (m_args.count(g_strOptimizeYul))
{
serr() << "--" << g_strOptimizeYul << " is invalid in assembly mode. Use --" << g_argOptimize << " instead." << endl;
return false;
}
if (m_args.count(g_strNoOptimizeYul))
{
serr() << "--" << g_strNoOptimizeYul << " is invalid in assembly mode. Optimization is disabled by default and can be enabled with --" << g_argOptimize << "." << endl;
return false;
}
optional<string> yulOptimiserSteps;
if (m_args.count(g_strYulOptimizations))

View File

@ -0,0 +1 @@
--strict-assembly --output-dir /tmp/

View File

@ -0,0 +1 @@
The following options are invalid in assembly mode: --output-dir, --gas, --combined-json, --optimize-yul, --no-optimize-yul. Optimization is disabled by default and can be enabled with --optimize.

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,3 @@
{
sstore(0, 1)
}