aboutsummaryrefslogtreecommitdiffstats
path: root/solc
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-04-10 20:56:00 +0800
committerGitHub <noreply@github.com>2017-04-10 20:56:00 +0800
commit8cbe87b4089bfb19dafd0b700586eaeeda30e271 (patch)
tree4fe0a7d7e461844578091fd43575cb34297f53c8 /solc
parent9fe206505b3e864ccd8a2f4e288b9a5f31d1ff46 (diff)
parent623b8eb107a97861e3e7e0c13acee39c8d5f4075 (diff)
downloaddexon-solidity-8cbe87b4089bfb19dafd0b700586eaeeda30e271.tar
dexon-solidity-8cbe87b4089bfb19dafd0b700586eaeeda30e271.tar.gz
dexon-solidity-8cbe87b4089bfb19dafd0b700586eaeeda30e271.tar.bz2
dexon-solidity-8cbe87b4089bfb19dafd0b700586eaeeda30e271.tar.lz
dexon-solidity-8cbe87b4089bfb19dafd0b700586eaeeda30e271.tar.xz
dexon-solidity-8cbe87b4089bfb19dafd0b700586eaeeda30e271.tar.zst
dexon-solidity-8cbe87b4089bfb19dafd0b700586eaeeda30e271.zip
Merge pull request #2111 from ethereum/readfile
Pull out ReadFile from CompilerStack
Diffstat (limited to 'solc')
-rw-r--r--solc/CommandLineInterface.cpp10
-rw-r--r--solc/jsonCompiler.cpp4
2 files changed, 7 insertions, 7 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index 31f70272..f0b73152 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -630,11 +630,11 @@ bool CommandLineInterface::processInput()
return link();
}
- CompilerStack::ReadFileCallback fileReader = [this](string const& _path)
+ ReadFile::Callback fileReader = [this](string const& _path)
{
auto path = boost::filesystem::path(_path);
if (!boost::filesystem::exists(path))
- return CompilerStack::ReadFileResult{false, "File not found."};
+ return ReadFile::Result{false, "File not found."};
auto canonicalPath = boost::filesystem::canonical(path);
bool isAllowed = false;
for (auto const& allowedDir: m_allowedDirectories)
@@ -650,14 +650,14 @@ bool CommandLineInterface::processInput()
}
}
if (!isAllowed)
- return CompilerStack::ReadFileResult{false, "File outside of allowed directories."};
+ return ReadFile::Result{false, "File outside of allowed directories."};
else if (!boost::filesystem::is_regular_file(canonicalPath))
- return CompilerStack::ReadFileResult{false, "Not a valid file."};
+ return ReadFile::Result{false, "Not a valid file."};
else
{
auto contents = dev::contentsString(canonicalPath.string());
m_sourceCodes[path.string()] = contents;
- return CompilerStack::ReadFileResult{true, contents};
+ return ReadFile::Result{true, contents};
}
};
diff --git a/solc/jsonCompiler.cpp b/solc/jsonCompiler.cpp
index 45322117..74d6a901 100644
--- a/solc/jsonCompiler.cpp
+++ b/solc/jsonCompiler.cpp
@@ -130,7 +130,7 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback
{
Json::Value output(Json::objectValue);
Json::Value errors(Json::arrayValue);
- CompilerStack::ReadFileCallback readCallback;
+ ReadFile::Callback readCallback;
if (_readCallback)
{
readCallback = [=](string const& _path)
@@ -138,7 +138,7 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback
char* contents_c = nullptr;
char* error_c = nullptr;
_readCallback(_path.c_str(), &contents_c, &error_c);
- CompilerStack::ReadFileResult result;
+ ReadFile::Result result;
result.success = true;
if (!contents_c && !error_c)
{