mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
fixed
Signed-off-by: VoR0220 <rj@erisindustries.com>
This commit is contained in:
parent
4542f459f1
commit
b6508ca992
@ -516,6 +516,7 @@ string CompilerStack::applyRemapping(string const& _path, string const& _context
|
|||||||
{
|
{
|
||||||
string context = sanitizePath(redir.context);
|
string context = sanitizePath(redir.context);
|
||||||
string prefix = sanitizePath(redir.prefix);
|
string prefix = sanitizePath(redir.prefix);
|
||||||
|
|
||||||
// Skip if current context is closer
|
// Skip if current context is closer
|
||||||
if (context.length() < longestContext)
|
if (context.length() < longestContext)
|
||||||
continue;
|
continue;
|
||||||
@ -531,9 +532,8 @@ string CompilerStack::applyRemapping(string const& _path, string const& _context
|
|||||||
|
|
||||||
longestContext = context.length();
|
longestContext = context.length();
|
||||||
longestPrefix = prefix.length();
|
longestPrefix = prefix.length();
|
||||||
bestMatchTarget = redir.target;
|
bestMatchTarget = sanitizePath(redir.target);
|
||||||
}
|
}
|
||||||
|
|
||||||
string path = bestMatchTarget;
|
string path = bestMatchTarget;
|
||||||
path.append(_path.begin() + longestPrefix, _path.end());
|
path.append(_path.begin() + longestPrefix, _path.end());
|
||||||
return path;
|
return path;
|
||||||
|
@ -189,14 +189,14 @@ BOOST_AUTO_TEST_CASE(context_dependent_remappings_order_independent)
|
|||||||
c.setRemappings(vector<string>{"a:x/y/z=d", "a/b:x=e"});
|
c.setRemappings(vector<string>{"a:x/y/z=d", "a/b:x=e"});
|
||||||
c.addSource("a/main.sol", "import \"x/y/z/z.sol\"; contract Main is D {} pragma solidity >=0.0;");
|
c.addSource("a/main.sol", "import \"x/y/z/z.sol\"; contract Main is D {} pragma solidity >=0.0;");
|
||||||
c.addSource("a/b/main.sol", "import \"x/y/z/z.sol\"; contract Main is E {} pragma solidity >=0.0;");
|
c.addSource("a/b/main.sol", "import \"x/y/z/z.sol\"; contract Main is E {} pragma solidity >=0.0;");
|
||||||
c.addSource("x/y/z/z.sol", "contract D {} pragma solidity >=0.0;");
|
c.addSource("d/z.sol", "contract D {} pragma solidity >=0.0;");
|
||||||
c.addSource("e/y/z/z.sol", "contract E {} pragma solidity >=0.0;");
|
c.addSource("e/y/z/z.sol", "contract E {} pragma solidity >=0.0;");
|
||||||
BOOST_CHECK(c.compile());
|
BOOST_CHECK(c.compile());
|
||||||
CompilerStack d;
|
CompilerStack d;
|
||||||
d.setRemappings(vector<string>{"a/b:x=e", "a:x/y/z=d"});
|
d.setRemappings(vector<string>{"a/b:x=e", "a:x/y/z=d"});
|
||||||
d.addSource("a/main.sol", "import \"x/y/z/z.sol\"; contract Main is D {} pragma solidity >=0.0;");
|
d.addSource("a/main.sol", "import \"x/y/z/z.sol\"; contract Main is D {} pragma solidity >=0.0;");
|
||||||
d.addSource("a/b/main.sol", "import \"x/y/z/z.sol\"; contract Main is E {} pragma solidity >=0.0;");
|
d.addSource("a/b/main.sol", "import \"x/y/z/z.sol\"; contract Main is E {} pragma solidity >=0.0;");
|
||||||
d.addSource("x/y/z/z.sol", "contract D {} pragma solidity >=0.0;");
|
d.addSource("d/z.sol", "contract D {} pragma solidity >=0.0;");
|
||||||
d.addSource("e/y/z/z.sol", "contract E {} pragma solidity >=0.0;");
|
d.addSource("e/y/z/z.sol", "contract E {} pragma solidity >=0.0;");
|
||||||
BOOST_CHECK(d.compile());
|
BOOST_CHECK(d.compile());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user