aboutsummaryrefslogtreecommitdiffstats
path: root/solc/CommandLineInterface.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-11-30 23:08:09 +0800
committerGitHub <noreply@github.com>2017-11-30 23:08:09 +0800
commitc4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40 (patch)
tree27c068f6cd96513a9023e586c209eb9f01309171 /solc/CommandLineInterface.cpp
parent9cf6e910bd2b90d0c9415d9c257f85fe0c518de8 (diff)
parentd0af0c14841648365ad05ecc626e672a16df5b5c (diff)
downloaddexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.tar
dexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.tar.gz
dexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.tar.bz2
dexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.tar.lz
dexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.tar.xz
dexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.tar.zst
dexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.zip
Merge pull request #3261 from ethereum/develop
Merge develop into release for 0.4.19
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
);