Skip to content

Commit

Permalink
fixup! refactor: split handle validation into early pass in `Validato…
Browse files Browse the repository at this point in the history
…r::validate`

Resolves
<gfx-rs#2090 (comment)>.
  • Loading branch information
ErichDonGubler committed Dec 16, 2022
1 parent af21150 commit 62f43a6
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/valid/handles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,16 +379,16 @@ impl super::Validator {
Ok(())
};

block.iter().try_for_each(|stmt| match stmt {
&crate::Statement::Emit(ref expr_range) => {
block.iter().try_for_each(|stmt| match *stmt {
crate::Statement::Emit(ref expr_range) => {
expr_range.check_valid_for(expressions)?;
Ok(())
}
&crate::Statement::Block(ref block) => {
crate::Statement::Block(ref block) => {
validate_block(block)?;
Ok(())
}
&crate::Statement::If {
crate::Statement::If {
condition,
ref accept,
ref reject,
Expand All @@ -398,12 +398,12 @@ impl super::Validator {
validate_block(reject)?;
Ok(())
}
&crate::Statement::Switch {
crate::Statement::Switch {
selector,
ref cases,
} => {
validate_expr(selector)?;
for &crate::SwitchCase {
for crate::SwitchCase {
value: _,
ref body,
fall_through: _,
Expand All @@ -413,7 +413,7 @@ impl super::Validator {
}
Ok(())
}
&crate::Statement::Loop {
crate::Statement::Loop {
ref body,
ref continuing,
break_if,
Expand All @@ -423,13 +423,13 @@ impl super::Validator {
validate_expr_opt(break_if)?;
Ok(())
}
&crate::Statement::Return { value } => validate_expr_opt(value),
&crate::Statement::Store { pointer, value } => {
crate::Statement::Return { value } => validate_expr_opt(value),
crate::Statement::Store { pointer, value } => {
validate_expr(pointer)?;
validate_expr(value)?;
Ok(())
}
&crate::Statement::ImageStore {
crate::Statement::ImageStore {
image,
coordinate,
array_index,
Expand All @@ -441,7 +441,7 @@ impl super::Validator {
validate_expr(value)?;
Ok(())
}
&crate::Statement::Atomic {
crate::Statement::Atomic {
pointer,
fun,
value,
Expand All @@ -462,7 +462,7 @@ impl super::Validator {
validate_expr(result)?;
Ok(())
}
&crate::Statement::Call {
crate::Statement::Call {
function,
ref arguments,
result,
Expand All @@ -474,10 +474,10 @@ impl super::Validator {
validate_expr_opt(result)?;
Ok(())
}
&crate::Statement::Break
| &crate::Statement::Continue
| &crate::Statement::Kill
| &crate::Statement::Barrier(_) => Ok(()),
crate::Statement::Break
| crate::Statement::Continue
| crate::Statement::Kill
| crate::Statement::Barrier(_) => Ok(()),
})
}
}
Expand Down

0 comments on commit 62f43a6

Please sign in to comment.