Skip to content

Commit

Permalink
bring up nested or_else
Browse files Browse the repository at this point in the history
  • Loading branch information
emo-eth committed Feb 9, 2024
1 parent 1ab8d4d commit 40d197b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/debugger/src/tui/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,20 +358,20 @@ impl DebuggerContext<'_> {
let ic = pc_ic_map.get(pc)?;
let source_element = source_map.swap_remove(ic);
// if the source element has an index, find the sourcemap for that index
source_element.index.and_then(|index| {
source_element.index.and_then(|index|
// if index matches current file_id, return current source code
(index == *file_id).then_some((source_element.clone(), source_code)).or_else(
(index == *file_id).then_some((source_element.clone(), source_code))).or_else(
|| {
// otherwise find the source code for the element's index
self.debugger
.contracts_sources
.sources_by_id
.get(&index)
.get(&(source_element.index?))
.map(|(source_code, _)| (source_element.clone(), source_code))
},
)
})
})

else {
return Err(format!("No source map for contract {contract_name}"));
};
Expand Down

0 comments on commit 40d197b

Please sign in to comment.