fix(solc): flatten replacement target location (#846)
* adjust the end location * upd changelog
This commit is contained in:
parent
01544ec4b7
commit
a48496000a
|
@ -38,6 +38,8 @@
|
|||
|
||||
### Unreleased
|
||||
|
||||
- Fix flatten replacement target location
|
||||
[#846](https://github.com/gakonst/ethers-rs/pull/846)
|
||||
- Fix duplicate files during flattening
|
||||
[#813](https://github.com/gakonst/ethers-rs/pull/813)
|
||||
- Add ability to flatten file imports
|
||||
|
|
|
@ -485,7 +485,8 @@ impl<T> SolDataUnit<T> {
|
|||
pub fn loc_by_offset(&self, offset: isize) -> (usize, usize) {
|
||||
(
|
||||
offset.saturating_add(self.loc.start as isize) as usize,
|
||||
offset.saturating_add(self.loc.end as isize) as usize,
|
||||
// make the end location exclusive
|
||||
offset.saturating_add(self.loc.end as isize + 1) as usize,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -376,4 +376,5 @@ fn can_flatten_file_with_duplicates() {
|
|||
assert_eq!(result.matches("contract Foo {").count(), 1);
|
||||
assert_eq!(result.matches("contract Bar {").count(), 1);
|
||||
assert_eq!(result.matches("contract FooBar {").count(), 1);
|
||||
assert_eq!(result.matches(";").count(), 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue