Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JustusAdam committed Sep 15, 2023
1 parent 7ea816f commit 71398f7
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 50 deletions.
20 changes: 9 additions & 11 deletions crates/dfcheck/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,17 +305,15 @@ fn test_happens_before() -> Result<()> {
desc.annotations
.get(&function.function)
.map_or(false, |(anns, _)| {
anns.iter()
.filter_map(Annotation::as_marker)
.any(|ann| {
ann.marker == marker
&& (ann
.refinement
.on_argument()
.contains(*arg_slot as u32)
.unwrap()
|| ann.refinement.on_self())
})
anns.iter().filter_map(Annotation::as_marker).any(|ann| {
ann.marker == marker
&& (ann
.refinement
.on_argument()
.contains(*arg_slot as u32)
.unwrap()
|| ann.refinement.on_self())
})
})
} else {
false
Expand Down
79 changes: 40 additions & 39 deletions crates/dfpp/src/frg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,51 +678,52 @@ impl ProgramDescriptionExt for ProgramDescription {
// Part of why we choose this behavior is because there is no
// call-site-independent representation for arguments, so the
// label has to be attached to the call site argument.
anns.iter()
.filter_map(Annotation::as_marker)
.map(move |a| {
(
if a.refinement.on_return() {
Some(self.all_sources_with_ctrl().into_iter().filter(|(_, s)| {
s.as_function_call().map_or(false, |c| &c.function == id)
}))
} else {
None
}
.into_iter()
.flatten()
.map(|(ctrl, ds)| data_source_as_forge(ds, alloc, ctrl))
.chain(
self.all_sinks()
.into_iter()
.filter(|s| {
matches!(
s,
DataSink::Argument{function, arg_slot} if
&function.function == id
&& a.refinement
.on_argument()
.is_set(*arg_slot as u32)
)
})
.map(|s| s.build_forge(alloc)),
)
.chain([id.build_forge(alloc)])
.chain(a.refinement.on_argument().into_iter_set_in_domain().map(
|slot| {
anns.iter().filter_map(Annotation::as_marker).map(move |a| {
(
if a.refinement.on_return() {
Some(self.all_sources_with_ctrl().into_iter().filter(|(_, s)| {
s.as_function_call().map_or(false, |c| &c.function == id)
}))
} else {
None
}
.into_iter()
.flatten()
.map(|(ctrl, ds)| data_source_as_forge(ds, alloc, ctrl))
.chain(
self.all_sinks()
.into_iter()
.filter(|s| {
matches!(
s,
DataSink::Argument{function, arg_slot} if
&function.function == id
&& a.refinement
.on_argument()
.is_set(*arg_slot as u32)
)
})
.map(|s| s.build_forge(alloc)),
)
.chain([id.build_forge(alloc)])
.chain(
a.refinement
.on_argument()
.into_iter_set_in_domain()
.map(|slot| {
FormalParameter {
function: *id,
position: slot as u16,
}
.build_forge(alloc)
},
))
// This is necessary because otherwise captured variables escape
.collect::<Vec<_>>()
.into_iter(),
std::iter::once(a.marker.build_forge(alloc)),
}),
)
})
// This is necessary because otherwise captured variables escape
.collect::<Vec<_>>()
.into_iter(),
std::iter::once(a.marker.build_forge(alloc)),
)
})
}))
.append(" +")
.append(alloc.hardline())
Expand Down

0 comments on commit 71398f7

Please sign in to comment.