[naga wgsl-in] Rename TemplateListIter::scalar to scalar_ty.

The name `scalar` suggests that it returns a scalar value, and
`scalar_ty` is analogous to `ty`.
This commit is contained in:
Jim Blandy authored and Teodor Tanasoaia committed 2026-01-28 12:00:35 +01:00
1 parent 0c77a1f6ca
commit 5217dbdfa3
2 files changed
+10 -5

No files matched your search

+4 -4
View File
@@ -2693,11 +2693,11 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
conv::PredeclaredType::TypeGenerator(type_generator) => {
let ty_inner = match type_generator {
conv::TypeGenerator::Vector { size } => {
let (scalar, _) = tl.scalar(self, ctx)?;
let (scalar, _) = tl.scalar_ty(self, ctx)?;
ir::TypeInner::Vector { size, scalar }
}
conv::TypeGenerator::Matrix { columns, rows } => {
let (scalar, span) = tl.scalar(self, ctx)?;
let (scalar, span) = tl.scalar_ty(self, ctx)?;
if scalar.kind != ir::ScalarKind::Float {
return Err(Box::new(Error::BadMatrixScalarKind(span, scalar)));
}
@@ -2727,7 +2727,7 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
ir::TypeInner::Array { base, size, stride }
}
conv::TypeGenerator::Atomic => {
let (scalar, _) = tl.scalar(self, ctx)?;
let (scalar, _) = tl.scalar_ty(self, ctx)?;
ir::TypeInner::Atomic(scalar)
}
conv::TypeGenerator::Pointer => {
@@ -2741,7 +2741,7 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
arrayed,
multi,
} => {
let (scalar, span) = tl.scalar(self, ctx)?;
let (scalar, span) = tl.scalar_ty(self, ctx)?;
let ir::Scalar { kind, width } = scalar;
if width != 4 {
return Err(Box::new(Error::BadTextureSampleType { span, scalar }));
+6 -1
View File
@@ -63,6 +63,11 @@ impl<'iter, 'source> TemplateListIter<'iter, 'source> {
lowerer.type_expression(expr, ctx)
}
/// Lower the next template list element as a type, and return its span.
///
/// This returns the span of the template list element. This is generally
/// different from the span of the returned `Handle<ir::Type>`, as the
/// latter may refer to the type's definition, not its use in the template list.
pub fn ty_with_span(
&mut self,
lowerer: &mut Lowerer<'source, '_>,
@@ -74,7 +79,7 @@ impl<'iter, 'source> TemplateListIter<'iter, 'source> {
Ok((ty, span))
}
pub fn scalar(
pub fn scalar_ty(
&mut self,
lowerer: &mut Lowerer<'source, '_>,
ctx: &mut ExpressionContext<'source, '_, '_>,