mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 18:28:11 +08:00
Verify computed layouts match construction at node construction
This commit is contained in:
@@ -476,6 +476,7 @@ impl BorrowTree {
|
|||||||
.clone()
|
.clone()
|
||||||
.to_edge()
|
.to_edge()
|
||||||
.map_err(|error| vec![GraphError::new(&proto_node, GraphErrorType::ConstructionFailed(error))])?;
|
.map_err(|error| vec![GraphError::new(&proto_node, GraphErrorType::ConstructionFailed(error))])?;
|
||||||
|
debug_assert!(proto_node.resolved_layout().map_or(true, |expected| node.layout() == Some(expected)), "layout pass disagrees with construction for {}", proto_node.identifier.as_str());
|
||||||
self.store_node(node, id, path.into());
|
self.store_node(node, id, path.into());
|
||||||
}
|
}
|
||||||
ConstructionArgs::Inline(_) => unimplemented!("Inline nodes are not supported yet"),
|
ConstructionArgs::Inline(_) => unimplemented!("Inline nodes are not supported yet"),
|
||||||
@@ -483,6 +484,7 @@ impl BorrowTree {
|
|||||||
let construction_nodes = self.node_deps(ids);
|
let construction_nodes = self.node_deps(ids);
|
||||||
let constructor = typing_context.constructor(id).ok_or_else(|| vec![GraphError::new(&proto_node, GraphErrorType::NoConstructor)])?;
|
let constructor = typing_context.constructor(id).ok_or_else(|| vec![GraphError::new(&proto_node, GraphErrorType::NoConstructor)])?;
|
||||||
let node = constructor(construction_nodes).map_err(|error| vec![GraphError::new(&proto_node, GraphErrorType::ConstructionFailed(format!("{error:?}")))])?;
|
let node = constructor(construction_nodes).map_err(|error| vec![GraphError::new(&proto_node, GraphErrorType::ConstructionFailed(format!("{error:?}")))])?;
|
||||||
|
debug_assert!(proto_node.resolved_layout().map_or(true, |expected| node.layout() == Some(expected)), "layout pass disagrees with construction for {}", proto_node.identifier.as_str());
|
||||||
self.store_node(node, id, path.into());
|
self.store_node(node, id, path.into());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user