mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Pass readFileCallback to StandardCompiler in CLI
This commit is contained in:
parent
ed64c849f5
commit
4566b4b336
@ -616,47 +616,6 @@ Allowed options)",
|
|||||||
|
|
||||||
bool CommandLineInterface::processInput()
|
bool CommandLineInterface::processInput()
|
||||||
{
|
{
|
||||||
if (m_args.count(g_argAllowPaths))
|
|
||||||
{
|
|
||||||
vector<string> paths;
|
|
||||||
for (string const& path: boost::split(paths, m_args[g_argAllowPaths].as<string>(), boost::is_any_of(",")))
|
|
||||||
m_allowedDirectories.push_back(boost::filesystem::path(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_args.count(g_argStandardJSON))
|
|
||||||
{
|
|
||||||
string input;
|
|
||||||
while (!cin.eof())
|
|
||||||
{
|
|
||||||
string tmp;
|
|
||||||
getline(cin, tmp);
|
|
||||||
input.append(tmp + "\n");
|
|
||||||
}
|
|
||||||
StandardCompiler compiler;
|
|
||||||
cout << compiler.compile(input) << endl;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
readInputFilesAndConfigureRemappings();
|
|
||||||
|
|
||||||
if (m_args.count(g_argLibraries))
|
|
||||||
for (string const& library: m_args[g_argLibraries].as<vector<string>>())
|
|
||||||
if (!parseLibraryOption(library))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (m_args.count(g_argAssemble))
|
|
||||||
{
|
|
||||||
// switch to assembly mode
|
|
||||||
m_onlyAssemble = true;
|
|
||||||
return assemble();
|
|
||||||
}
|
|
||||||
if (m_args.count(g_argLink))
|
|
||||||
{
|
|
||||||
// switch to linker mode
|
|
||||||
m_onlyLink = true;
|
|
||||||
return link();
|
|
||||||
}
|
|
||||||
|
|
||||||
ReadFile::Callback fileReader = [this](string const& _path)
|
ReadFile::Callback fileReader = [this](string const& _path)
|
||||||
{
|
{
|
||||||
auto path = boost::filesystem::path(_path);
|
auto path = boost::filesystem::path(_path);
|
||||||
@ -688,6 +647,47 @@ bool CommandLineInterface::processInput()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (m_args.count(g_argAllowPaths))
|
||||||
|
{
|
||||||
|
vector<string> paths;
|
||||||
|
for (string const& path: boost::split(paths, m_args[g_argAllowPaths].as<string>(), boost::is_any_of(",")))
|
||||||
|
m_allowedDirectories.push_back(boost::filesystem::path(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_args.count(g_argStandardJSON))
|
||||||
|
{
|
||||||
|
string input;
|
||||||
|
while (!cin.eof())
|
||||||
|
{
|
||||||
|
string tmp;
|
||||||
|
getline(cin, tmp);
|
||||||
|
input.append(tmp + "\n");
|
||||||
|
}
|
||||||
|
StandardCompiler compiler(fileReader);
|
||||||
|
cout << compiler.compile(input) << endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
readInputFilesAndConfigureRemappings();
|
||||||
|
|
||||||
|
if (m_args.count(g_argLibraries))
|
||||||
|
for (string const& library: m_args[g_argLibraries].as<vector<string>>())
|
||||||
|
if (!parseLibraryOption(library))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (m_args.count(g_argAssemble))
|
||||||
|
{
|
||||||
|
// switch to assembly mode
|
||||||
|
m_onlyAssemble = true;
|
||||||
|
return assemble();
|
||||||
|
}
|
||||||
|
if (m_args.count(g_argLink))
|
||||||
|
{
|
||||||
|
// switch to linker mode
|
||||||
|
m_onlyLink = true;
|
||||||
|
return link();
|
||||||
|
}
|
||||||
|
|
||||||
m_compiler.reset(new CompilerStack(fileReader));
|
m_compiler.reset(new CompilerStack(fileReader));
|
||||||
auto scannerFromSourceName = [&](string const& _sourceName) -> solidity::Scanner const& { return m_compiler->scanner(_sourceName); };
|
auto scannerFromSourceName = [&](string const& _sourceName) -> solidity::Scanner const& { return m_compiler->scanner(_sourceName); };
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user