aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorVoR0220 <rj@erisindustries.com>2017-01-12 00:56:35 +0800
committerVoR0220 <rj@erisindustries.com>2017-01-12 01:03:02 +0800
commit4585bfdce7716cd4837f71b565bb9a6dff8c2d7e (patch)
treea7928231161ce0e103495584362951a43155b34a /libsolidity
parente96c32a072160428a93720a21c51cd8670d5e664 (diff)
downloaddexon-solidity-4585bfdce7716cd4837f71b565bb9a6dff8c2d7e.tar
dexon-solidity-4585bfdce7716cd4837f71b565bb9a6dff8c2d7e.tar.gz
dexon-solidity-4585bfdce7716cd4837f71b565bb9a6dff8c2d7e.tar.bz2
dexon-solidity-4585bfdce7716cd4837f71b565bb9a6dff8c2d7e.tar.lz
dexon-solidity-4585bfdce7716cd4837f71b565bb9a6dff8c2d7e.tar.xz
dexon-solidity-4585bfdce7716cd4837f71b565bb9a6dff8c2d7e.tar.zst
dexon-solidity-4585bfdce7716cd4837f71b565bb9a6dff8c2d7e.zip
cleanup
Signed-off-by: VoR0220 <rj@erisindustries.com> fixup Signed-off-by: VoR0220 <rj@erisindustries.com>
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/interface/CompilerStack.cpp24
-rw-r--r--libsolidity/interface/CompilerStack.h5
2 files changed, 15 insertions, 14 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index 30abad07..1e571cae 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -510,28 +510,28 @@ string CompilerStack::applyRemapping(string const& _path, string const& _context
size_t longestPrefix = 0;
size_t longestContext = 0;
- string longestPrefixTarget;
+ string bestMatchTarget;
for (auto const& redir: m_remappings)
{
- string contextFileString = sanitizePath(redir.context);
- string prefixFileString = sanitizePath(redir.prefix);
- // Skip if there is a prefix collision and the current context is closer
- if (longestContext > 0 && contextFileString.length() < longestContext)
+ string context = sanitizePath(redir.context);
+ string prefix = sanitizePath(redir.prefix);
+ // Skip if current context is closer
+ if (context.length() < longestContext)
continue;
// Skip if redir.context is not a prefix of _context
- if (!isPrefixOf(contextFileString, _context))
+ if (!isPrefixOf(context, _context))
continue;
- // Skip if we already have a closer match.
- if (prefixFileString.length() < longestPrefix)
+ // Skip if we already have a closer prefix match.
+ if (prefix.length() < longestPrefix)
continue;
// Skip if the prefix does not match.
- if (!isPrefixOf(prefixFileString, _path))
+ if (!isPrefixOf(prefix, _path))
continue;
- longestContext = contextFileString.length();
- longestPrefix = prefixFileString.length();
- longestPrefixTarget = redir.target;
+ longestContext = context.length();
+ longestPrefix = prefix.length();
+ bestMatchTarget = redir.target;
}
string path = longestPrefixTarget;
diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h
index ef0aa6fe..d49a8df1 100644
--- a/libsolidity/interface/CompilerStack.h
+++ b/libsolidity/interface/CompilerStack.h
@@ -235,13 +235,14 @@ private:
bool checkLibraryNameClashes();
/// @returns the absolute path corresponding to @a _path relative to @a _reference.
std::string absolutePath(std::string const& _path, std::string const& _reference) const;
+ /// Helper function to return path converted strings.
+ std::string sanitizePath(std::string const& _path) const { return boost::filesystem::path(_path).generic_string(); }
+
/// Compile a single contract and put the result in @a _compiledContracts.
void compileContract(
ContractDefinition const& _contract,
std::map<ContractDefinition const*, eth::Assembly const*>& _compiledContracts
);
- /// Helper function to return path converted strings.
- std::string sanitizePath(std::string const& _path) { return boost::filesystem::path(_path).generic_string(); }
void link();
Contract const& contract(std::string const& _contractName = "") const;