aboutsummaryrefslogtreecommitdiffstats
path: root/solc/CommandLineInterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'solc/CommandLineInterface.cpp')
-rw-r--r--solc/CommandLineInterface.cpp28
1 files changed, 8 insertions, 20 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index 1686dc2e..9e2cb77a 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -424,20 +424,13 @@ void CommandLineInterface::readInputFilesAndConfigureRemappings()
continue;
}
- m_sourceCodes[infile.string()] = dev::contentsString(infile.string());
+ m_sourceCodes[infile.string()] = dev::readFileAsString(infile.string());
path = boost::filesystem::canonical(infile).string();
}
m_allowedDirectories.push_back(boost::filesystem::path(path).remove_filename());
}
if (addStdin)
- {
- string s;
- while (!cin.eof())
- {
- getline(cin, s);
- m_sourceCodes[g_stdinFileName].append(s + '\n');
- }
- }
+ m_sourceCodes[g_stdinFileName] = dev::readStandardInput();
}
bool CommandLineInterface::parseLibraryOption(string const& _input)
@@ -447,7 +440,7 @@ bool CommandLineInterface::parseLibraryOption(string const& _input)
try
{
if (fs::is_regular_file(_input))
- data = contentsString(_input);
+ data = readFileAsString(_input);
}
catch (fs::filesystem_error const&)
{
@@ -698,7 +691,7 @@ bool CommandLineInterface::processInput()
return ReadCallback::Result{false, "Not a valid file."};
else
{
- auto contents = dev::contentsString(canonicalPath.string());
+ auto contents = dev::readFileAsString(canonicalPath.string());
m_sourceCodes[path.string()] = contents;
return ReadCallback::Result{true, contents};
}
@@ -731,13 +724,7 @@ bool CommandLineInterface::processInput()
if (m_args.count(g_argStandardJSON))
{
- string input;
- while (!cin.eof())
- {
- string tmp;
- getline(cin, tmp);
- input.append(tmp + "\n");
- }
+ string input = dev::readStandardInput();
StandardCompiler compiler(fileReader);
cout << compiler.compile(input) << endl;
return true;
@@ -951,9 +938,10 @@ void CommandLineInterface::handleAst(string const& _argStr)
for (auto const& sourceCode: m_sourceCodes)
asts.push_back(&m_compiler->ast(sourceCode.first));
map<ASTNode const*, eth::GasMeter::GasConsumption> gasCosts;
- if (m_compiler->runtimeAssemblyItems())
+ // FIXME: shouldn't this be done for every contract?
+ if (m_compiler->runtimeAssemblyItems(m_compiler->lastContractName()))
gasCosts = GasEstimator::breakToStatementLevel(
- GasEstimator::structuralEstimation(*m_compiler->runtimeAssemblyItems(), asts),
+ GasEstimator::structuralEstimation(*m_compiler->runtimeAssemblyItems(m_compiler->lastContractName()), asts),
asts
);