aboutsummaryrefslogtreecommitdiffstats
path: root/solc/CommandLineInterface.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-08-13 19:37:04 +0800
committerGitHub <noreply@github.com>2018-08-13 19:37:04 +0800
commita2c754b3fed422b3d8027a5298624bcfed3744a5 (patch)
tree9306c07b3445117a318f14dcde5efd1bd7dcaf9d /solc/CommandLineInterface.cpp
parent43db88b8363d73ee2f5ffa094ff506414261bd11 (diff)
parenta7885e0b0a8808e9daa7cc3b86781997c614b8d3 (diff)
downloaddexon-solidity-a2c754b3fed422b3d8027a5298624bcfed3744a5.tar
dexon-solidity-a2c754b3fed422b3d8027a5298624bcfed3744a5.tar.gz
dexon-solidity-a2c754b3fed422b3d8027a5298624bcfed3744a5.tar.bz2
dexon-solidity-a2c754b3fed422b3d8027a5298624bcfed3744a5.tar.lz
dexon-solidity-a2c754b3fed422b3d8027a5298624bcfed3744a5.tar.xz
dexon-solidity-a2c754b3fed422b3d8027a5298624bcfed3744a5.tar.zst
dexon-solidity-a2c754b3fed422b3d8027a5298624bcfed3744a5.zip
Merge pull request #4793 from ethereum/emptyRemappings
Disallow remappings with empty prefix.
Diffstat (limited to 'solc/CommandLineInterface.cpp')
-rw-r--r--solc/CommandLineInterface.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index 429bd637..f7d1c748 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -392,7 +392,18 @@ bool CommandLineInterface::readInputFilesAndConfigureRemappings()
{
auto eq = find(path.begin(), path.end(), '=');
if (eq != path.end())
- path = string(eq + 1, path.end());
+ {
+ if (auto r = CompilerStack::parseRemapping(path))
+ {
+ m_remappings.emplace_back(std::move(*r));
+ path = string(eq + 1, path.end());
+ }
+ else
+ {
+ cerr << "Invalid remapping: \"" << path << "\"." << endl;
+ return false;
+ }
+ }
else if (path == "-")
addStdin = true;
else
@@ -808,7 +819,7 @@ bool CommandLineInterface::processInput()
if (m_args.count(g_argMetadataLiteral) > 0)
m_compiler->useMetadataLiteralSources(true);
if (m_args.count(g_argInputFile))
- m_compiler->setRemappings(m_args[g_argInputFile].as<vector<string>>());
+ m_compiler->setRemappings(m_remappings);
for (auto const& sourceCode: m_sourceCodes)
m_compiler->addSource(sourceCode.first, sourceCode.second);
if (m_args.count(g_argLibraries))