compiler: Add layout information the the Element

This commit is contained in:
Olivier Goffart 2023-09-14 12:31:15 +02:00 committed by Olivier Goffart
parent 3a8c64c946
commit 3b7c2d0c5e
5 changed files with 15 additions and 3 deletions

View file

@ -649,6 +649,9 @@ pub struct Element {
/// The AST node, if available
pub node: Option<syntax_nodes::Element>,
/// This element was a layout that has been lowered to a Rectangle
pub layout: Option<crate::layout::Layout>,
}
impl Spanned for Element {
@ -2127,6 +2130,9 @@ pub fn visit_all_named_references_in_element(
let mut layout_info_prop = std::mem::take(&mut elem.borrow_mut().layout_info_prop);
layout_info_prop.as_mut().map(|(h, b)| (vis(h), vis(b)));
elem.borrow_mut().layout_info_prop = layout_info_prop;
let mut layout = std::mem::take(&mut elem.borrow_mut().layout);
layout.as_mut().map(|l| l.visit_named_references(&mut vis));
elem.borrow_mut().layout = layout;
let mut accessibility_props = std::mem::take(&mut elem.borrow_mut().accessibility_props);
accessibility_props.0.iter_mut().for_each(|(_, x)| vis(x));