Skip to content

Commit

Permalink
fix: more robust anchor selection
Browse files Browse the repository at this point in the history
Consider the full range instead of just the offset.

Unfortunately breaks detection of some items; suspected to
be related to not using constructor source maps.
  • Loading branch information
onbjerg committed Jun 14, 2022
1 parent 3bb07ce commit 5742f53
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions evm/src/coverage/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,17 @@ impl Visitor {
.iter()
.enumerate()
.find(|(_, element)| {
element.index.map_or(false, |source_id| {
source_id == self.source_id && element.offset >= loc.start
})
element
.index
.and_then(|source_id| {
Some(
source_id == self.source_id &&
element.offset >= loc.start &&
element.offset + element.length <=
loc.start + loc.length?,
)
})
.unwrap_or_default()
})
.map(|(ic, _)| ic)
})
Expand Down

0 comments on commit 5742f53

Please sign in to comment.