mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Revive --machine CLI argument.
This commit is contained in:
parent
206a2c183f
commit
619f978030
@ -61,6 +61,7 @@ static string const g_strLicense = "license";
|
|||||||
static string const g_strLibraries = "libraries";
|
static string const g_strLibraries = "libraries";
|
||||||
static string const g_strLink = "link";
|
static string const g_strLink = "link";
|
||||||
static string const g_strLSP = "lsp";
|
static string const g_strLSP = "lsp";
|
||||||
|
static string const g_strMachine = "machine";
|
||||||
static string const g_strNoCBORMetadata = "no-cbor-metadata";
|
static string const g_strNoCBORMetadata = "no-cbor-metadata";
|
||||||
static string const g_strMetadataHash = "metadata-hash";
|
static string const g_strMetadataHash = "metadata-hash";
|
||||||
static string const g_strMetadataLiteral = "metadata-literal";
|
static string const g_strMetadataLiteral = "metadata-literal";
|
||||||
@ -109,6 +110,12 @@ static string const g_strColor = "color";
|
|||||||
static string const g_strNoColor = "no-color";
|
static string const g_strNoColor = "no-color";
|
||||||
static string const g_strErrorIds = "error-codes";
|
static string const g_strErrorIds = "error-codes";
|
||||||
|
|
||||||
|
/// Possible arguments to for --machine
|
||||||
|
static set<string> const g_machineArgs
|
||||||
|
{
|
||||||
|
g_strEVM
|
||||||
|
};
|
||||||
|
|
||||||
/// Possible arguments to for --yul-dialect
|
/// Possible arguments to for --yul-dialect
|
||||||
static set<string> const g_yulDialectArgs
|
static set<string> const g_yulDialectArgs
|
||||||
{
|
{
|
||||||
@ -667,6 +674,11 @@ General Information)").c_str(),
|
|||||||
|
|
||||||
po::options_description assemblyModeOptions("Assembly Mode Options");
|
po::options_description assemblyModeOptions("Assembly Mode Options");
|
||||||
assemblyModeOptions.add_options()
|
assemblyModeOptions.add_options()
|
||||||
|
(
|
||||||
|
g_strMachine.c_str(),
|
||||||
|
po::value<string>()->value_name(util::joinHumanReadable(g_machineArgs, ",")),
|
||||||
|
"Target machine in assembly or Yul mode."
|
||||||
|
)
|
||||||
(
|
(
|
||||||
g_strYulDialect.c_str(),
|
g_strYulDialect.c_str(),
|
||||||
po::value<string>()->value_name(util::joinHumanReadable(g_yulDialectArgs, ",")),
|
po::value<string>()->value_name(util::joinHumanReadable(g_yulDialectArgs, ",")),
|
||||||
@ -1197,6 +1209,12 @@ void CommandLineParser::processArgs()
|
|||||||
using Input = yul::YulStack::Language;
|
using Input = yul::YulStack::Language;
|
||||||
m_options.assembly.inputLanguage = m_args.count(g_strYul) ? Input::Yul : (m_args.count(g_strStrictAssembly) ? Input::StrictAssembly : Input::Assembly);
|
m_options.assembly.inputLanguage = m_args.count(g_strYul) ? Input::Yul : (m_args.count(g_strStrictAssembly) ? Input::StrictAssembly : Input::Assembly);
|
||||||
|
|
||||||
|
if (m_args.count(g_strMachine))
|
||||||
|
{
|
||||||
|
string machine = m_args[g_strMachine].as<string>();
|
||||||
|
if (machine != g_strEVM)
|
||||||
|
solThrow(CommandLineValidationError, "Invalid option for --" + g_strMachine + ": " + machine);
|
||||||
|
}
|
||||||
if (m_args.count(g_strYulDialect))
|
if (m_args.count(g_strYulDialect))
|
||||||
{
|
{
|
||||||
string dialect = m_args[g_strYulDialect].as<string>();
|
string dialect = m_args[g_strYulDialect].as<string>();
|
||||||
@ -1212,10 +1230,10 @@ void CommandLineParser::processArgs()
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (countEnabledOptions({g_strYulDialect}) >= 1)
|
else if (countEnabledOptions({g_strYulDialect, g_strMachine}) >= 1)
|
||||||
solThrow(
|
solThrow(
|
||||||
CommandLineValidationError,
|
CommandLineValidationError,
|
||||||
"--" + g_strYulDialect + " is only valid in assembly mode."
|
"--" + g_strYulDialect + " and --" + g_strMachine + " are only valid in assembly mode."
|
||||||
);
|
);
|
||||||
|
|
||||||
if (m_args.count(g_strMetadataHash))
|
if (m_args.count(g_strMetadataHash))
|
||||||
|
@ -1 +1 @@
|
|||||||
--yul-dialect is only valid in assembly mode.
|
--yul-dialect and --machine are only valid in assembly mode.
|
||||||
|
Loading…
Reference in New Issue
Block a user