[wgsl-in] Consolidate array and struct cases in construction.

This commit is contained in:
Jim Blandy
2023-10-20 21:45:56 -07:00
parent f081f06f54
commit 49f6730624

View File

@@ -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)