From 49f6730624537ca7448d01f6a91707aee978d0bc Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Fri, 20 Oct 2023 21:45:56 -0700 Subject: [PATCH] [wgsl-in] Consolidate array and struct cases in construction. --- src/front/wgsl/lower/construction.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/front/wgsl/lower/construction.rs b/src/front/wgsl/lower/construction.rs index 12e30d28de..d02826834c 100644 --- a/src/front/wgsl/lower/construction.rs +++ b/src/front/wgsl/lower/construction.rs @@ -466,20 +466,18 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { crate::Expression::Compose { ty, components } } - // Array constructor - (components, ConcreteConstructor::Type(ty, &crate::TypeInner::Array { .. })) => { + // Array or Struct constructor + ( + components, + ConcreteConstructor::Type( + ty, + &crate::TypeInner::Array { .. } | &crate::TypeInner::Struct { .. }, + ), + ) => { let components = components.into_components_vec(); crate::Expression::Compose { ty, components } } - // Struct constructor - (components, ConcreteConstructor::Type(ty, &crate::TypeInner::Struct { .. })) => { - crate::Expression::Compose { - ty, - components: components.into_components_vec(), - } - } - // ERRORS // Bad conversion (type cast)