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`
  • Loading branch information
ErichDonGubler committed Dec 13, 2022
1 parent 00f4f6b commit ce6f85e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/valid/handles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl super::Validator {
)?;
}

Self::validate_block_handles(body, expressions, local_variables, functions)?;
Self::validate_block_handles(body, expressions, functions)?;

Ok(())
};
Expand Down Expand Up @@ -369,11 +369,9 @@ impl super::Validator {
fn validate_block_handles(
block: &crate::Block,
expressions: &Arena<crate::Expression>,
local_variables: &Arena<crate::LocalVariable>,
functions: &Arena<crate::Function>,
) -> Result<(), InvalidHandleError> {
let validate_block =
|block| Self::validate_block_handles(block, expressions, local_variables, functions);
let validate_block = |block| Self::validate_block_handles(block, expressions, functions);
let validate_expr = |handle| Self::validate_expression_handle(handle, expressions);
let validate_expr_opt = |handle_opt| {
if let Some(handle) = handle_opt {
Expand Down
2 changes: 1 addition & 1 deletion src/valid/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl From<HandleValidationError> for ValidationError {
depends_on,
}) => Self::Type {
handle: ty,
name: ty_name.clone().unwrap_or_default(),
name: ty_name.unwrap_or_default(),
source: TypeError::InvalidArraySizeConstant(depends_on),
},
}
Expand Down

0 comments on commit ce6f85e

Please sign in to comment.