Signed-off-by: VoR0220 <rj@erisindustries.com>

fixup

Signed-off-by: VoR0220 <rj@erisindustries.com>
This commit is contained in:
VoR0220 2017-01-11 10:56:35 -06:00
parent e96c32a072
commit 4585bfdce7
No known key found for this signature in database
GPG Key ID: D4AB109D9B5D6386
3 changed files with 16 additions and 16 deletions

View File

@ -1,8 +1,7 @@
### 0.4.8 (unreleased) ### 0.4.8 (unreleased)
BugFixes: BugFixes:
* Remappings: a=b would overwrite c:a=d. This has now been fixed to all modules except * Remappings: Prefer longer context over longer prefix.
c using b as their target, with c using d as the target.
* Type checker, code generator: enable access to events of base contracts' names. * Type checker, code generator: enable access to events of base contracts' names.
* Imports: ``import ".dir/a"`` is not a relative path. Relative paths begin with directory ``.`` or ``..``. * Imports: ``import ".dir/a"`` is not a relative path. Relative paths begin with directory ``.`` or ``..``.

View File

@ -510,28 +510,28 @@ string CompilerStack::applyRemapping(string const& _path, string const& _context
size_t longestPrefix = 0; size_t longestPrefix = 0;
size_t longestContext = 0; size_t longestContext = 0;
string longestPrefixTarget; string bestMatchTarget;
for (auto const& redir: m_remappings) for (auto const& redir: m_remappings)
{ {
string contextFileString = sanitizePath(redir.context); string context = sanitizePath(redir.context);
string prefixFileString = sanitizePath(redir.prefix); string prefix = sanitizePath(redir.prefix);
// Skip if there is a prefix collision and the current context is closer // Skip if current context is closer
if (longestContext > 0 && contextFileString.length() < longestContext) if (context.length() < longestContext)
continue; continue;
// Skip if redir.context is not a prefix of _context // Skip if redir.context is not a prefix of _context
if (!isPrefixOf(contextFileString, _context)) if (!isPrefixOf(context, _context))
continue; continue;
// Skip if we already have a closer match. // Skip if we already have a closer prefix match.
if (prefixFileString.length() < longestPrefix) if (prefix.length() < longestPrefix)
continue; continue;
// Skip if the prefix does not match. // Skip if the prefix does not match.
if (!isPrefixOf(prefixFileString, _path)) if (!isPrefixOf(prefix, _path))
continue; continue;
longestContext = contextFileString.length(); longestContext = context.length();
longestPrefix = prefixFileString.length(); longestPrefix = prefix.length();
longestPrefixTarget = redir.target; bestMatchTarget = redir.target;
} }
string path = longestPrefixTarget; string path = longestPrefixTarget;

View File

@ -235,13 +235,14 @@ private:
bool checkLibraryNameClashes(); bool checkLibraryNameClashes();
/// @returns the absolute path corresponding to @a _path relative to @a _reference. /// @returns the absolute path corresponding to @a _path relative to @a _reference.
std::string absolutePath(std::string const& _path, std::string const& _reference) const; 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. /// Compile a single contract and put the result in @a _compiledContracts.
void compileContract( void compileContract(
ContractDefinition const& _contract, ContractDefinition const& _contract,
std::map<ContractDefinition const*, eth::Assembly const*>& _compiledContracts 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(); void link();
Contract const& contract(std::string const& _contractName = "") const; Contract const& contract(std::string const& _contractName = "") const;