mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
[naga] Make BlockContext::resolve_pointer_type
infallible.
Since `BlockContext::resolve_pointer_type` never returns an error, change its result type from a `Result` to a `&TypeInner`. Adjust callers accordingly. Remove calls (well, there's only one) to `resolve_pointer_type` entirely when the caller does not need the value, since `resolve_pointer_type` is now infallible and has no side effects.
This commit is contained in:
parent
049db89039
commit
badcaee6e3
@ -257,11 +257,8 @@ impl<'a> BlockContext<'a> {
|
|||||||
.map_err_inner(|source| FunctionError::Expression { handle, source }.with_span())
|
.map_err_inner(|source| FunctionError::Expression { handle, source }.with_span())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_pointer_type(
|
fn resolve_pointer_type(&self, handle: Handle<crate::Expression>) -> &crate::TypeInner {
|
||||||
&self,
|
self.info[handle].ty.inner_with(self.types)
|
||||||
handle: Handle<crate::Expression>,
|
|
||||||
) -> Result<&crate::TypeInner, FunctionError> {
|
|
||||||
Ok(self.info[handle].ty.inner_with(self.types))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,9 +807,6 @@ impl super::Validator {
|
|||||||
S::Store { pointer, value } => {
|
S::Store { pointer, value } => {
|
||||||
let mut current = pointer;
|
let mut current = pointer;
|
||||||
loop {
|
loop {
|
||||||
let _ = context
|
|
||||||
.resolve_pointer_type(current)
|
|
||||||
.map_err(|e| e.with_span())?;
|
|
||||||
match context.expressions[current] {
|
match context.expressions[current] {
|
||||||
crate::Expression::Access { base, .. }
|
crate::Expression::Access { base, .. }
|
||||||
| crate::Expression::AccessIndex { base, .. } => current = base,
|
| crate::Expression::AccessIndex { base, .. } => current = base,
|
||||||
@ -835,9 +829,7 @@ impl super::Validator {
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let pointer_ty = context
|
let pointer_ty = context.resolve_pointer_type(pointer);
|
||||||
.resolve_pointer_type(pointer)
|
|
||||||
.map_err(|e| e.with_span())?;
|
|
||||||
|
|
||||||
let good = match *pointer_ty {
|
let good = match *pointer_ty {
|
||||||
Ti::Pointer { base, space: _ } => match context.types[base].inner {
|
Ti::Pointer { base, space: _ } => match context.types[base].inner {
|
||||||
|
Loading…
Reference in New Issue
Block a user