restructure this a bit

This commit is contained in:
Douglas Creager 2025-11-14 11:22:02 -05:00
parent ea0bffb571
commit 4b7f75adae

View file

@ -734,15 +734,23 @@ impl<'db> Node<'db> {
Node::AlwaysTrue => true,
Node::AlwaysFalse => false,
Node::Interior(interior) => {
// with_assignment will return None if this node's constraint causes the if_true
// edge to become impossible. We want to ignore impossible paths, and so we treat
// them as passing the "always satisfied" check.
let constraint = interior.constraint(db);
path.with_assignment(db, map, constraint.when_true(), |path| {
let true_always_satisfied = path
.with_assignment(db, map, constraint.when_true(), |path| {
interior
.if_true(db)
.is_always_satisfied_inner(db, map, path)
})
.unwrap_or(true)
&& path
.with_assignment(db, map, constraint.when_false(), |path| {
.unwrap_or(true);
if !true_always_satisfied {
return false;
}
// Ditto for the if_false branch
path.with_assignment(db, map, constraint.when_false(), |path| {
interior
.if_false(db)
.is_always_satisfied_inner(db, map, path)
@ -775,13 +783,21 @@ impl<'db> Node<'db> {
Node::AlwaysTrue => false,
Node::AlwaysFalse => true,
Node::Interior(interior) => {
// with_assignment will return None if this node's constraint causes the if_true
// edge to become impossible. We want to ignore impossible paths, and so we treat
// them as passing the "never satisfied" check.
let constraint = interior.constraint(db);
path.with_assignment(db, map, constraint.when_true(), |path| {
let true_never_satisfied = path
.with_assignment(db, map, constraint.when_true(), |path| {
interior.if_true(db).is_never_satisfied_inner(db, map, path)
})
.unwrap_or(true)
&& path
.with_assignment(db, map, constraint.when_false(), |path| {
.unwrap_or(true);
if !true_never_satisfied {
return false;
}
// Ditto for the if_false branch
path.with_assignment(db, map, constraint.when_false(), |path| {
interior
.if_false(db)
.is_never_satisfied_inner(db, map, path)