Skip to content

Commit

Permalink
refactor: impl IndexMut<Handle<Expression>> for FunctionInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichDonGubler committed Oct 25, 2022
1 parent e6792b1 commit 6b3dab0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/valid/analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ impl ops::Index<Handle<crate::Expression>> for FunctionInfo {
}
}

impl ops::IndexMut<Handle<crate::Expression>> for FunctionInfo {
fn index_mut(&mut self, handle: Handle<crate::Expression>) -> &mut ExpressionInfo {
&mut self.expressions[handle.index()]
}
}

/// Disruptor of the uniform control flow.
#[derive(Clone, Copy, Debug, thiserror::Error)]
#[cfg_attr(test, derive(PartialEq))]
Expand Down Expand Up @@ -707,7 +713,7 @@ impl FunctionInfo {
};

let ty = resolve_context.resolve(expression, |h| Ok(&self[h].ty))?;
self.expressions[handle.index()] = ExpressionInfo {
self[handle] = ExpressionInfo {
uniformity,
ref_count: 0,
assignable_global,
Expand Down

0 comments on commit 6b3dab0

Please sign in to comment.