Skip to content

Commit

Permalink
refactor(naga): use named fields for `ExpressionError::InvalidBinaryO…
Browse files Browse the repository at this point in the history
…perandTypes`
  • Loading branch information
ErichDonGubler committed Nov 12, 2024
1 parent cffc793 commit 59897f1
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions naga/src/valid/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ pub enum ExpressionError {
IndexableLength(#[from] IndexableLengthError),
#[error("Operation {0:?} can't work with {1:?}")]
InvalidUnaryOperandType(crate::UnaryOperator, Handle<crate::Expression>),
#[error("Operation {0:?} can't work with {1:?} and {2:?}")]
InvalidBinaryOperandTypes(
crate::BinaryOperator,
Handle<crate::Expression>,
Handle<crate::Expression>,
),
#[error("Operation {op:?} can't work with {lhs:?} and {rhs:?}")]
InvalidBinaryOperandTypes {
op: crate::BinaryOperator,
lhs: Handle<crate::Expression>,
rhs: Handle<crate::Expression>,
},
#[error("Selecting is not possible")]
InvalidSelectTypes,
#[error("Relational argument {0:?} is not a boolean vector")]
Expand Down Expand Up @@ -847,7 +847,11 @@ impl super::Validator {
function.expressions[right],
right_inner
);
return Err(ExpressionError::InvalidBinaryOperandTypes(op, left, right));
return Err(ExpressionError::InvalidBinaryOperandTypes {
op,
lhs: left,
rhs: right,
});
}
ShaderStages::all()
}
Expand Down

0 comments on commit 59897f1

Please sign in to comment.