@@ -752,10 +752,24 @@ pub enum Expression {
752752 /// So this looks like `layout_cache_prop[layout_cache_prop[index] + repeater_index]`
753753 repeater_index : Option < Box < Expression > > ,
754754 } ,
755+
756+ /// Organize a grid layout, i.e. decide what goes where
757+ OrganizeGridLayout ( crate :: layout:: GridLayout ) ,
758+
755759 /// Compute the LayoutInfo for the given layout.
756760 /// The orientation is the orientation of the cache, not the orientation of the layout
757761 ComputeLayoutInfo ( crate :: layout:: Layout , crate :: layout:: Orientation ) ,
762+ ComputeGridLayoutInfo {
763+ layout_organized_data_prop : NamedReference ,
764+ layout : crate :: layout:: GridLayout ,
765+ orientation : crate :: layout:: Orientation ,
766+ } ,
758767 SolveLayout ( crate :: layout:: Layout , crate :: layout:: Orientation ) ,
768+ SolveGridLayout {
769+ layout_organized_data_prop : NamedReference ,
770+ layout : crate :: layout:: GridLayout ,
771+ orientation : crate :: layout:: Orientation ,
772+ } ,
759773
760774 MinMax {
761775 ty : Type ,
@@ -883,8 +897,11 @@ impl Expression {
883897 // invalid because the expression is unreachable
884898 Expression :: ReturnStatement ( _) => Type :: Invalid ,
885899 Expression :: LayoutCacheAccess { .. } => Type :: LogicalLength ,
900+ Expression :: OrganizeGridLayout ( ..) => typeregister:: organized_layout_type ( ) . into ( ) ,
886901 Expression :: ComputeLayoutInfo ( ..) => typeregister:: layout_info_type ( ) . into ( ) ,
902+ Expression :: ComputeGridLayoutInfo { .. } => typeregister:: layout_info_type ( ) . into ( ) ,
887903 Expression :: SolveLayout ( ..) => Type :: LayoutCache ,
904+ Expression :: SolveGridLayout { .. } => Type :: LayoutCache ,
888905 Expression :: MinMax { ty, .. } => ty. clone ( ) ,
889906 Expression :: EmptyComponentFactory => Type :: ComponentFactory ,
890907 Expression :: DebugHook { expression, .. } => expression. ty ( ) ,
@@ -982,8 +999,11 @@ impl Expression {
982999 Expression :: LayoutCacheAccess { repeater_index, .. } => {
9831000 repeater_index. as_deref ( ) . map ( visitor) ;
9841001 }
1002+ Expression :: OrganizeGridLayout ( ..) => { }
9851003 Expression :: ComputeLayoutInfo ( ..) => { }
1004+ Expression :: ComputeGridLayoutInfo { .. } => { }
9861005 Expression :: SolveLayout ( ..) => { }
1006+ Expression :: SolveGridLayout { .. } => { }
9871007 Expression :: MinMax { lhs, rhs, .. } => {
9881008 visitor ( lhs) ;
9891009 visitor ( rhs) ;
@@ -1086,8 +1106,11 @@ impl Expression {
10861106 Expression :: LayoutCacheAccess { repeater_index, .. } => {
10871107 repeater_index. as_deref_mut ( ) . map ( visitor) ;
10881108 }
1109+ Expression :: OrganizeGridLayout ( ..) => { }
10891110 Expression :: ComputeLayoutInfo ( ..) => { }
1111+ Expression :: ComputeGridLayoutInfo { .. } => { }
10901112 Expression :: SolveLayout ( ..) => { }
1113+ Expression :: SolveGridLayout { .. } => { }
10911114 Expression :: MinMax { lhs, rhs, .. } => {
10921115 visitor ( lhs) ;
10931116 visitor ( rhs) ;
@@ -1180,8 +1203,11 @@ impl Expression {
11801203 }
11811204 // TODO: detect constant property within layouts
11821205 Expression :: LayoutCacheAccess { .. } => false ,
1206+ Expression :: OrganizeGridLayout { .. } => false ,
11831207 Expression :: ComputeLayoutInfo ( ..) => false ,
1208+ Expression :: ComputeGridLayoutInfo { .. } => false ,
11841209 Expression :: SolveLayout ( ..) => false ,
1210+ Expression :: SolveGridLayout { .. } => false ,
11851211 Expression :: MinMax { lhs, rhs, .. } => lhs. is_constant ( ga) && rhs. is_constant ( ga) ,
11861212 Expression :: EmptyComponentFactory => true ,
11871213 Expression :: DebugHook { .. } => false ,
@@ -1856,8 +1882,11 @@ pub fn pretty_print(f: &mut dyn std::fmt::Write, expression: &Expression) -> std
18561882 if repeater_index. is_some( ) { " + $index" } else { "" }
18571883 )
18581884 }
1885+ Expression :: OrganizeGridLayout ( ..) => write ! ( f, "organize_grid_layout(..)" ) ,
18591886 Expression :: ComputeLayoutInfo ( ..) => write ! ( f, "layout_info(..)" ) ,
1887+ Expression :: ComputeGridLayoutInfo { .. } => write ! ( f, "grid_layout_info(..)" ) ,
18601888 Expression :: SolveLayout ( ..) => write ! ( f, "solve_layout(..)" ) ,
1889+ Expression :: SolveGridLayout { .. } => write ! ( f, "solve_grid_layout(..)" ) ,
18611890 Expression :: MinMax { ty : _, op, lhs, rhs } => {
18621891 match op {
18631892 MinMaxOp :: Min => write ! ( f, "min(" ) ?,
0 commit comments